diff options
author | Mike Pall <mike> | 2023-09-09 13:42:12 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2023-09-09 13:42:12 +0200 |
commit | 9bd240413706f03cbd619216da9b26a861a6d6e6 (patch) | |
tree | 81e921d92307ed4208ef7aa304afc760ca8aca68 /src | |
parent | cc8d88aafc5ff55e9d79d116ffe424a8c2b5c162 (diff) | |
parent | 7f9907b4ed0870ba64342bcc4b26cff0a94540da (diff) | |
download | luajit-9bd240413706f03cbd619216da9b26a861a6d6e6.tar.gz luajit-9bd240413706f03cbd619216da9b26a861a6d6e6.tar.bz2 luajit-9bd240413706f03cbd619216da9b26a861a6d6e6.zip |
Merge branch 'master' into v2.1
Diffstat (limited to 'src')
-rw-r--r-- | src/lj_opt_fold.c | 5 | ||||
-rw-r--r-- | src/lj_record.c | 12 |
2 files changed, 13 insertions, 4 deletions
diff --git a/src/lj_opt_fold.c b/src/lj_opt_fold.c index 48effb8a..d90477f6 100644 --- a/src/lj_opt_fold.c +++ b/src/lj_opt_fold.c | |||
@@ -1972,7 +1972,10 @@ LJFOLD(NE any any) | |||
1972 | LJFOLDF(comm_equal) | 1972 | LJFOLDF(comm_equal) |
1973 | { | 1973 | { |
1974 | /* For non-numbers only: x == x ==> drop; x ~= x ==> fail */ | 1974 | /* For non-numbers only: x == x ==> drop; x ~= x ==> fail */ |
1975 | if (fins->op1 == fins->op2 && !irt_isnum(fins->t)) | 1975 | if (fins->op1 == fins->op2 && |
1976 | (!irt_isnum(fins->t) || | ||
1977 | (fleft->o == IR_CONV && /* Converted integers cannot be NaN. */ | ||
1978 | (uint32_t)(fleft->op2 & IRCONV_SRCMASK) - (uint32_t)IRT_I8 <= (uint32_t)(IRT_U64 - IRT_U8)))) | ||
1976 | return CONDFOLD(fins->o == IR_EQ); | 1979 | return CONDFOLD(fins->o == IR_EQ); |
1977 | return fold_comm_swap(J); | 1980 | return fold_comm_swap(J); |
1978 | } | 1981 | } |
diff --git a/src/lj_record.c b/src/lj_record.c index 9d0021a6..134fad83 100644 --- a/src/lj_record.c +++ b/src/lj_record.c | |||
@@ -1599,10 +1599,16 @@ TRef lj_record_idx(jit_State *J, RecordIndex *ix) | |||
1599 | lj_assertJ(!hasmm, "inconsistent metamethod handling"); | 1599 | lj_assertJ(!hasmm, "inconsistent metamethod handling"); |
1600 | if (oldv == niltvg(J2G(J))) { /* Need to insert a new key. */ | 1600 | if (oldv == niltvg(J2G(J))) { /* Need to insert a new key. */ |
1601 | TRef key = ix->key; | 1601 | TRef key = ix->key; |
1602 | if (tref_isinteger(key)) /* NEWREF needs a TValue as a key. */ | 1602 | if (tref_isinteger(key)) { /* NEWREF needs a TValue as a key. */ |
1603 | key = emitir(IRTN(IR_CONV), key, IRCONV_NUM_INT); | 1603 | key = emitir(IRTN(IR_CONV), key, IRCONV_NUM_INT); |
1604 | else if (tref_isnumber(key) && tref_isk(key) && tvismzero(&ix->keyv)) | 1604 | } else if (tref_isnum(key)) { |
1605 | key = lj_ir_knum_zero(J); /* Canonicalize -0.0 to +0.0. */ | 1605 | if (tref_isk(key)) { |
1606 | if (tvismzero(&ix->keyv)) | ||
1607 | key = lj_ir_knum_zero(J); /* Canonicalize -0.0 to +0.0. */ | ||
1608 | } else { | ||
1609 | emitir(IRTG(IR_EQ, IRT_NUM), key, key); /* Check for !NaN. */ | ||
1610 | } | ||
1611 | } | ||
1606 | xref = emitir(IRT(IR_NEWREF, IRT_PGC), ix->tab, key); | 1612 | xref = emitir(IRT(IR_NEWREF, IRT_PGC), ix->tab, key); |
1607 | keybarrier = 0; /* NEWREF already takes care of the key barrier. */ | 1613 | keybarrier = 0; /* NEWREF already takes care of the key barrier. */ |
1608 | #ifdef LUAJIT_ENABLE_TABLE_BUMP | 1614 | #ifdef LUAJIT_ENABLE_TABLE_BUMP |