Skip to content

Commit

Permalink
Initialize uv->immutable for upvalues of loaded chunks.
Browse files Browse the repository at this point in the history
Thanks to Peter Cawley.
  • Loading branch information
Mike Pall committed Sep 19, 2016
1 parent 02b9b55 commit 9910ded
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lj_func.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ GCfunc *lj_func_newL_empty(lua_State *L, GCproto *pt, GCtab *env)
/* NOBARRIER: The GCfunc is new (marked white). */
for (i = 0; i < nuv; i++) {
GCupval *uv = func_emptyuv(L);
uv->dhash = (uint32_t)(uintptr_t)pt ^ ((uint32_t)proto_uv(pt)[i] << 24);
int32_t v = proto_uv(pt)[i];
uv->immutable = ((v / PROTO_UV_IMMUTABLE) & 1);
uv->dhash = (uint32_t)(uintptr_t)pt ^ (v << 24);
setgcref(fn->l.uvptr[i], obj2gco(uv));
}
fn->l.nupvalues = (uint8_t)nuv;
Expand Down

0 comments on commit 9910ded

Please sign in to comment.