diff options
Diffstat (limited to 'src/lj_record.c')
-rw-r--r-- | src/lj_record.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lj_record.c b/src/lj_record.c index 5910dab4..956f3bed 100644 --- a/src/lj_record.c +++ b/src/lj_record.c | |||
@@ -969,6 +969,16 @@ static void rec_mm_comp(jit_State *J, RecordIndex *ix, int op) | |||
969 | copyTV(J->L, &ix->tabv, &ix->valv); | 969 | copyTV(J->L, &ix->tabv, &ix->valv); |
970 | while (1) { | 970 | while (1) { |
971 | MMS mm = (op & 2) ? MM_le : MM_lt; /* Try __le + __lt or only __lt. */ | 971 | MMS mm = (op & 2) ? MM_le : MM_lt; /* Try __le + __lt or only __lt. */ |
972 | #if LJ_52 | ||
973 | if (!lj_record_mm_lookup(J, ix, mm)) { /* Lookup mm on 1st operand. */ | ||
974 | ix->tab = ix->key; | ||
975 | copyTV(J->L, &ix->tabv, &ix->keyv); | ||
976 | if (!lj_record_mm_lookup(J, ix, mm)) /* Lookup mm on 2nd operand. */ | ||
977 | goto nomatch; | ||
978 | } | ||
979 | rec_mm_callcomp(J, ix, op); | ||
980 | return; | ||
981 | #else | ||
972 | if (lj_record_mm_lookup(J, ix, mm)) { /* Lookup mm on 1st operand. */ | 982 | if (lj_record_mm_lookup(J, ix, mm)) { /* Lookup mm on 1st operand. */ |
973 | cTValue *bv; | 983 | cTValue *bv; |
974 | TRef mo1 = ix->mobj; | 984 | TRef mo1 = ix->mobj; |
@@ -992,8 +1002,9 @@ static void rec_mm_comp(jit_State *J, RecordIndex *ix, int op) | |||
992 | rec_mm_callcomp(J, ix, op); | 1002 | rec_mm_callcomp(J, ix, op); |
993 | return; | 1003 | return; |
994 | } | 1004 | } |
1005 | #endif | ||
995 | nomatch: | 1006 | nomatch: |
996 | /* First lookup failed. Retry with __lt and swapped operands. */ | 1007 | /* Lookup failed. Retry with __lt and swapped operands. */ |
997 | if (!(op & 2)) break; /* Already at __lt. Interpreter will throw. */ | 1008 | if (!(op & 2)) break; /* Already at __lt. Interpreter will throw. */ |
998 | ix->tab = ix->key; ix->key = ix->val; ix->val = ix->tab; | 1009 | ix->tab = ix->key; ix->key = ix->val; ix->val = ix->tab; |
999 | copyTV(J->L, &ix->tabv, &ix->keyv); | 1010 | copyTV(J->L, &ix->tabv, &ix->keyv); |
@@ -1742,6 +1753,8 @@ void lj_record_ins(jit_State *J) | |||
1742 | ta = IRT_NUM; | 1753 | ta = IRT_NUM; |
1743 | } else if (ta == IRT_NUM && tc == IRT_INT) { | 1754 | } else if (ta == IRT_NUM && tc == IRT_INT) { |
1744 | rc = emitir(IRTN(IR_CONV), rc, IRCONV_NUM_INT); | 1755 | rc = emitir(IRTN(IR_CONV), rc, IRCONV_NUM_INT); |
1756 | } else if (LJ_52) { | ||
1757 | ta = IRT_NIL; /* Force metamethod for different types. */ | ||
1745 | } else if (!((ta == IRT_FALSE || ta == IRT_TRUE) && | 1758 | } else if (!((ta == IRT_FALSE || ta == IRT_TRUE) && |
1746 | (tc == IRT_FALSE || tc == IRT_TRUE))) { | 1759 | (tc == IRT_FALSE || tc == IRT_TRUE))) { |
1747 | break; /* Interpreter will throw for two different types. */ | 1760 | break; /* Interpreter will throw for two different types. */ |