diff options
author | Mike Pall <mike> | 2023-12-11 13:01:36 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2023-12-11 13:01:36 +0100 |
commit | 9bdfd34dccb913777be0efcc6869b6eeb5b9b43b (patch) | |
tree | 5fc0ee0bd9fd547063c9e4917a1e50d71a449a4f | |
parent | 10cc759f259e1f3b6572ce663858c8ce4d34a483 (diff) | |
download | luajit-9bdfd34dccb913777be0efcc6869b6eeb5b9b43b.tar.gz luajit-9bdfd34dccb913777be0efcc6869b6eeb5b9b43b.tar.bz2 luajit-9bdfd34dccb913777be0efcc6869b6eeb5b9b43b.zip |
Only emit proper parent references in snapshot replay.
Thanks to Peter Cawley. #1132
-rw-r--r-- | src/lj_snap.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lj_snap.c b/src/lj_snap.c index 5a5c481b..b387dd76 100644 --- a/src/lj_snap.c +++ b/src/lj_snap.c | |||
@@ -510,12 +510,14 @@ void lj_snap_replay(jit_State *J, GCtrace *T) | |||
510 | IRRef refp = snap_ref(sn); | 510 | IRRef refp = snap_ref(sn); |
511 | IRIns *ir = &T->ir[refp]; | 511 | IRIns *ir = &T->ir[refp]; |
512 | if (regsp_reg(ir->r) == RID_SUNK) { | 512 | if (regsp_reg(ir->r) == RID_SUNK) { |
513 | uint8_t m; | ||
513 | if (J->slot[snap_slot(sn)] != snap_slot(sn)) continue; | 514 | if (J->slot[snap_slot(sn)] != snap_slot(sn)) continue; |
514 | pass23 = 1; | 515 | pass23 = 1; |
515 | lua_assert(ir->o == IR_TNEW || ir->o == IR_TDUP || | 516 | lua_assert(ir->o == IR_TNEW || ir->o == IR_TDUP || |
516 | ir->o == IR_CNEW || ir->o == IR_CNEWI); | 517 | ir->o == IR_CNEW || ir->o == IR_CNEWI); |
517 | if (ir->op1 >= T->nk) snap_pref(J, T, map, nent, seen, ir->op1); | 518 | m = lj_ir_mode[ir->o]; |
518 | if (ir->op2 >= T->nk) snap_pref(J, T, map, nent, seen, ir->op2); | 519 | if (irm_op1(m) == IRMref) snap_pref(J, T, map, nent, seen, ir->op1); |
520 | if (irm_op2(m) == IRMref) snap_pref(J, T, map, nent, seen, ir->op2); | ||
519 | if (LJ_HASFFI && ir->o == IR_CNEWI) { | 521 | if (LJ_HASFFI && ir->o == IR_CNEWI) { |
520 | if (LJ_32 && refp+1 < T->nins && (ir+1)->o == IR_HIOP) | 522 | if (LJ_32 && refp+1 < T->nins && (ir+1)->o == IR_HIOP) |
521 | snap_pref(J, T, map, nent, seen, (ir+1)->op2); | 523 | snap_pref(J, T, map, nent, seen, (ir+1)->op2); |
@@ -542,14 +544,16 @@ void lj_snap_replay(jit_State *J, GCtrace *T) | |||
542 | IRIns *ir = &T->ir[refp]; | 544 | IRIns *ir = &T->ir[refp]; |
543 | if (regsp_reg(ir->r) == RID_SUNK) { | 545 | if (regsp_reg(ir->r) == RID_SUNK) { |
544 | TRef op1, op2; | 546 | TRef op1, op2; |
547 | uint8_t m; | ||
545 | if (J->slot[snap_slot(sn)] != snap_slot(sn)) { /* De-dup allocs. */ | 548 | if (J->slot[snap_slot(sn)] != snap_slot(sn)) { /* De-dup allocs. */ |
546 | J->slot[snap_slot(sn)] = J->slot[J->slot[snap_slot(sn)]]; | 549 | J->slot[snap_slot(sn)] = J->slot[J->slot[snap_slot(sn)]]; |
547 | continue; | 550 | continue; |
548 | } | 551 | } |
549 | op1 = ir->op1; | 552 | op1 = ir->op1; |
550 | if (op1 >= T->nk) op1 = snap_pref(J, T, map, nent, seen, op1); | 553 | m = lj_ir_mode[ir->o]; |
554 | if (irm_op1(m) == IRMref) op1 = snap_pref(J, T, map, nent, seen, op1); | ||
551 | op2 = ir->op2; | 555 | op2 = ir->op2; |
552 | if (op2 >= T->nk) op2 = snap_pref(J, T, map, nent, seen, op2); | 556 | if (irm_op2(m) == IRMref) op2 = snap_pref(J, T, map, nent, seen, op2); |
553 | if (LJ_HASFFI && ir->o == IR_CNEWI) { | 557 | if (LJ_HASFFI && ir->o == IR_CNEWI) { |
554 | if (LJ_32 && refp+1 < T->nins && (ir+1)->o == IR_HIOP) { | 558 | if (LJ_32 && refp+1 < T->nins && (ir+1)->o == IR_HIOP) { |
555 | lj_needsplit(J); /* Emit joining HIOP. */ | 559 | lj_needsplit(J); /* Emit joining HIOP. */ |