Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH] luajit: fold machinery misbehaves
@ 2019-07-30 19:59 sergos
  2019-08-15 11:29 ` [tarantool-patches] " Kirill Yukhin
  0 siblings, 1 reply; 2+ messages in thread
From: sergos @ 2019-07-30 19:59 UTC (permalink / raw)
  To: tarantool-patches; +Cc: Sergey Ostanevich

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [tarantool-patches] Re: [PATCH] luajit: fold machinery misbehaves
  2019-07-30 19:59 [tarantool-patches] [PATCH] luajit: fold machinery misbehaves sergos
@ 2019-08-15 11:29 ` Kirill Yukhin
  0 siblings, 0 replies; 2+ messages in thread
From: Kirill Yukhin @ 2019-08-15 11:29 UTC (permalink / raw)
  To: tarantool-patches; +Cc: Sergey Ostanevich

Hello,

On 30 Jul 19:59, sergos@tarantool.org wrote:
> 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

I've checked your patch into 1.10, 2.1, 2.2 and master.

--
Regards, Kirill Yukhin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-15 11:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-30 19:59 [tarantool-patches] [PATCH] luajit: fold machinery misbehaves sergos
2019-08-15 11:29 ` [tarantool-patches] " Kirill Yukhin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox