From f49649d0055556ecf74d2b58bb4b819ed0ab900d Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Tue, 9 Mar 2010 17:49:13 +0100 Subject: [PATCH] Fix recording of getmetatable() for non-tables. --- src/lj_record.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lj_record.c b/src/lj_record.c index d8cd8962..fa4180b9 100644 --- a/src/lj_record.c +++ b/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]);