diff options
Diffstat (limited to 'src/lj_opt_mem.c')
-rw-r--r-- | src/lj_opt_mem.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/lj_opt_mem.c b/src/lj_opt_mem.c index 4c2c05fe..80517f16 100644 --- a/src/lj_opt_mem.c +++ b/src/lj_opt_mem.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include "lj_jit.h" | 18 | #include "lj_jit.h" |
19 | #include "lj_iropt.h" | 19 | #include "lj_iropt.h" |
20 | #include "lj_ircall.h" | 20 | #include "lj_ircall.h" |
21 | #include "lj_dispatch.h" | ||
21 | 22 | ||
22 | /* Some local macros to save typing. Undef'd at the end. */ | 23 | /* Some local macros to save typing. Undef'd at the end. */ |
23 | #define IR(ref) (&J->cur.ir[(ref)]) | 24 | #define IR(ref) (&J->cur.ir[(ref)]) |
@@ -56,8 +57,8 @@ static AliasRet aa_table(jit_State *J, IRRef ta, IRRef tb) | |||
56 | { | 57 | { |
57 | IRIns *taba = IR(ta), *tabb = IR(tb); | 58 | IRIns *taba = IR(ta), *tabb = IR(tb); |
58 | int newa, newb; | 59 | int newa, newb; |
59 | lua_assert(ta != tb); | 60 | lj_assertJ(ta != tb, "bad usage"); |
60 | lua_assert(irt_istab(taba->t) && irt_istab(tabb->t)); | 61 | lj_assertJ(irt_istab(taba->t) && irt_istab(tabb->t), "bad usage"); |
61 | /* Disambiguate new allocations. */ | 62 | /* Disambiguate new allocations. */ |
62 | newa = (taba->o == IR_TNEW || taba->o == IR_TDUP); | 63 | newa = (taba->o == IR_TNEW || taba->o == IR_TDUP); |
63 | newb = (tabb->o == IR_TNEW || tabb->o == IR_TDUP); | 64 | newb = (tabb->o == IR_TNEW || tabb->o == IR_TDUP); |
@@ -99,7 +100,7 @@ static AliasRet aa_ahref(jit_State *J, IRIns *refa, IRIns *refb) | |||
99 | /* Disambiguate array references based on index arithmetic. */ | 100 | /* Disambiguate array references based on index arithmetic. */ |
100 | int32_t ofsa = 0, ofsb = 0; | 101 | int32_t ofsa = 0, ofsb = 0; |
101 | IRRef basea = ka, baseb = kb; | 102 | IRRef basea = ka, baseb = kb; |
102 | lua_assert(refb->o == IR_AREF); | 103 | lj_assertJ(refb->o == IR_AREF, "expected AREF"); |
103 | /* Gather base and offset from t[base] or t[base+-ofs]. */ | 104 | /* Gather base and offset from t[base] or t[base+-ofs]. */ |
104 | if (keya->o == IR_ADD && irref_isk(keya->op2)) { | 105 | if (keya->o == IR_ADD && irref_isk(keya->op2)) { |
105 | basea = keya->op1; | 106 | basea = keya->op1; |
@@ -117,8 +118,9 @@ static AliasRet aa_ahref(jit_State *J, IRIns *refa, IRIns *refb) | |||
117 | return ALIAS_NO; /* t[base+-o1] vs. t[base+-o2] and o1 != o2. */ | 118 | return ALIAS_NO; /* t[base+-o1] vs. t[base+-o2] and o1 != o2. */ |
118 | } else { | 119 | } else { |
119 | /* Disambiguate hash references based on the type of their keys. */ | 120 | /* Disambiguate hash references based on the type of their keys. */ |
120 | lua_assert((refa->o==IR_HREF || refa->o==IR_HREFK || refa->o==IR_NEWREF) && | 121 | lj_assertJ((refa->o==IR_HREF || refa->o==IR_HREFK || refa->o==IR_NEWREF) && |
121 | (refb->o==IR_HREF || refb->o==IR_HREFK || refb->o==IR_NEWREF)); | 122 | (refb->o==IR_HREF || refb->o==IR_HREFK || refb->o==IR_NEWREF), |
123 | "bad xREF IR op %d or %d", refa->o, refb->o); | ||
122 | if (!irt_sametype(keya->t, keyb->t)) | 124 | if (!irt_sametype(keya->t, keyb->t)) |
123 | return ALIAS_NO; /* Different key types. */ | 125 | return ALIAS_NO; /* Different key types. */ |
124 | } | 126 | } |
@@ -192,7 +194,8 @@ static TRef fwd_ahload(jit_State *J, IRRef xref) | |||
192 | if (key->o == IR_KSLOT) key = IR(key->op1); | 194 | if (key->o == IR_KSLOT) key = IR(key->op1); |
193 | lj_ir_kvalue(J->L, &keyv, key); | 195 | lj_ir_kvalue(J->L, &keyv, key); |
194 | tv = lj_tab_get(J->L, ir_ktab(IR(ir->op1)), &keyv); | 196 | tv = lj_tab_get(J->L, ir_ktab(IR(ir->op1)), &keyv); |
195 | lua_assert(itype2irt(tv) == irt_type(fins->t)); | 197 | lj_assertJ(itype2irt(tv) == irt_type(fins->t), |
198 | "mismatched type in constant table"); | ||
196 | if (irt_isnum(fins->t)) | 199 | if (irt_isnum(fins->t)) |
197 | return lj_ir_knum_u64(J, tv->u64); | 200 | return lj_ir_knum_u64(J, tv->u64); |
198 | else if (LJ_DUALNUM && irt_isint(fins->t)) | 201 | else if (LJ_DUALNUM && irt_isint(fins->t)) |