Skip to content

Commit

Permalink
Can't narrow down the JIT bug yet, so block JIT for functions that ca…
Browse files Browse the repository at this point in the history
…ll Function Pointers temporarily
  • Loading branch information
RicardoLuis0 committed Mar 22, 2024
1 parent 071b5c5 commit 682dd1b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/common/scripting/backend/codegen.cpp
Expand Up @@ -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<VMScriptFunction*>(ctx.Function->Variants[0].Implementation)->blockJit = true;

int implicit = Function->GetImplicitArgs();

if (!CheckAccessibility(ctx.Version))
Expand Down
2 changes: 2 additions & 0 deletions src/common/scripting/vm/vmframe.cpp
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/common/scripting/vm/vmintern.h
Expand Up @@ -474,6 +474,8 @@ class VMScriptFunction : public VMFunction
VM_UBYTE NumArgs; // Number of arguments this function takes
TArray<FTypeAndOffset> 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);
Expand Down

0 comments on commit 682dd1b

Please sign in to comment.