aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lj_crecord.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/lj_crecord.c b/src/lj_crecord.c
index 83dd28da..c0a468fc 100644
--- a/src/lj_crecord.c
+++ b/src/lj_crecord.c
@@ -1349,7 +1349,7 @@ static TRef crec_arith_ptr(jit_State *J, TRef *sp, CType **s, MMS mm)
1349} 1349}
1350 1350
1351/* Record ctype arithmetic metamethods. */ 1351/* Record ctype arithmetic metamethods. */
1352static TRef crec_arith_meta(jit_State *J, TRef *sp, CTState *cts, 1352static TRef crec_arith_meta(jit_State *J, TRef *sp, CType **s, CTState *cts,
1353 RecordFFData *rd) 1353 RecordFFData *rd)
1354{ 1354{
1355 cTValue *tv = NULL; 1355 cTValue *tv = NULL;
@@ -1374,7 +1374,7 @@ static TRef crec_arith_meta(jit_State *J, TRef *sp, CTState *cts,
1374 return 0; 1374 return 0;
1375 } /* NYI: non-function metamethods. */ 1375 } /* NYI: non-function metamethods. */
1376 } else if ((MMS)rd->data == MM_eq) { /* Fallback cdata pointer comparison. */ 1376 } else if ((MMS)rd->data == MM_eq) { /* Fallback cdata pointer comparison. */
1377 if (sp[0] && sp[1]) { 1377 if (sp[0] && sp[1] && ctype_isnum(s[0]->info) == ctype_isnum(s[1]->info)) {
1378 /* Assume true comparison. Fixup and emit pending guard later. */ 1378 /* Assume true comparison. Fixup and emit pending guard later. */
1379 lj_ir_set(J, IRTG(IR_EQ, IRT_PTR), sp[0], sp[1]); 1379 lj_ir_set(J, IRTG(IR_EQ, IRT_PTR), sp[0], sp[1]);
1380 J->postproc = LJ_POST_FIXGUARD; 1380 J->postproc = LJ_POST_FIXGUARD;
@@ -1452,9 +1452,13 @@ void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd)
1452 emitir(IRTG(IR_EQ, IRT_STR), tr, lj_ir_kstr(J, str)); 1452 emitir(IRTG(IR_EQ, IRT_STR), tr, lj_ir_kstr(J, str));
1453 ct = ctype_child(cts, cct); 1453 ct = ctype_child(cts, cct);
1454 tr = lj_ir_kint(J, (int32_t)ofs); 1454 tr = lj_ir_kint(J, (int32_t)ofs);
1455 } /* else: interpreter will throw. */ 1455 } else { /* Interpreter will throw or return false. */
1456 } else { 1456 ct = ctype_get(cts, CTID_P_VOID);
1457 }
1458 } else if (ctype_isptr(ct->info)) {
1457 tr = emitir(IRT(IR_ADD, IRT_PTR), tr, lj_ir_kintp(J, sizeof(GCstr))); 1459 tr = emitir(IRT(IR_ADD, IRT_PTR), tr, lj_ir_kintp(J, sizeof(GCstr)));
1460 } else {
1461 ct = ctype_get(cts, CTID_P_VOID);
1458 } 1462 }
1459 } else if (!tref_isnum(tr)) { 1463 } else if (!tref_isnum(tr)) {
1460 tr = 0; 1464 tr = 0;
@@ -1467,7 +1471,7 @@ void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd)
1467 TRef tr; 1471 TRef tr;
1468 if (!(tr = crec_arith_int64(J, sp, s, (MMS)rd->data)) && 1472 if (!(tr = crec_arith_int64(J, sp, s, (MMS)rd->data)) &&
1469 !(tr = crec_arith_ptr(J, sp, s, (MMS)rd->data)) && 1473 !(tr = crec_arith_ptr(J, sp, s, (MMS)rd->data)) &&
1470 !(tr = crec_arith_meta(J, sp, cts, rd))) 1474 !(tr = crec_arith_meta(J, sp, s, cts, rd)))
1471 return; 1475 return;
1472 J->base[0] = tr; 1476 J->base[0] = tr;
1473 /* Fixup cdata comparisons, too. Avoids some cdata escapes. */ 1477 /* Fixup cdata comparisons, too. Avoids some cdata escapes. */