2
0
Эх сурвалжийг харах

Fix recording of getmetatable() for non-tables.

Mike Pall 15 жил өмнө
parent
commit
f49649d005
1 өөрчлөгдсөн 5 нэмэгдсэн , 3 устгасан
  1. 5 3
      src/lj_record.c

+ 5 - 3
src/lj_record.c

@@ -660,9 +660,11 @@ static int rec_mm_lookup(jit_State *J, RecordIndex *ix, MMS mm)
   } else {
     /* Specialize to base metatable. Must flush mcode in lua_setmetatable(). */
     mt = tabref(basemt_obj(J2G(J), &ix->tabv));
-    if (mt == NULL)
+    if (mt == NULL) {
+      ix->mt = TREF_NIL;
       return 0;  /* No metamethod. */
-    mix.tab = lj_ir_ktab(J, mt);
+    }
+    ix->mt = mix.tab = lj_ir_ktab(J, mt);
     goto nocheck;
   }
   ix->mt = mt ? mix.tab : TREF_NIL;
@@ -1160,7 +1162,7 @@ static void LJ_FASTCALL recff_type(jit_State *J, RecordFFData *rd)
 static void LJ_FASTCALL recff_getmetatable(jit_State *J, RecordFFData *rd)
 {
   TRef tr = J->base[0];
-  if (tref_istab(tr)) {
+  if (tr) {
     RecordIndex ix;
     ix.tab = tr;
     copyTV(J->L, &ix.tabv, &rd->argv[0]);