diff --git a/src/scripting/vm/jit_call.cpp b/src/scripting/vm/jit_call.cpp index 48ba37dc6..77d33c2ac 100644 --- a/src/scripting/vm/jit_call.cpp +++ b/src/scripting/vm/jit_call.cpp @@ -24,13 +24,6 @@ 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; @@ -41,12 +34,9 @@ void JitCompiler::EmitVtbl(const VMOP *op) cc.test(regA[b], regA[b]); cc.jz(label); - auto result = newResultIntPtr(); - auto call = CreateCall(GetVirtual); - call->setRet(0, result); - call->setArg(0, regA[b]); - call->setArg(1, asmjit::Imm(c)); - cc.mov(regA[a], result); + cc.mov(regA[a], asmjit::x86::qword_ptr(regA[b], myoffsetof(DObject, Class))); + cc.mov(regA[a], asmjit::x86::qword_ptr(regA[a], myoffsetof(PClass, Virtuals) + myoffsetof(FArray, Array))); + cc.mov(regA[a], asmjit::x86::qword_ptr(regA[a], c * (int)sizeof(void*))); } void JitCompiler::EmitCALL() diff --git a/src/scripting/vm/jit_load.cpp b/src/scripting/vm/jit_load.cpp index a17ca196c..0881cfd21 100644 --- a/src/scripting/vm/jit_load.cpp +++ b/src/scripting/vm/jit_load.cpp @@ -77,8 +77,6 @@ void JitCompiler::EmitLFP() cc.lea(regA[A], asmjit::x86::ptr(vmframe, offsetExtra)); } -#if 1 // Inline implementation - void JitCompiler::EmitMETA() { auto label = EmitThrowExceptionLabel(X_READ_NIL); @@ -97,46 +95,6 @@ void JitCompiler::EmitCLSS() cc.mov(regA[A], asmjit::x86::qword_ptr(regA[B], myoffsetof(DObject, Class))); } -#else - -static uint8_t *GetClassMeta(DObject *o) -{ - return o->GetClass()->Meta; -} - -void JitCompiler::EmitMETA() -{ - auto label = EmitThrowExceptionLabel(X_READ_NIL); - cc.test(regA[B], regA[B]); - cc.je(label); - - auto result = newResultIntPtr(); - auto call = CreateCall(GetClassMeta); - call->setRet(0, result); - call->setArg(0, regA[B]); - cc.mov(regA[A], result); -} - -static PClass *GetClass(DObject *o) -{ - return o->GetClass(); -} - -void JitCompiler::EmitCLSS() -{ - auto label = EmitThrowExceptionLabel(X_READ_NIL); - cc.test(regA[B], regA[B]); - cc.je(label); - - auto result = newResultIntPtr(); - auto call = CreateCall(GetClass); - call->setRet(0, result); - call->setArg(0, regA[B]); - cc.mov(regA[A], result); -} - -#endif - ///////////////////////////////////////////////////////////////////////////// // Load from memory. rA = *(rB + rkC)