- implement string part of OP_CASTB

This commit is contained in:
Magnus Norddahl 2018-09-16 22:39:48 +02:00
parent c8e4bf089c
commit 102c00ce13
2 changed files with 7 additions and 6 deletions

View file

@ -172,11 +172,6 @@ bool JitCompiler::CanJit(VMScriptFunction *sfunc)
return false; return false;
} }
} }
else if (sfunc->Code[i].op == OP_CASTB)
{
if (C == CASTB_S)
return false;
}
else if (sfunc->Code[i].op == OP_PARAM) else if (sfunc->Code[i].op == OP_PARAM)
{ {
if (!!(B & REGT_MULTIREG3) || !!(B & REGT_MULTIREG2)) if (!!(B & REGT_MULTIREG3) || !!(B & REGT_MULTIREG2))

View file

@ -147,7 +147,13 @@ void JitCompiler::EmitCASTB()
} }
else else
{ {
//reg.d[A] = reg.s[B].Len() > 0; using namespace asmjit;
typedef int(*FuncPtr)(FString*);
auto call = cc.call(ToMemAddress(reinterpret_cast<const void*>(static_cast<FuncPtr>([](FString *s) -> int {
return s->Len() > 0;
}))), FuncSignature1<int, void*>());
call->setRet(0, regD[A]);
call->setArg(0, regS[B]);
} }
} }