diff --git a/src/scripting/vm/jit.cpp b/src/scripting/vm/jit.cpp index 032ff68d38..8836cf8fc2 100644 --- a/src/scripting/vm/jit.cpp +++ b/src/scripting/vm/jit.cpp @@ -150,10 +150,7 @@ bool JitCompiler::CanJit(VMScriptFunction *sfunc) { default: break; - case OP_LKS_R: case OP_LFP: - case OP_LCS_R: - case OP_SS_R: case OP_IJMP: case OP_TAIL: case OP_TAIL_K: diff --git a/src/scripting/vm/jit_load.cpp b/src/scripting/vm/jit_load.cpp index df91cf492f..59885019ad 100644 --- a/src/scripting/vm/jit_load.cpp +++ b/src/scripting/vm/jit_load.cpp @@ -48,7 +48,22 @@ void JitCompiler::EmitLKF_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(static_cast(CallAssignString))), + asmjit::FuncSignature2(asmjit::CallConv::kIdHostCDecl)); + call->setArg(0, regS[A]); + call->setArg(1, ptr); } void JitCompiler::EmitLKP_R() @@ -315,7 +330,19 @@ void JitCompiler::EmitLCS() 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(static_cast(loadLambda))), + asmjit::FuncSignature2(asmjit::CallConv::kIdHostCDecl)); + call->setArg(0, regS[A]); + call->setArg(1, ptr); } void JitCompiler::EmitLBIT()