2018-09-13 00:29:04 +00:00
|
|
|
|
|
|
|
#include "jitintern.h"
|
|
|
|
|
|
|
|
void JitCompiler::EmitPARAM()
|
|
|
|
{
|
|
|
|
ParamOpcodes.Push(pc);
|
|
|
|
}
|
|
|
|
|
|
|
|
void JitCompiler::EmitPARAMI()
|
|
|
|
{
|
|
|
|
ParamOpcodes.Push(pc);
|
|
|
|
}
|
|
|
|
|
2018-09-13 00:56:02 +00:00
|
|
|
void JitCompiler::EmitRESULT()
|
|
|
|
{
|
|
|
|
// This instruction is just a placeholder to indicate where a return
|
|
|
|
// value should be stored. It does nothing on its own and should not
|
|
|
|
// be executed.
|
|
|
|
}
|
|
|
|
|
2018-11-18 11:38:55 +00:00
|
|
|
void JitCompiler::EmitVTBL()
|
|
|
|
{
|
|
|
|
// This instruction is handled in the CALL/CALL_K instruction following it
|
|
|
|
}
|
|
|
|
|
|
|
|
static VMFunction *GetVirtual(DObject *o, int c)
|
|
|
|
{
|
|
|
|
auto p = o->GetClass();
|
|
|
|
assert(c < (int)p->Virtuals.Size());
|
|
|
|
return p->Virtuals[c];
|
|
|
|
}
|
|
|
|
|
|
|
|
void JitCompiler::EmitVtbl(const VMOP *op)
|
|
|
|
{
|
|
|
|
int a = op->a;
|
|
|
|
int b = op->b;
|
|
|
|
int c = op->c;
|
|
|
|
|
|
|
|
auto label = EmitThrowExceptionLabel(X_READ_NIL);
|
|
|
|
cc.test(regA[b], regA[b]);
|
|
|
|
cc.jz(label);
|
|
|
|
|
|
|
|
auto result = newResultIntPtr();
|
|
|
|
auto call = CreateCall<VMFunction*, DObject*, int>(GetVirtual);
|
|
|
|
call->setRet(0, result);
|
|
|
|
call->setArg(0, regA[b]);
|
|
|
|
call->setArg(1, asmjit::Imm(c));
|
|
|
|
cc.mov(regA[a], result);
|
|
|
|
}
|
|
|
|
|
2018-09-13 00:29:04 +00:00
|
|
|
void JitCompiler::EmitCALL()
|
|
|
|
{
|
2018-10-10 21:47:56 +00:00
|
|
|
EmitDoCall(regA[A]);
|
2018-09-13 00:29:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void JitCompiler::EmitCALL_K()
|
|
|
|
{
|
2018-10-07 07:02:28 +00:00
|
|
|
auto ptr = newTempIntPtr();
|
2018-10-10 21:47:56 +00:00
|
|
|
cc.mov(ptr, asmjit::imm_ptr(konsta[A].o));
|
|
|
|
EmitDoCall(ptr);
|
2018-09-13 00:29:04 +00:00
|
|
|
}
|
|
|
|
|
2018-10-10 21:47:56 +00:00
|
|
|
void JitCompiler::EmitDoCall(asmjit::X86Gp vmfunc)
|
2018-09-13 00:29:04 +00:00
|
|
|
{
|
|
|
|
using namespace asmjit;
|
|
|
|
|
2018-11-18 11:38:55 +00:00
|
|
|
int numparams = StoreCallParams();
|
|
|
|
if (numparams != B)
|
2018-09-13 00:29:04 +00:00
|
|
|
I_FatalError("OP_CALL parameter count does not match the number of preceding OP_PARAM instructions");
|
|
|
|
|
2018-11-18 11:38:55 +00:00
|
|
|
if ((pc - 1)->op == OP_VTBL)
|
|
|
|
EmitVtbl(pc - 1);
|
|
|
|
|
2018-09-13 00:29:04 +00:00
|
|
|
FillReturns(pc + 1, C);
|
|
|
|
|
2018-10-12 05:41:16 +00:00
|
|
|
X86Gp paramsptr = newTempIntPtr();
|
2018-11-18 11:38:55 +00:00
|
|
|
cc.lea(paramsptr, x86::ptr(vmframe, offsetParams));
|
2018-09-13 00:29:04 +00:00
|
|
|
|
2018-10-10 21:47:56 +00:00
|
|
|
EmitScriptCall(vmfunc, paramsptr);
|
2018-09-13 00:29:04 +00:00
|
|
|
|
2018-11-18 11:38:55 +00:00
|
|
|
LoadInOuts();
|
2018-09-16 22:31:25 +00:00
|
|
|
LoadReturns(pc + 1, C);
|
2018-09-13 00:29:04 +00:00
|
|
|
|
2018-11-18 11:38:55 +00:00
|
|
|
ParamOpcodes.Clear();
|
2018-10-12 04:25:51 +00:00
|
|
|
|
|
|
|
pc += C; // Skip RESULTs
|
2018-09-13 00:29:04 +00:00
|
|
|
}
|
|
|
|
|
2018-10-10 20:08:26 +00:00
|
|
|
void JitCompiler::EmitScriptCall(asmjit::X86Gp vmfunc, asmjit::X86Gp paramsptr)
|
|
|
|
{
|
|
|
|
using namespace asmjit;
|
|
|
|
|
|
|
|
auto scriptcall = newTempIntPtr();
|
2018-11-18 10:48:50 +00:00
|
|
|
cc.mov(scriptcall, x86::ptr(vmfunc, myoffsetof(VMScriptFunction, ScriptCall)));
|
2018-10-10 20:08:26 +00:00
|
|
|
|
|
|
|
auto result = newResultInt32();
|
|
|
|
auto call = cc.call(scriptcall, FuncSignature5<int, VMFunction *, VMValue*, int, VMReturn*, int>());
|
|
|
|
call->setRet(0, result);
|
|
|
|
call->setArg(0, vmfunc);
|
|
|
|
call->setArg(1, paramsptr);
|
|
|
|
call->setArg(2, Imm(B));
|
|
|
|
call->setArg(3, callReturns);
|
|
|
|
call->setArg(4, Imm(C));
|
|
|
|
}
|
|
|
|
|
2018-11-18 11:38:55 +00:00
|
|
|
int JitCompiler::StoreCallParams()
|
2018-09-13 00:29:04 +00:00
|
|
|
{
|
|
|
|
using namespace asmjit;
|
|
|
|
|
2018-11-18 11:38:55 +00:00
|
|
|
X86Gp stackPtr = newTempIntPtr();
|
|
|
|
X86Gp tmp = newTempIntPtr();
|
|
|
|
X86Xmm tmp2 = newTempXmmSd();
|
|
|
|
|
|
|
|
int numparams = 0;
|
|
|
|
for (unsigned int i = 0; i < ParamOpcodes.Size(); i++)
|
2018-09-13 00:29:04 +00:00
|
|
|
{
|
2018-11-18 11:38:55 +00:00
|
|
|
int slot = numparams++;
|
|
|
|
|
|
|
|
if (ParamOpcodes[i]->op == OP_PARAMI)
|
|
|
|
{
|
|
|
|
int abcs = ParamOpcodes[i]->i24;
|
|
|
|
cc.mov(asmjit::x86::dword_ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, i)), abcs);
|
|
|
|
cc.mov(asmjit::x86::byte_ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, Type)), (int)REGT_INT);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
int bc = ParamOpcodes[i]->i16u;
|
|
|
|
|
2018-10-14 21:13:30 +00:00
|
|
|
switch (ParamOpcodes[i]->a)
|
2018-09-13 00:29:04 +00:00
|
|
|
{
|
2018-11-18 11:38:55 +00:00
|
|
|
case REGT_NIL:
|
|
|
|
cc.mov(x86::ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, a)), (int64_t)0);
|
|
|
|
cc.mov(x86::byte_ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, Type)), (int)REGT_NIL);
|
|
|
|
break;
|
|
|
|
case REGT_INT:
|
|
|
|
cc.mov(x86::dword_ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, i)), regD[bc]);
|
|
|
|
cc.mov(x86::byte_ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, Type)), (int)REGT_INT);
|
|
|
|
break;
|
2018-09-13 00:29:04 +00:00
|
|
|
case REGT_INT | REGT_ADDROF:
|
2018-10-14 21:13:30 +00:00
|
|
|
cc.lea(stackPtr, x86::ptr(vmframe, offsetD + (int)(bc * sizeof(int32_t))));
|
|
|
|
cc.mov(x86::dword_ptr(stackPtr), regD[bc]);
|
2018-11-18 11:38:55 +00:00
|
|
|
cc.mov(x86::ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, a)), stackPtr);
|
|
|
|
cc.mov(x86::byte_ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, Type)), (int)REGT_POINTER);
|
|
|
|
break;
|
|
|
|
case REGT_INT | REGT_KONST:
|
|
|
|
cc.mov(x86::dword_ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, i)), konstd[bc]);
|
|
|
|
cc.mov(x86::byte_ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, Type)), (int)REGT_INT);
|
|
|
|
break;
|
|
|
|
case REGT_STRING:
|
|
|
|
cc.mov(x86::ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, sp)), regS[bc]);
|
|
|
|
cc.mov(x86::byte_ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, Type)), (int)REGT_STRING);
|
2018-09-13 00:29:04 +00:00
|
|
|
break;
|
2018-09-14 21:38:57 +00:00
|
|
|
case REGT_STRING | REGT_ADDROF:
|
2018-11-18 11:38:55 +00:00
|
|
|
cc.mov(x86::ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, a)), regS[bc]);
|
|
|
|
cc.mov(x86::byte_ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, Type)), (int)REGT_POINTER);
|
|
|
|
break;
|
|
|
|
case REGT_STRING | REGT_KONST:
|
|
|
|
cc.mov(tmp, asmjit::imm_ptr(&konsts[bc]));
|
|
|
|
cc.mov(x86::ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, sp)), tmp);
|
|
|
|
cc.mov(x86::byte_ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, Type)), (int)REGT_STRING);
|
|
|
|
break;
|
|
|
|
case REGT_POINTER:
|
|
|
|
cc.mov(x86::ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, a)), regA[bc]);
|
|
|
|
cc.mov(x86::byte_ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, Type)), (int)REGT_POINTER);
|
2018-09-14 21:38:57 +00:00
|
|
|
break;
|
2018-09-13 00:29:04 +00:00
|
|
|
case REGT_POINTER | REGT_ADDROF:
|
2018-10-14 21:13:30 +00:00
|
|
|
cc.lea(stackPtr, x86::ptr(vmframe, offsetA + (int)(bc * sizeof(void*))));
|
|
|
|
cc.mov(x86::ptr(stackPtr), regA[bc]);
|
2018-11-18 11:38:55 +00:00
|
|
|
cc.mov(x86::ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, a)), stackPtr);
|
|
|
|
cc.mov(x86::byte_ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, Type)), (int)REGT_POINTER);
|
|
|
|
break;
|
|
|
|
case REGT_POINTER | REGT_KONST:
|
|
|
|
cc.mov(tmp, asmjit::imm_ptr(konsta[bc].v));
|
|
|
|
cc.mov(x86::ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, a)), tmp);
|
|
|
|
cc.mov(x86::byte_ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, Type)), (int)REGT_POINTER);
|
|
|
|
break;
|
|
|
|
case REGT_FLOAT:
|
|
|
|
cc.movsd(x86::qword_ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, f)), regF[bc]);
|
|
|
|
cc.mov(x86::byte_ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, Type)), (int)REGT_FLOAT);
|
|
|
|
break;
|
|
|
|
case REGT_FLOAT | REGT_MULTIREG2:
|
|
|
|
for (int j = 0; j < 2; j++)
|
|
|
|
{
|
|
|
|
cc.movsd(x86::qword_ptr(vmframe, offsetParams + (slot + j) * sizeof(VMValue) + myoffsetof(VMValue, f)), regF[bc + j]);
|
|
|
|
cc.mov(x86::byte_ptr(vmframe, offsetParams + (slot + j) * sizeof(VMValue) + myoffsetof(VMValue, Type)), (int)REGT_FLOAT);
|
|
|
|
}
|
|
|
|
numparams++;
|
|
|
|
break;
|
|
|
|
case REGT_FLOAT | REGT_MULTIREG3:
|
|
|
|
for (int j = 0; j < 3; j++)
|
|
|
|
{
|
|
|
|
cc.movsd(x86::qword_ptr(vmframe, offsetParams + (slot + j) * sizeof(VMValue) + myoffsetof(VMValue, f)), regF[bc + j]);
|
|
|
|
cc.mov(x86::byte_ptr(vmframe, offsetParams + (slot + j) * sizeof(VMValue) + myoffsetof(VMValue, Type)), (int)REGT_FLOAT);
|
|
|
|
}
|
|
|
|
numparams += 2;
|
2018-09-13 00:29:04 +00:00
|
|
|
break;
|
|
|
|
case REGT_FLOAT | REGT_ADDROF:
|
2018-10-14 21:13:30 +00:00
|
|
|
cc.lea(stackPtr, x86::ptr(vmframe, offsetF + (int)(bc * sizeof(double))));
|
2018-10-07 20:21:48 +00:00
|
|
|
// When passing the address to a float we don't know if the receiving function will treat it as float, vec2 or vec3.
|
2018-11-18 11:38:55 +00:00
|
|
|
for (int j = 0; j < 3; j++)
|
2018-10-07 20:21:48 +00:00
|
|
|
{
|
2018-11-18 11:38:55 +00:00
|
|
|
if ((unsigned int)(bc + j) < regF.Size())
|
|
|
|
cc.movsd(x86::qword_ptr(stackPtr, j * sizeof(double)), regF[bc + j]);
|
2018-10-07 20:21:48 +00:00
|
|
|
}
|
2018-11-18 11:38:55 +00:00
|
|
|
cc.mov(x86::ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, a)), stackPtr);
|
|
|
|
cc.mov(x86::byte_ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, Type)), (int)REGT_POINTER);
|
|
|
|
break;
|
|
|
|
case REGT_FLOAT | REGT_KONST:
|
|
|
|
cc.mov(tmp, asmjit::imm_ptr(konstf + bc));
|
|
|
|
cc.movsd(tmp2, asmjit::x86::qword_ptr(tmp));
|
|
|
|
cc.movsd(x86::qword_ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, f)), tmp2);
|
|
|
|
cc.mov(x86::byte_ptr(vmframe, offsetParams + slot * sizeof(VMValue) + myoffsetof(VMValue, Type)), (int)REGT_FLOAT);
|
2018-09-13 00:29:04 +00:00
|
|
|
break;
|
2018-11-18 11:38:55 +00:00
|
|
|
|
2018-09-13 00:29:04 +00:00
|
|
|
default:
|
2018-11-18 11:38:55 +00:00
|
|
|
I_FatalError("Unknown REGT value passed to EmitPARAM\n");
|
2018-09-13 00:29:04 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2018-11-18 11:38:55 +00:00
|
|
|
|
|
|
|
return numparams;
|
2018-09-13 00:29:04 +00:00
|
|
|
}
|
|
|
|
|
2018-11-18 11:38:55 +00:00
|
|
|
void JitCompiler::LoadInOuts()
|
2018-09-16 22:31:25 +00:00
|
|
|
{
|
2018-11-18 11:38:55 +00:00
|
|
|
for (unsigned int i = 0; i < ParamOpcodes.Size(); i++)
|
2018-09-16 22:31:25 +00:00
|
|
|
{
|
|
|
|
const VMOP ¶m = *ParamOpcodes[i];
|
2018-10-14 21:13:30 +00:00
|
|
|
if (param.op == OP_PARAM && (param.a & REGT_ADDROF))
|
2018-09-16 22:31:25 +00:00
|
|
|
{
|
2018-10-14 21:13:30 +00:00
|
|
|
LoadCallResult(param.a, param.i16u, true);
|
2018-09-16 22:31:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void JitCompiler::LoadReturns(const VMOP *retval, int numret)
|
2018-09-13 00:29:04 +00:00
|
|
|
{
|
|
|
|
for (int i = 0; i < numret; ++i)
|
|
|
|
{
|
2018-09-16 22:31:25 +00:00
|
|
|
if (retval[i].op != OP_RESULT)
|
2018-09-13 00:29:04 +00:00
|
|
|
I_FatalError("Expected OP_RESULT to follow OP_CALL\n");
|
|
|
|
|
2018-10-14 21:13:30 +00:00
|
|
|
LoadCallResult(retval[i].b, retval[i].c, false);
|
2018-09-16 22:31:25 +00:00
|
|
|
}
|
|
|
|
}
|
2018-09-13 00:29:04 +00:00
|
|
|
|
2018-10-14 21:13:30 +00:00
|
|
|
void JitCompiler::LoadCallResult(int type, int regnum, bool addrof)
|
2018-09-16 22:31:25 +00:00
|
|
|
{
|
|
|
|
switch (type & REGT_TYPE)
|
|
|
|
{
|
|
|
|
case REGT_INT:
|
2018-10-12 05:41:16 +00:00
|
|
|
cc.mov(regD[regnum], asmjit::x86::dword_ptr(vmframe, offsetD + regnum * sizeof(int32_t)));
|
2018-09-16 22:31:25 +00:00
|
|
|
break;
|
|
|
|
case REGT_FLOAT:
|
2018-10-12 05:41:16 +00:00
|
|
|
cc.movsd(regF[regnum], asmjit::x86::qword_ptr(vmframe, offsetF + regnum * sizeof(double)));
|
2018-10-07 20:21:48 +00:00
|
|
|
if (addrof)
|
|
|
|
{
|
|
|
|
// When passing the address to a float we don't know if the receiving function will treat it as float, vec2 or vec3.
|
|
|
|
if ((unsigned int)regnum + 1 < regF.Size())
|
2018-10-12 05:41:16 +00:00
|
|
|
cc.movsd(regF[regnum + 1], asmjit::x86::qword_ptr(vmframe, offsetF + (regnum + 1) * sizeof(double)));
|
2018-10-07 20:21:48 +00:00
|
|
|
if ((unsigned int)regnum + 2 < regF.Size())
|
2018-10-12 05:41:16 +00:00
|
|
|
cc.movsd(regF[regnum + 2], asmjit::x86::qword_ptr(vmframe, offsetF + (regnum + 2) * sizeof(double)));
|
2018-10-07 20:21:48 +00:00
|
|
|
}
|
|
|
|
else if (type & REGT_MULTIREG2)
|
|
|
|
{
|
2018-10-12 05:41:16 +00:00
|
|
|
cc.movsd(regF[regnum + 1], asmjit::x86::qword_ptr(vmframe, offsetF + (regnum + 1) * sizeof(double)));
|
2018-10-07 20:21:48 +00:00
|
|
|
}
|
|
|
|
else if (type & REGT_MULTIREG3)
|
|
|
|
{
|
2018-10-12 05:41:16 +00:00
|
|
|
cc.movsd(regF[regnum + 1], asmjit::x86::qword_ptr(vmframe, offsetF + (regnum + 1) * sizeof(double)));
|
|
|
|
cc.movsd(regF[regnum + 2], asmjit::x86::qword_ptr(vmframe, offsetF + (regnum + 2) * sizeof(double)));
|
2018-10-07 20:21:48 +00:00
|
|
|
}
|
2018-09-16 22:31:25 +00:00
|
|
|
break;
|
|
|
|
case REGT_STRING:
|
|
|
|
// We don't have to do anything in this case. String values are never moved to virtual registers.
|
|
|
|
break;
|
|
|
|
case REGT_POINTER:
|
2018-10-12 05:41:16 +00:00
|
|
|
cc.mov(regA[regnum], asmjit::x86::ptr(vmframe, offsetA + regnum * sizeof(void*)));
|
2018-09-16 22:31:25 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
I_FatalError("Unknown OP_RESULT/OP_PARAM type encountered in LoadCallResult\n");
|
|
|
|
break;
|
2018-09-13 00:29:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void JitCompiler::FillReturns(const VMOP *retval, int numret)
|
|
|
|
{
|
|
|
|
using namespace asmjit;
|
|
|
|
|
|
|
|
for (int i = 0; i < numret; ++i)
|
|
|
|
{
|
|
|
|
if (retval[i].op != OP_RESULT)
|
|
|
|
{
|
|
|
|
I_FatalError("Expected OP_RESULT to follow OP_CALL\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
int type = retval[i].b;
|
|
|
|
int regnum = retval[i].c;
|
|
|
|
|
|
|
|
if (type & REGT_KONST)
|
|
|
|
{
|
|
|
|
I_FatalError("OP_RESULT with REGT_KONST is not allowed\n");
|
|
|
|
}
|
|
|
|
|
2018-10-07 07:02:28 +00:00
|
|
|
auto regPtr = newTempIntPtr();
|
2018-09-13 00:29:04 +00:00
|
|
|
|
|
|
|
switch (type & REGT_TYPE)
|
|
|
|
{
|
|
|
|
case REGT_INT:
|
2018-10-12 05:41:16 +00:00
|
|
|
cc.lea(regPtr, x86::ptr(vmframe, offsetD + (int)(regnum * sizeof(int32_t))));
|
2018-09-13 00:29:04 +00:00
|
|
|
break;
|
|
|
|
case REGT_FLOAT:
|
2018-10-12 05:41:16 +00:00
|
|
|
cc.lea(regPtr, x86::ptr(vmframe, offsetF + (int)(regnum * sizeof(double))));
|
2018-09-13 00:29:04 +00:00
|
|
|
break;
|
2018-09-14 17:20:31 +00:00
|
|
|
case REGT_STRING:
|
2018-10-12 05:41:16 +00:00
|
|
|
cc.lea(regPtr, x86::ptr(vmframe, offsetS + (int)(regnum * sizeof(FString))));
|
2018-09-14 17:20:31 +00:00
|
|
|
break;
|
2018-09-13 00:29:04 +00:00
|
|
|
case REGT_POINTER:
|
2018-10-12 05:41:16 +00:00
|
|
|
cc.lea(regPtr, x86::ptr(vmframe, offsetA + (int)(regnum * sizeof(void*))));
|
2018-09-13 00:29:04 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
I_FatalError("Unknown OP_RESULT type encountered in FillReturns\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2018-11-18 11:38:55 +00:00
|
|
|
cc.mov(x86::ptr(callReturns, i * sizeof(VMReturn) + myoffsetof(VMReturn, Location)), regPtr);
|
|
|
|
cc.mov(x86::byte_ptr(callReturns, i * sizeof(VMReturn) + myoffsetof(VMReturn, RegType)), type);
|
2018-09-13 00:29:04 +00:00
|
|
|
}
|
|
|
|
}
|