mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
Merge pull request #575 from Gutawer/asmjit
Implemented SS_R, LCS_R, and LKS_R
This commit is contained in:
commit
c505e4eb79
2 changed files with 29 additions and 5 deletions
|
@ -150,10 +150,7 @@ bool JitCompiler::CanJit(VMScriptFunction *sfunc)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
case OP_LKS_R:
|
|
||||||
case OP_LFP:
|
case OP_LFP:
|
||||||
case OP_LCS_R:
|
|
||||||
case OP_SS_R:
|
|
||||||
case OP_IJMP:
|
case OP_IJMP:
|
||||||
case OP_TAIL:
|
case OP_TAIL:
|
||||||
case OP_TAIL_K:
|
case OP_TAIL_K:
|
||||||
|
|
|
@ -48,7 +48,22 @@ void JitCompiler::EmitLKF_R()
|
||||||
|
|
||||||
void JitCompiler::EmitLKS_R()
|
void JitCompiler::EmitLKS_R()
|
||||||
{
|
{
|
||||||
I_FatalError("EmitLKS_R not implemented\n");
|
auto ptr = cc.newIntPtr();
|
||||||
|
cc.mov(ptr, ToMemAddress(konsts));
|
||||||
|
auto offset = cc.newIntPtr();
|
||||||
|
cc.mov(offset, regD[B]);
|
||||||
|
#ifdef ASMJIT_ARCH_X64
|
||||||
|
static_assert(sizeof(FString) == 8, "sizeof(FString) needs to be 8");
|
||||||
|
cc.shl(offset, 3);
|
||||||
|
#else
|
||||||
|
static_assert(sizeof(FString) == 4, "sizeof(FString) needs to be 4");
|
||||||
|
cc.shl(offset, 2);
|
||||||
|
#endif
|
||||||
|
cc.add(ptr, offset);
|
||||||
|
auto call = cc.call(ToMemAddress(reinterpret_cast<void*>(static_cast<void(*)(FString*, FString*)>(CallAssignString))),
|
||||||
|
asmjit::FuncSignature2<void, FString*, FString*>(asmjit::CallConv::kIdHostCDecl));
|
||||||
|
call->setArg(0, regS[A]);
|
||||||
|
call->setArg(1, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JitCompiler::EmitLKP_R()
|
void JitCompiler::EmitLKP_R()
|
||||||
|
@ -315,7 +330,19 @@ void JitCompiler::EmitLCS()
|
||||||
|
|
||||||
void JitCompiler::EmitLCS_R()
|
void JitCompiler::EmitLCS_R()
|
||||||
{
|
{
|
||||||
I_FatalError("EmitLCS_R not implemented\n");
|
EmitNullPointerThrow(B, X_READ_NIL);
|
||||||
|
auto ptr = cc.newIntPtr();
|
||||||
|
cc.mov(ptr, regA[B]);
|
||||||
|
auto tmp = cc.newIntPtr();
|
||||||
|
cc.mov(tmp, regD[C]);
|
||||||
|
cc.add(ptr, tmp);
|
||||||
|
auto loadLambda = [](FString* to, char** from) -> void {
|
||||||
|
*to = *from;
|
||||||
|
};
|
||||||
|
auto call = cc.call(ToMemAddress(reinterpret_cast<void*>(static_cast<void(*)(FString*, char**)>(loadLambda))),
|
||||||
|
asmjit::FuncSignature2<void, FString*, char**>(asmjit::CallConv::kIdHostCDecl));
|
||||||
|
call->setArg(0, regS[A]);
|
||||||
|
call->setArg(1, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JitCompiler::EmitLBIT()
|
void JitCompiler::EmitLBIT()
|
||||||
|
|
Loading…
Reference in a new issue