mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 23:32:02 +00:00
- make functions using too many registers (more than 200) fall back to the VM
This commit is contained in:
parent
95ab1da6a0
commit
ea26bf6b2f
1 changed files with 8 additions and 1 deletions
|
@ -221,10 +221,17 @@ int VMScriptFunction::PCToLine(const VMOP *pc)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 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)
|
||||||
{
|
{
|
||||||
#ifdef ARCH_X64
|
#ifdef ARCH_X64
|
||||||
if (vm_jit)
|
if (vm_jit && CanJit(static_cast<VMScriptFunction*>(func)))
|
||||||
{
|
{
|
||||||
func->ScriptCall = JitCompile(static_cast<VMScriptFunction*>(func));
|
func->ScriptCall = JitCompile(static_cast<VMScriptFunction*>(func));
|
||||||
if (!func->ScriptCall)
|
if (!func->ScriptCall)
|
||||||
|
|
Loading…
Reference in a new issue