- implement OP_LFP

This commit is contained in:
Magnus Norddahl 2018-09-16 03:39:54 +02:00 committed by drfrag
parent 7f996b5334
commit 097de74510
3 changed files with 13 additions and 10 deletions

View file

@ -150,7 +150,6 @@ bool JitCompiler::CanJit(VMScriptFunction *sfunc)
{ {
default: default:
break; break;
case OP_LFP:
case OP_IJMP: case OP_IJMP:
case OP_TAIL: case OP_TAIL:
case OP_TAIL_K: case OP_TAIL_K:
@ -237,15 +236,17 @@ void JitCompiler::Setup()
int offsetS = offsetF + (int)(sfunc->NumRegF * sizeof(double)); int offsetS = offsetF + (int)(sfunc->NumRegF * sizeof(double));
int offsetA = offsetS + (int)(sfunc->NumRegS * sizeof(FString)); int offsetA = offsetS + (int)(sfunc->NumRegS * sizeof(FString));
int offsetD = offsetA + (int)(sfunc->NumRegA * sizeof(void*)); int offsetD = offsetA + (int)(sfunc->NumRegA * sizeof(void*));
offsetExtra = (offsetD + (int)(sfunc->NumRegD * sizeof(int32_t)) + 15) & ~15;
auto vmregs = cc.newIntPtr(); vmframe = cc.newIntPtr();
cc.mov(vmregs, x86::ptr(stack)); // stack->Blocks cc.mov(vmframe, x86::ptr(stack)); // stack->Blocks
cc.mov(vmregs, x86::ptr(vmregs, VMFrameStack::OffsetLastFrame())); // Blocks->LastFrame cc.mov(vmframe, x86::ptr(vmframe, VMFrameStack::OffsetLastFrame())); // Blocks->LastFrame
cc.lea(params, x86::ptr(vmregs, offsetParams));
cc.lea(frameF, x86::ptr(vmregs, offsetF)); cc.lea(params, x86::ptr(vmframe, offsetParams));
cc.lea(frameS, x86::ptr(vmregs, offsetS)); cc.lea(frameF, x86::ptr(vmframe, offsetF));
cc.lea(frameA, x86::ptr(vmregs, offsetA)); cc.lea(frameS, x86::ptr(vmframe, offsetS));
cc.lea(frameD, x86::ptr(vmregs, offsetD)); cc.lea(frameA, x86::ptr(vmframe, offsetA));
cc.lea(frameD, x86::ptr(vmframe, offsetD));
for (int i = 0; i < sfunc->NumRegD; i++) for (int i = 0; i < sfunc->NumRegD; i++)
{ {

View file

@ -81,7 +81,7 @@ void JitCompiler::EmitLKP_R()
void JitCompiler::EmitLFP() void JitCompiler::EmitLFP()
{ {
I_FatalError("EmitLFP not implemented\n"); cc.lea(regA[A], asmjit::x86::ptr(vmframe, offsetExtra));
} }
void JitCompiler::EmitMETA() void JitCompiler::EmitMETA()

View file

@ -95,6 +95,8 @@ private:
asmjit::X86Gp numret; asmjit::X86Gp numret;
asmjit::X86Gp exceptInfo; asmjit::X86Gp exceptInfo;
int offsetExtra;
asmjit::X86Gp vmframe;
asmjit::X86Gp frameD; asmjit::X86Gp frameD;
asmjit::X86Gp frameF; asmjit::X86Gp frameF;
asmjit::X86Gp frameS; asmjit::X86Gp frameS;