mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Add gc callback
This commit is contained in:
parent
f1649a43cd
commit
7aedc43cc9
2 changed files with 4 additions and 0 deletions
|
@ -358,6 +358,8 @@ struct lua_Callbacks
|
||||||
void (*debugstep)(lua_State* L, lua_Debug* ar); /* gets called after each instruction in single step mode */
|
void (*debugstep)(lua_State* L, lua_Debug* ar); /* gets called after each instruction in single step mode */
|
||||||
void (*debuginterrupt)(lua_State* L, lua_Debug* ar); /* gets called when thread execution is interrupted by break in another thread */
|
void (*debuginterrupt)(lua_State* L, lua_Debug* ar); /* gets called when thread execution is interrupted by break in another thread */
|
||||||
void (*debugprotectederror)(lua_State* L); /* gets called when protected call results in an error */
|
void (*debugprotectederror)(lua_State* L); /* gets called when protected call results in an error */
|
||||||
|
|
||||||
|
void (*gc)(lua_State* L); /* gets called when a garbage collection cycle starts */
|
||||||
};
|
};
|
||||||
|
|
||||||
LUA_API lua_Callbacks* lua_callbacks(lua_State* L);
|
LUA_API lua_Callbacks* lua_callbacks(lua_State* L);
|
||||||
|
|
|
@ -617,6 +617,8 @@ static void markroot(lua_State* L)
|
||||||
markvalue(g, registry(L));
|
markvalue(g, registry(L));
|
||||||
markmt(g);
|
markmt(g);
|
||||||
g->gcstate = GCSpropagate;
|
g->gcstate = GCSpropagate;
|
||||||
|
if (g->cb.gc)
|
||||||
|
g->cb.gc(L);
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t remarkupvals(global_State* g)
|
static size_t remarkupvals(global_State* g)
|
||||||
|
|
Loading…
Add table
Reference in a new issue