Call lua_checkstack to reserve stack slots
@@ -325,7 +325,11 @@ end
-- big the stack needs to be.
local function gc_reserve_stack(ctx)
local n = ctx.max_stack_slots
- return string.format("/* TODO: reserve stack (%d) */", n)
+ return util.render([[
+ lua_checkstack(L, ${N});
+ ]], {
+ N = c_integer(n),
+ })
end
-- Push potentially live variables to the Lua stack, so the Lua GC can see they
