- fixed OP_VTBL bug

This commit is contained in:
Magnus Norddahl 2018-09-15 00:28:34 +02:00
parent 266f838de7
commit 7e7bce4965
2 changed files with 2 additions and 4 deletions

View file

@ -155,7 +155,6 @@ bool JitCompiler::CanJit(VMScriptFunction *sfunc)
case OP_LCS_R:
case OP_SS_R:
case OP_IJMP:
case OP_CALL: // this one is implemented but crashes currently
case OP_TAIL:
case OP_TAIL_K:
return false;

View file

@ -36,15 +36,14 @@ void JitCompiler::EmitVTBL()
EmitThrowException(X_READ_NIL);
cc.bind(notnull);
auto result = cc.newInt32();
typedef VMFunction*(*FuncPtr)(DObject*, int);
auto call = cc.call(ToMemAddress(reinterpret_cast<const void*>(static_cast<FuncPtr>([](DObject *o, int c) -> VMFunction* {
auto p = o->GetClass();
assert(c < (int)p->Virtuals.Size());
return p->Virtuals[c];
}))), asmjit::FuncSignature2<void*, void*, int>());
call->setRet(0, result);
call->setArg(0, regA[A]);
call->setRet(0, regA[A]);
call->setArg(0, regA[B]);
call->setArg(1, asmjit::Imm(C));
}