Skip to content

Commit

Permalink
Minor tweak to FASTCALL3 instruction
Browse files Browse the repository at this point in the history
In all other places, L->top is extracted to a local when writing to stack;
this helps compilers without TBAA (MSVC) to not reload L->top redundantly.

Also assert that we do in fact have 2 slots of stack space (which we do).
  • Loading branch information
zeux committed Nov 27, 2024
1 parent d19a5f0 commit 38e9317
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions VM/src/lvmexecute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2923,10 +2923,13 @@ static void luau_execute(lua_State* L)
{
VM_PROTECT_PC(); // f may fail due to OOM

setobj2s(L, L->top, arg2);
setobj2s(L, L->top + 1, arg3);
// note: it's safe to push arguments past top for complicated reasons (see top of the file)
LUAU_ASSERT(L->top + 2 < L->stack + L->stacksize);
StkId top = L->top;
setobj2s(L, top, arg2);
setobj2s(L, top + 1, arg3);

int n = f(L, ra, arg1, nresults, L->top, nparams);
int n = f(L, ra, arg1, nresults, top, nparams);

if (n >= 0)
{
Expand Down

0 comments on commit 38e9317

Please sign in to comment.