diff options
-rw-r--r-- | src/lj_opt_mem.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lj_opt_mem.c b/src/lj_opt_mem.c index 7e364f0b..ee573cad 100644 --- a/src/lj_opt_mem.c +++ b/src/lj_opt_mem.c | |||
@@ -43,6 +43,7 @@ static AliasRet aa_table(jit_State *J, IRRef ta, IRRef tb) | |||
43 | IRIns *ir, *taba = IR(ta), *tabb = IR(tb); | 43 | IRIns *ir, *taba = IR(ta), *tabb = IR(tb); |
44 | int newa, newb; | 44 | int newa, newb; |
45 | lua_assert(ta != tb); | 45 | lua_assert(ta != tb); |
46 | lua_assert(irt_istab(taba->t) && irt_istab(tabb->t)); | ||
46 | /* Disambiguate new allocations. */ | 47 | /* Disambiguate new allocations. */ |
47 | newa = (taba->o == IR_TNEW || taba->o == IR_TDUP); | 48 | newa = (taba->o == IR_TNEW || taba->o == IR_TDUP); |
48 | newb = (tabb->o == IR_TNEW || tabb->o == IR_TDUP); | 49 | newb = (tabb->o == IR_TNEW || tabb->o == IR_TDUP); |
@@ -435,12 +436,14 @@ doemit: | |||
435 | ** Field loads are cheap and field stores are rare. | 436 | ** Field loads are cheap and field stores are rare. |
436 | ** Simple disambiguation based on field types is good enough. | 437 | ** Simple disambiguation based on field types is good enough. |
437 | */ | 438 | */ |
438 | static AliasRet aa_fref(IRIns *refa, IRIns *refb) | 439 | static AliasRet aa_fref(jit_State *J, IRIns *refa, IRIns *refb) |
439 | { | 440 | { |
440 | if (refa->op2 != refb->op2) | 441 | if (refa->op2 != refb->op2) |
441 | return ALIAS_NO; /* Different fields. */ | 442 | return ALIAS_NO; /* Different fields. */ |
442 | if (refa->op1 == refb->op1) | 443 | if (refa->op1 == refb->op1) |
443 | return ALIAS_MUST; /* Same field, same object. */ | 444 | return ALIAS_MUST; /* Same field, same object. */ |
445 | else if (refa->op2 >= IRFL_TAB_META && refa->op2 <= IRFL_TAB_NOMM) | ||
446 | return aa_table(J, refa->op1, refb->op1); /* Disambiguate tables. */ | ||
444 | else | 447 | else |
445 | return ALIAS_MAY; /* Same field, possibly different object. */ | 448 | return ALIAS_MAY; /* Same field, possibly different object. */ |
446 | } | 449 | } |
@@ -457,7 +460,7 @@ TRef LJ_FASTCALL lj_opt_fwd_fload(jit_State *J) | |||
457 | ref = J->chain[IR_FSTORE]; | 460 | ref = J->chain[IR_FSTORE]; |
458 | while (ref > oref) { | 461 | while (ref > oref) { |
459 | IRIns *store = IR(ref); | 462 | IRIns *store = IR(ref); |
460 | switch (aa_fref(fins, IR(store->op1))) { | 463 | switch (aa_fref(J, fins, IR(store->op1))) { |
461 | case ALIAS_NO: break; /* Continue searching. */ | 464 | case ALIAS_NO: break; /* Continue searching. */ |
462 | case ALIAS_MAY: lim = ref; goto cselim; /* Limit search for load. */ | 465 | case ALIAS_MAY: lim = ref; goto cselim; /* Limit search for load. */ |
463 | case ALIAS_MUST: return store->op2; /* Store forwarding. */ | 466 | case ALIAS_MUST: return store->op2; /* Store forwarding. */ |
@@ -487,7 +490,7 @@ TRef LJ_FASTCALL lj_opt_dse_fstore(jit_State *J) | |||
487 | IRRef ref = *refp; | 490 | IRRef ref = *refp; |
488 | while (ref > fref) { /* Search for redundant or conflicting stores. */ | 491 | while (ref > fref) { /* Search for redundant or conflicting stores. */ |
489 | IRIns *store = IR(ref); | 492 | IRIns *store = IR(ref); |
490 | switch (aa_fref(xr, IR(store->op1))) { | 493 | switch (aa_fref(J, xr, IR(store->op1))) { |
491 | case ALIAS_NO: | 494 | case ALIAS_NO: |
492 | break; /* Continue searching. */ | 495 | break; /* Continue searching. */ |
493 | case ALIAS_MAY: | 496 | case ALIAS_MAY: |