From: sergos@tarantool.org To: tarantool-patches@freelists.org Cc: Sergey Ostanevich <sergos@tarantool.org> Subject: [tarantool-patches] [PATCH] luajit: fold machinery misbehaves Date: Tue, 30 Jul 2019 19:59:55 +0000 [thread overview] Message-ID: <20190730195955.41309-1-sergos@tarantool.org> (raw) From: Sergey Ostanevich <sergos@tarantool.org> This is a solution from the reference LuaJIT for https://github.com/LuaJIT/LuaJIT/issues/505 Picking up ahead of reference repo since it's abandoned resolves: #4376 available at: https://github.com/tarantool/luajit/tree/sergos/luajit-gh-505-folder-problems-v2 --- src/lj_ffrecord.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c index dfdee2d..632b8f2 100644 --- a/src/lj_ffrecord.c +++ b/src/lj_ffrecord.c @@ -949,8 +949,9 @@ static void LJ_FASTCALL recff_string_find(jit_State *J, RecordFFData *rd) str->len-(MSize)start, pat->len)) { TRef pos; emitir(IRTG(IR_NE, IRT_PGC), tr, trp0); - pos = emitir(IRTI(IR_SUB), tr, emitir(IRT(IR_STRREF, IRT_PGC), trstr, tr0)); - J->base[0] = emitir(IRTI(IR_ADD), pos, lj_ir_kint(J, 1)); + /* Caveat: can't use STRREF trstr 0 here because that might be pointing into a wrong string due to folding. */ + pos = emitir(IRTI(IR_SUB), tr, trsptr); + J->base[0] = emitir(IRTI(IR_ADD), pos, emitir(IRTI(IR_ADD), trstart, lj_ir_kint(J, 1))); J->base[1] = emitir(IRTI(IR_ADD), pos, trplen); rd->nres = 2; } else { -- 2.17.1
next reply other threads:[~2019-07-30 20:00 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-07-30 19:59 sergos [this message] 2019-08-15 11:29 ` [tarantool-patches] " Kirill Yukhin -- strict thread matches above, loose matches on Subject: below -- 2019-07-25 12:05 [tarantool-patches] " sergos
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190730195955.41309-1-sergos@tarantool.org \ --to=sergos@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='Re: [tarantool-patches] [PATCH] luajit: fold machinery misbehaves' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox