diff --git a/src/common/scripting/backend/codegen.cpp b/src/common/scripting/backend/codegen.cpp index 0504fc1600..28f27f8505 100644 --- a/src/common/scripting/backend/codegen.cpp +++ b/src/common/scripting/backend/codegen.cpp @@ -9542,6 +9542,8 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx) auto &argflags = Function->Variants[0].ArgFlags; auto *defaults = FnPtrCall ? nullptr : &Function->Variants[0].Implementation->DefaultArgs; + if(FnPtrCall) static_cast(ctx.Function->Variants[0].Implementation)->blockJit = true; + int implicit = Function->GetImplicitArgs(); if (!CheckAccessibility(ctx.Version)) diff --git a/src/common/scripting/vm/vmframe.cpp b/src/common/scripting/vm/vmframe.cpp index 635bace633..f69b8ea616 100644 --- a/src/common/scripting/vm/vmframe.cpp +++ b/src/common/scripting/vm/vmframe.cpp @@ -279,6 +279,8 @@ static bool CanJit(VMScriptFunction *func) // Asmjit has a 256 register limit. Stay safely away from it as the jit compiler uses a few for temporaries as well. // Any function exceeding the limit will use the VM - a fair punishment to someone for writing a function so bloated ;) + if(func->blockJit) return false; + int maxregs = 200; if (func->NumRegA + func->NumRegD + func->NumRegF + func->NumRegS < maxregs) return true; diff --git a/src/common/scripting/vm/vmintern.h b/src/common/scripting/vm/vmintern.h index 44fb534630..b35eefc1e3 100644 --- a/src/common/scripting/vm/vmintern.h +++ b/src/common/scripting/vm/vmintern.h @@ -474,6 +474,8 @@ public: VM_UBYTE NumArgs; // Number of arguments this function takes TArray SpecialInits; // list of all contents on the extra stack which require construction and destruction + bool blockJit = false; // function triggers Jit bugs, block compilation until bugs are fixed + void InitExtra(void *addr); void DestroyExtra(void *addr); int AllocExtraStack(PType *type);