diff options
author | Mike Pall <mike> | 2013-04-23 00:08:04 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2013-04-23 00:10:01 +0200 |
commit | 2cdf90f0683e4da3afc8554d17859260fdc6b4dc (patch) | |
tree | 7709bdec5c3e562067e792d14b1e3f46df96849d /src/lj_record.c | |
parent | 1ae3e5204b8cbd8b643a5a3ab747211be8fe6fba (diff) | |
download | luajit-2cdf90f0683e4da3afc8554d17859260fdc6b4dc.tar.gz luajit-2cdf90f0683e4da3afc8554d17859260fdc6b4dc.tar.bz2 luajit-2cdf90f0683e4da3afc8554d17859260fdc6b4dc.zip |
Always emit TOSTR for non-string CAT operands. Fuse in backend.
Diffstat (limited to 'src/lj_record.c')
-rw-r--r-- | src/lj_record.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lj_record.c b/src/lj_record.c index bbabd3ce..bafb6ff7 100644 --- a/src/lj_record.c +++ b/src/lj_record.c | |||
@@ -1608,10 +1608,13 @@ static TRef rec_cat(jit_State *J, BCReg baseslot, BCReg topslot) | |||
1608 | lua_assert(baseslot < topslot); | 1608 | lua_assert(baseslot < topslot); |
1609 | if (tref_isnumber_str(tr) && tref_isnumber_str(*(top-1))) { | 1609 | if (tref_isnumber_str(tr) && tref_isnumber_str(*(top-1))) { |
1610 | TRef hdr, *trp, *xbase, *base = &J->base[baseslot]; | 1610 | TRef hdr, *trp, *xbase, *base = &J->base[baseslot]; |
1611 | /* First convert number consts to string consts to simplify FOLD rules. */ | 1611 | /* First convert numbers to strings. */ |
1612 | for (trp = top; trp >= base && tref_isnumber_str(*trp); trp--) | 1612 | for (trp = top; trp >= base; trp--) { |
1613 | if (tref_isk(*trp) && tref_isnumber(*trp)) | 1613 | if (tref_isnumber(*trp)) |
1614 | *trp = emitir(IRT(IR_TOSTR, IRT_STR), *trp, 0); | 1614 | *trp = emitir(IRT(IR_TOSTR, IRT_STR), *trp, 0); |
1615 | else if (!tref_isstr(*trp)) | ||
1616 | break; | ||
1617 | } | ||
1615 | xbase = ++trp; | 1618 | xbase = ++trp; |
1616 | tr = hdr = emitir(IRT(IR_BUFHDR, IRT_P32), | 1619 | tr = hdr = emitir(IRT(IR_BUFHDR, IRT_P32), |
1617 | lj_ir_kptr(J, &J2G(J)->tmpbuf), IRBUFHDR_RESET); | 1620 | lj_ir_kptr(J, &J2G(J)->tmpbuf), IRBUFHDR_RESET); |