aboutsummaryrefslogtreecommitdiff
path: root/src/lj_func.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_func.c')
-rw-r--r--src/lj_func.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lj_func.c b/src/lj_func.c
index 334ba4c8..97be0a2a 100644
--- a/src/lj_func.c
+++ b/src/lj_func.c
@@ -118,6 +118,7 @@ GCfunc *lj_func_newC(lua_State *L, MSize nelems, GCtab *env)
118 118
119static GCfunc *func_newL(lua_State *L, GCproto *pt, GCtab *env) 119static GCfunc *func_newL(lua_State *L, GCproto *pt, GCtab *env)
120{ 120{
121 uint32_t count;
121 GCfunc *fn = (GCfunc *)lj_mem_newgco(L, sizeLfunc((MSize)pt->sizeuv)); 122 GCfunc *fn = (GCfunc *)lj_mem_newgco(L, sizeLfunc((MSize)pt->sizeuv));
122 fn->l.gct = ~LJ_TFUNC; 123 fn->l.gct = ~LJ_TFUNC;
123 fn->l.ffid = FF_LUA; 124 fn->l.ffid = FF_LUA;
@@ -125,6 +126,9 @@ static GCfunc *func_newL(lua_State *L, GCproto *pt, GCtab *env)
125 /* NOBARRIER: Really a setgcref. But the GCfunc is new (marked white). */ 126 /* NOBARRIER: Really a setgcref. But the GCfunc is new (marked white). */
126 setmref(fn->l.pc, proto_bc(pt)); 127 setmref(fn->l.pc, proto_bc(pt));
127 setgcref(fn->l.env, obj2gco(env)); 128 setgcref(fn->l.env, obj2gco(env));
129 /* Saturating 3 bit counter (0..7) for created closures. */
130 count = (uint32_t)pt->flags + PROTO_CLCOUNT;
131 pt->flags = (uint8_t)(count - ((count >> PROTO_CLC_BITS) & PROTO_CLCOUNT));
128 return fn; 132 return fn;
129} 133}
130 134