- add warning text when falling back to the VM

This commit is contained in:
Magnus Norddahl 2018-11-17 00:36:40 +01:00
parent 6423902c63
commit 8ec85cb0ee
1 changed files with 8 additions and 1 deletions

View File

@ -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. // 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 ;) // 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) int VMScriptFunction::FirstScriptCall(VMFunction *func, VMValue *params, int numparams, VMReturn *ret, int numret)