mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Don't use STRREF for pointer diff in string.find().
Thanks to Sergey Ostanevich and Vyacheslav Egorov.
This commit is contained in:
parent
2a7c200dc2
commit
9600e4318e
@ -949,7 +949,8 @@ static void LJ_FASTCALL recff_string_find(jit_State *J, RecordFFData *rd)
|
|||||||
str->len-(MSize)start, pat->len)) {
|
str->len-(MSize)start, pat->len)) {
|
||||||
TRef pos;
|
TRef pos;
|
||||||
emitir(IRTG(IR_NE, IRT_PGC), tr, trp0);
|
emitir(IRTG(IR_NE, IRT_PGC), tr, trp0);
|
||||||
pos = emitir(IRTI(IR_SUB), tr, emitir(IRT(IR_STRREF, IRT_PGC), trstr, tr0));
|
/* Don't use STRREF of trstr. We need a pointer diff. */
|
||||||
|
pos = emitir(IRTI(IR_SUB), emitir(IRTI(IR_SUB), tr, trstr), lj_ir_kint(J, sizeof(GCstr)));
|
||||||
J->base[0] = emitir(IRTI(IR_ADD), pos, lj_ir_kint(J, 1));
|
J->base[0] = emitir(IRTI(IR_ADD), pos, lj_ir_kint(J, 1));
|
||||||
J->base[1] = emitir(IRTI(IR_ADD), pos, trplen);
|
J->base[1] = emitir(IRTI(IR_ADD), pos, trplen);
|
||||||
rd->nres = 2;
|
rd->nres = 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user