mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 23:11:58 +00:00
- fix VM native calls containing strings and enable them again
This commit is contained in:
parent
4f078dfcb3
commit
5d9784f215
2 changed files with 35 additions and 26 deletions
|
@ -360,13 +360,17 @@ void JitCompiler::EmitNativeCall(VMNativeFunction *target)
|
||||||
call->setArg(slot, regS[bc]);
|
call->setArg(slot, regS[bc]);
|
||||||
break;
|
break;
|
||||||
case REGT_STRING | REGT_KONST:
|
case REGT_STRING | REGT_KONST:
|
||||||
call->setArg(slot, imm_ptr(&konsts[bc]));
|
tmp = newTempIntPtr();
|
||||||
|
cc.mov(tmp, imm_ptr(&konsts[bc]));
|
||||||
|
call->setArg(slot, tmp);
|
||||||
break;
|
break;
|
||||||
case REGT_POINTER:
|
case REGT_POINTER:
|
||||||
call->setArg(slot, regA[bc]);
|
call->setArg(slot, regA[bc]);
|
||||||
break;
|
break;
|
||||||
case REGT_POINTER | REGT_KONST:
|
case REGT_POINTER | REGT_KONST:
|
||||||
call->setArg(slot, asmjit::imm_ptr(konsta[bc].v));
|
tmp = newTempIntPtr();
|
||||||
|
cc.mov(tmp, imm_ptr(konsta[bc].v));
|
||||||
|
call->setArg(slot, tmp);
|
||||||
break;
|
break;
|
||||||
case REGT_FLOAT:
|
case REGT_FLOAT:
|
||||||
call->setArg(slot, regF[bc]);
|
call->setArg(slot, regF[bc]);
|
||||||
|
@ -442,28 +446,36 @@ void JitCompiler::EmitNativeCall(VMNativeFunction *target)
|
||||||
|
|
||||||
CheckVMFrame();
|
CheckVMFrame();
|
||||||
|
|
||||||
auto regPtr = newTempIntPtr();
|
if ((type & REGT_TYPE) == REGT_STRING)
|
||||||
|
|
||||||
switch (type & REGT_TYPE)
|
|
||||||
{
|
{
|
||||||
case REGT_INT:
|
// For strings we already have them on the stack and got named registers for them.
|
||||||
cc.lea(regPtr, x86::ptr(vmframe, offsetD + (int)(regnum * sizeof(int32_t))));
|
call->setArg(numparams + i - startret, regS[regnum]);
|
||||||
break;
|
|
||||||
case REGT_FLOAT:
|
|
||||||
cc.lea(regPtr, x86::ptr(vmframe, offsetF + (int)(regnum * sizeof(double))));
|
|
||||||
break;
|
|
||||||
case REGT_STRING:
|
|
||||||
cc.lea(regPtr, x86::ptr(vmframe, offsetS + (int)(regnum * sizeof(FString))));
|
|
||||||
break;
|
|
||||||
case REGT_POINTER:
|
|
||||||
cc.lea(regPtr, x86::ptr(vmframe, offsetA + (int)(regnum * sizeof(void*))));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
I_FatalError("Unknown OP_RESULT type encountered\n");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto regPtr = newTempIntPtr();
|
||||||
|
|
||||||
call->setArg(numparams + i - startret, regPtr);
|
switch (type & REGT_TYPE)
|
||||||
|
{
|
||||||
|
case REGT_INT:
|
||||||
|
cc.lea(regPtr, x86::ptr(vmframe, offsetD + (int)(regnum * sizeof(int32_t))));
|
||||||
|
break;
|
||||||
|
case REGT_FLOAT:
|
||||||
|
cc.lea(regPtr, x86::ptr(vmframe, offsetF + (int)(regnum * sizeof(double))));
|
||||||
|
break;
|
||||||
|
case REGT_STRING:
|
||||||
|
cc.lea(regPtr, x86::ptr(vmframe, offsetS + (int)(regnum * sizeof(FString))));
|
||||||
|
break;
|
||||||
|
case REGT_POINTER:
|
||||||
|
cc.lea(regPtr, x86::ptr(vmframe, offsetA + (int)(regnum * sizeof(void*))));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
I_FatalError("Unknown OP_RESULT type encountered\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
call->setArg(numparams + i - startret, regPtr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cc.setCursor(cursorAfter);
|
cc.setCursor(cursorAfter);
|
||||||
|
@ -621,14 +633,11 @@ asmjit::FuncSignature JitCompiler::CreateFuncSignature()
|
||||||
rettype = TypeIdOf<double>::kTypeId;
|
rettype = TypeIdOf<double>::kTypeId;
|
||||||
key += "rf";
|
key += "rf";
|
||||||
break;
|
break;
|
||||||
case REGT_STRING:
|
|
||||||
rettype = TypeIdOf<void*>::kTypeId;
|
|
||||||
key += "rs";
|
|
||||||
break;
|
|
||||||
case REGT_POINTER:
|
case REGT_POINTER:
|
||||||
rettype = TypeIdOf<void*>::kTypeId;
|
rettype = TypeIdOf<void*>::kTypeId;
|
||||||
key += "rv";
|
key += "rv";
|
||||||
break;
|
break;
|
||||||
|
case REGT_STRING:
|
||||||
default:
|
default:
|
||||||
startret = 0;
|
startret = 0;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -591,7 +591,7 @@ struct AFuncDesc
|
||||||
#define DEFINE_ACTION_FUNCTION_NATIVE(cls, name, native) \
|
#define DEFINE_ACTION_FUNCTION_NATIVE(cls, name, native) \
|
||||||
static int AF_##cls##_##name(VM_ARGS); \
|
static int AF_##cls##_##name(VM_ARGS); \
|
||||||
VMNativeFunction *cls##_##name##_VMPtr; \
|
VMNativeFunction *cls##_##name##_VMPtr; \
|
||||||
static const AFuncDesc cls##_##name##_Hook = { #cls, #name, AF_##cls##_##name, &cls##_##name##_VMPtr, nullptr/* reinterpret_cast<void*>(native)*/ }; \
|
static const AFuncDesc cls##_##name##_Hook = { #cls, #name, AF_##cls##_##name, &cls##_##name##_VMPtr, reinterpret_cast<void*>(native) }; \
|
||||||
extern AFuncDesc const *const cls##_##name##_HookPtr; \
|
extern AFuncDesc const *const cls##_##name##_HookPtr; \
|
||||||
MSVC_ASEG AFuncDesc const *const cls##_##name##_HookPtr GCC_ASEG = &cls##_##name##_Hook; \
|
MSVC_ASEG AFuncDesc const *const cls##_##name##_HookPtr GCC_ASEG = &cls##_##name##_Hook; \
|
||||||
static int AF_##cls##_##name(VM_ARGS)
|
static int AF_##cls##_##name(VM_ARGS)
|
||||||
|
|
Loading…
Reference in a new issue