diff --git a/src/scripting/vm/vmframe.cpp b/src/scripting/vm/vmframe.cpp index 5f4e1f6a4..72046d0a2 100644 --- a/src/scripting/vm/vmframe.cpp +++ b/src/scripting/vm/vmframe.cpp @@ -225,7 +225,14 @@ 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 ;) - return func->NumRegA + func->NumRegD + func->NumRegF + func->NumRegS < 200; + + int maxregs = 200; + if (func->NumRegA + func->NumRegD + func->NumRegF + func->NumRegS < maxregs) + return true; + + Printf(TEXTCOLOR_ORANGE "%s is using too many registers (%d of max %d)! Function will not use native code.\n", func->PrintableName.GetChars(), func->NumRegA + func->NumRegD + func->NumRegF + func->NumRegS, maxregs); + + return false; } int VMScriptFunction::FirstScriptCall(VMFunction *func, VMValue *params, int numparams, VMReturn *ret, int numret)