aboutsummaryrefslogtreecommitdiff
path: root/src/lj_crecord.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_crecord.c')
-rw-r--r--src/lj_crecord.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lj_crecord.c b/src/lj_crecord.c
index 55d0b3ef..79159454 100644
--- a/src/lj_crecord.c
+++ b/src/lj_crecord.c
@@ -1498,7 +1498,8 @@ static TRef crec_arith_meta(jit_State *J, TRef *sp, CType **s, CTState *cts,
1498 1498
1499void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd) 1499void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd)
1500{ 1500{
1501 CTState *cts = ctype_ctsG(J2G(J)); 1501 CTState *cts = ctype_cts(J->L);
1502 MMS mm = (MMS)rd->data;
1502 TRef sp[2]; 1503 TRef sp[2];
1503 CType *s[2]; 1504 CType *s[2];
1504 MSize i; 1505 MSize i;
@@ -1548,6 +1549,8 @@ void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd)
1548 } 1549 }
1549 } 1550 }
1550 } else if (tref_isnil(tr)) { 1551 } else if (tref_isnil(tr)) {
1552 if (!(mm == MM_len || mm == MM_eq || mm == MM_lt || mm == MM_le))
1553 lj_trace_err(J, LJ_TRERR_BADTYPE);
1551 tr = lj_ir_kptr(J, NULL); 1554 tr = lj_ir_kptr(J, NULL);
1552 ct = ctype_get(cts, CTID_P_VOID); 1555 ct = ctype_get(cts, CTID_P_VOID);
1553 } else if (tref_isinteger(tr)) { 1556 } else if (tref_isinteger(tr)) {
@@ -1566,12 +1569,12 @@ void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd)
1566 ct = ctype_child(cts, cct); 1569 ct = ctype_child(cts, cct);
1567 tr = lj_ir_kint(J, (int32_t)ofs); 1570 tr = lj_ir_kint(J, (int32_t)ofs);
1568 } else { /* Interpreter will throw or return false. */ 1571 } else { /* Interpreter will throw or return false. */
1569 ct = ctype_get(cts, CTID_P_VOID); 1572 lj_trace_err(J, LJ_TRERR_BADTYPE);
1570 } 1573 }
1571 } else if (ctype_isptr(ct->info)) { 1574 } else if (ctype_isptr(ct->info)) {
1572 tr = emitir(IRT(IR_ADD, IRT_PTR), tr, lj_ir_kintp(J, sizeof(GCstr))); 1575 tr = emitir(IRT(IR_ADD, IRT_PTR), tr, lj_ir_kintp(J, sizeof(GCstr)));
1573 } else { 1576 } else {
1574 ct = ctype_get(cts, CTID_P_VOID); 1577 lj_trace_err(J, LJ_TRERR_BADTYPE);
1575 } 1578 }
1576 } else if (!tref_isnum(tr)) { 1579 } else if (!tref_isnum(tr)) {
1577 tr = 0; 1580 tr = 0;
@@ -1583,7 +1586,6 @@ void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd)
1583 } 1586 }
1584 { 1587 {
1585 TRef tr; 1588 TRef tr;
1586 MMS mm = (MMS)rd->data;
1587 if ((mm == MM_len || mm == MM_concat || 1589 if ((mm == MM_len || mm == MM_concat ||
1588 (!(tr = crec_arith_int64(J, sp, s, mm)) && 1590 (!(tr = crec_arith_int64(J, sp, s, mm)) &&
1589 !(tr = crec_arith_ptr(J, sp, s, mm)))) && 1591 !(tr = crec_arith_ptr(J, sp, s, mm)))) &&