summaryrefslogtreecommitdiff
path: root/src/lj_record.c
diff options
context:
space:
mode:
authorMike Pall <mike>2010-03-28 03:34:18 +0200
committerMike Pall <mike>2010-03-28 03:34:18 +0200
commit69df01efb20fb7bd91f9a857c78da8d49a01e309 (patch)
tree173e5aa086b6fbf333bfd17b47da627915e9e5a8 /src/lj_record.c
parent6038866f7d4ff4df1a727df9550babb601806660 (diff)
downloadluajit-69df01efb20fb7bd91f9a857c78da8d49a01e309.tar.gz
luajit-69df01efb20fb7bd91f9a857c78da8d49a01e309.tar.bz2
luajit-69df01efb20fb7bd91f9a857c78da8d49a01e309.zip
Fix precondition check for NEWREF.
A check for nil value is not enough. Must check for ptr == niltv.
Diffstat (limited to 'src/lj_record.c')
-rw-r--r--src/lj_record.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lj_record.c b/src/lj_record.c
index 54068697..29c024bf 100644
--- a/src/lj_record.c
+++ b/src/lj_record.c
@@ -995,10 +995,10 @@ static TRef rec_idx(jit_State *J, RecordIndex *ix)
995 cTValue *mo = lj_tab_getstr(mt, strref(J2G(J)->mmname[MM_newindex])); 995 cTValue *mo = lj_tab_getstr(mt, strref(J2G(J)->mmname[MM_newindex]));
996 hasmm = mo && !tvisnil(mo); 996 hasmm = mo && !tvisnil(mo);
997 } 997 }
998 if (hasmm || oldv == niltvg(J2G(J))) 998 if (hasmm)
999 emitir(IRTG(loadop, IRT_NIL), xref, 0); /* Guard for nil value. */ 999 emitir(IRTG(loadop, IRT_NIL), xref, 0); /* Guard for nil value. */
1000 else if (xrefop == IR_HREF) 1000 else if (xrefop == IR_HREF)
1001 emitir(IRTG(IR_NE, IRT_PTR), xref, lj_ir_kptr(J, niltvg(J2G(J)))); 1001 emitir(IRTG(oldv == niltvg(J2G(J)) ? IR_EQ : IR_NE, IRT_PTR), xref, lj_ir_kptr(J, niltvg(J2G(J))));
1002 if (ix->idxchain && rec_mm_lookup(J, ix, MM_newindex)) { /* Metamethod? */ 1002 if (ix->idxchain && rec_mm_lookup(J, ix, MM_newindex)) { /* Metamethod? */
1003 lua_assert(hasmm); 1003 lua_assert(hasmm);
1004 goto handlemm; 1004 goto handlemm;