]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Initialize uv->immutable for upvalues of loaded chunks.
authorMike Pall <mike>
Mon, 19 Sep 2016 19:17:58 +0000 (21:17 +0200)
committerMike Pall <mike>
Mon, 19 Sep 2016 19:17:58 +0000 (21:17 +0200)
Thanks to Peter Cawley.

src/lj_func.c

index 431a56d76df4dac43b727e07916fd6088ad71afb..3f6626b375033b08af88ec7d7fb3db8123790e5a 100644 (file)
@@ -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;