v0.3.2+luau530
This commit is contained in:
parent
0e85e22ba0
commit
6ec2136cce
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "luau0-src"
|
||||
version = "0.3.1+luau529"
|
||||
version = "0.3.2+luau530"
|
||||
authors = ["Aleksandr Orlenko <zxteam@protonmail.com>"]
|
||||
edition = "2021"
|
||||
repository = "https://github.com/khvzak/luau-src-rs"
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
LUAU_FASTFLAG(LuauGcWorkTrackFix)
|
||||
|
||||
const char* lua_ident = "$Lua: Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio $\n"
|
||||
"$Authors: R. Ierusalimschy, L. H. de Figueiredo & W. Celes $\n"
|
||||
"$URL: www.lua.org $\n";
|
||||
|
@ -488,11 +486,11 @@ void* lua_touserdata(lua_State* L, int idx)
|
|||
{
|
||||
StkId o = index2addr(L, idx);
|
||||
if (ttisuserdata(o))
|
||||
return uvalue(o)->data;
|
||||
return uvalue(o)->data;
|
||||
else if (ttislightuserdata(o))
|
||||
return pvalue(o);
|
||||
return pvalue(o);
|
||||
else
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* lua_touserdatatagged(lua_State* L, int idx, int tag)
|
||||
|
@ -1054,7 +1052,6 @@ int lua_gc(lua_State* L, int what, int data)
|
|||
}
|
||||
case LUA_GCSTEP:
|
||||
{
|
||||
size_t prevthreshold = g->GCthreshold;
|
||||
size_t amount = (cast_to(size_t, data) << 10);
|
||||
ptrdiff_t oldcredit = g->gcstate == GCSpause ? 0 : g->GCthreshold - g->totalbytes;
|
||||
|
||||
|
@ -1064,8 +1061,6 @@ int lua_gc(lua_State* L, int what, int data)
|
|||
else
|
||||
g->GCthreshold = 0;
|
||||
|
||||
bool waspaused = g->gcstate == GCSpause;
|
||||
|
||||
#ifdef LUAI_GCMETRICS
|
||||
double startmarktime = g->gcmetrics.currcycle.marktime;
|
||||
double startsweeptime = g->gcmetrics.currcycle.sweeptime;
|
||||
|
@ -1078,7 +1073,7 @@ int lua_gc(lua_State* L, int what, int data)
|
|||
{
|
||||
size_t stepsize = luaC_step(L, false);
|
||||
|
||||
actualwork += FFlag::LuauGcWorkTrackFix ? stepsize : g->gcstepsize;
|
||||
actualwork += stepsize;
|
||||
|
||||
if (g->gcstate == GCSpause)
|
||||
{ /* end of cycle? */
|
||||
|
@ -1114,20 +1109,9 @@ int lua_gc(lua_State* L, int what, int data)
|
|||
// if cycle hasn't finished, advance threshold forward for the amount of extra work performed
|
||||
if (g->gcstate != GCSpause)
|
||||
{
|
||||
if (FFlag::LuauGcWorkTrackFix)
|
||||
{
|
||||
// if a new cycle was triggered by explicit step, old 'credit' of GC work is 0
|
||||
ptrdiff_t newthreshold = g->totalbytes + actualwork + oldcredit;
|
||||
g->GCthreshold = newthreshold < 0 ? 0 : newthreshold;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if a new cycle was triggered by explicit step, we ignore old threshold as that shows an incorrect 'credit' of GC work
|
||||
if (waspaused)
|
||||
g->GCthreshold = g->totalbytes + actualwork;
|
||||
else
|
||||
g->GCthreshold = prevthreshold + actualwork;
|
||||
}
|
||||
// if a new cycle was triggered by explicit step, old 'credit' of GC work is 0
|
||||
ptrdiff_t newthreshold = g->totalbytes + actualwork + oldcredit;
|
||||
g->GCthreshold = newthreshold < 0 ? 0 : newthreshold;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -213,7 +213,7 @@ CallInfo* luaD_growCI(lua_State* L)
|
|||
return ++L->ci;
|
||||
}
|
||||
|
||||
void luaD_checkCstack(lua_State *L)
|
||||
void luaD_checkCstack(lua_State* L)
|
||||
{
|
||||
if (L->nCcalls == LUAI_MAXCCALLS)
|
||||
luaG_runerror(L, "C stack overflow");
|
||||
|
|
|
@ -13,10 +13,7 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
LUAU_FASTFLAGVARIABLE(LuauGcWorkTrackFix, false)
|
||||
LUAU_FASTFLAGVARIABLE(LuauGcSweepCostFix, false)
|
||||
|
||||
#define GC_SWEEPPAGESTEPCOST (FFlag::LuauGcSweepCostFix ? 16 : 4)
|
||||
#define GC_SWEEPPAGESTEPCOST 16
|
||||
|
||||
#define GC_INTERRUPT(state) \
|
||||
{ \
|
||||
|
@ -881,7 +878,7 @@ size_t luaC_step(lua_State* L, bool assist)
|
|||
{
|
||||
global_State* g = L->global;
|
||||
|
||||
int lim = FFlag::LuauGcWorkTrackFix ? g->gcstepsize * g->gcstepmul / 100 : (g->gcstepsize / 100) * g->gcstepmul; /* how much to work */
|
||||
int lim = g->gcstepsize * g->gcstepmul / 100; /* how much to work */
|
||||
LUAU_ASSERT(g->totalbytes >= g->GCthreshold);
|
||||
size_t debt = g->totalbytes - g->GCthreshold;
|
||||
|
||||
|
@ -927,10 +924,10 @@ size_t luaC_step(lua_State* L, bool assist)
|
|||
}
|
||||
else
|
||||
{
|
||||
g->GCthreshold = g->totalbytes + (FFlag::LuauGcWorkTrackFix ? actualstepsize : g->gcstepsize);
|
||||
g->GCthreshold = g->totalbytes + actualstepsize;
|
||||
|
||||
// compensate if GC is "behind schedule" (has some debt to pay)
|
||||
if (FFlag::LuauGcWorkTrackFix ? g->GCthreshold >= debt : g->GCthreshold > debt)
|
||||
if (g->GCthreshold >= debt)
|
||||
g->GCthreshold -= debt;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue