diff options
| author | Mike Pall <mike> | 2019-08-30 12:16:50 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2019-08-30 12:16:50 +0200 |
| commit | 8755e0b74b71b4e26e31caa9fe8e0a3de8364c21 (patch) | |
| tree | 4544cb4829a76c08ae5fc40e4162c4abfd5d3c07 /src | |
| parent | 88d40b00c38611412d0023d7ed55999615deb55b (diff) | |
| download | luajit-8755e0b74b71b4e26e31caa9fe8e0a3de8364c21.tar.gz luajit-8755e0b74b71b4e26e31caa9fe8e0a3de8364c21.tar.bz2 luajit-8755e0b74b71b4e26e31caa9fe8e0a3de8364c21.zip | |
Fix unsinking of 64 bit constants.
Contributed by Thibault Charbonnier.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lj_ir.h | 12 | ||||
| -rw-r--r-- | src/lj_snap.c | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/lj_ir.h b/src/lj_ir.h index 8057a750..ae889850 100644 --- a/src/lj_ir.h +++ b/src/lj_ir.h | |||
| @@ -562,6 +562,11 @@ typedef union IRIns { | |||
| 562 | TValue tv; /* TValue constant (overlaps entire slot). */ | 562 | TValue tv; /* TValue constant (overlaps entire slot). */ |
| 563 | } IRIns; | 563 | } IRIns; |
| 564 | 564 | ||
| 565 | #define ir_isk64(ir) \ | ||
| 566 | ((ir)->o == IR_KNUM || (ir)->o == IR_KINT64 || \ | ||
| 567 | (LJ_GC64 && \ | ||
| 568 | ((ir)->o == IR_KGC || (ir)->o == IR_KPTR || (ir)->o == IR_KKPTR))) | ||
| 569 | |||
| 565 | #define ir_kgc(ir) check_exp((ir)->o == IR_KGC, gcref((ir)[LJ_GC64].gcr)) | 570 | #define ir_kgc(ir) check_exp((ir)->o == IR_KGC, gcref((ir)[LJ_GC64].gcr)) |
| 566 | #define ir_kstr(ir) (gco2str(ir_kgc((ir)))) | 571 | #define ir_kstr(ir) (gco2str(ir_kgc((ir)))) |
| 567 | #define ir_ktab(ir) (gco2tab(ir_kgc((ir)))) | 572 | #define ir_ktab(ir) (gco2tab(ir_kgc((ir)))) |
| @@ -569,12 +574,7 @@ typedef union IRIns { | |||
| 569 | #define ir_kcdata(ir) (gco2cd(ir_kgc((ir)))) | 574 | #define ir_kcdata(ir) (gco2cd(ir_kgc((ir)))) |
| 570 | #define ir_knum(ir) check_exp((ir)->o == IR_KNUM, &(ir)[1].tv) | 575 | #define ir_knum(ir) check_exp((ir)->o == IR_KNUM, &(ir)[1].tv) |
| 571 | #define ir_kint64(ir) check_exp((ir)->o == IR_KINT64, &(ir)[1].tv) | 576 | #define ir_kint64(ir) check_exp((ir)->o == IR_KINT64, &(ir)[1].tv) |
| 572 | #define ir_k64(ir) \ | 577 | #define ir_k64(ir) check_exp(ir_isk64(ir), &(ir)[1].tv) |
| 573 | check_exp((ir)->o == IR_KNUM || (ir)->o == IR_KINT64 || \ | ||
| 574 | (LJ_GC64 && \ | ||
| 575 | ((ir)->o == IR_KGC || \ | ||
| 576 | (ir)->o == IR_KPTR || (ir)->o == IR_KKPTR)), \ | ||
| 577 | &(ir)[1].tv) | ||
| 578 | #define ir_kptr(ir) \ | 578 | #define ir_kptr(ir) \ |
| 579 | check_exp((ir)->o == IR_KPTR || (ir)->o == IR_KKPTR, \ | 579 | check_exp((ir)->o == IR_KPTR || (ir)->o == IR_KKPTR, \ |
| 580 | mref((ir)[LJ_GC64].ptr, void)) | 580 | mref((ir)[LJ_GC64].ptr, void)) |
diff --git a/src/lj_snap.c b/src/lj_snap.c index ceaf2ca5..75888d80 100644 --- a/src/lj_snap.c +++ b/src/lj_snap.c | |||
| @@ -688,7 +688,7 @@ static void snap_restoredata(GCtrace *T, ExitState *ex, | |||
| 688 | int32_t *src; | 688 | int32_t *src; |
| 689 | uint64_t tmp; | 689 | uint64_t tmp; |
| 690 | if (irref_isk(ref)) { | 690 | if (irref_isk(ref)) { |
| 691 | if (ir->o == IR_KNUM || ir->o == IR_KINT64) { | 691 | if (ir_isk64(ir)) { |
| 692 | src = (int32_t *)&ir[1]; | 692 | src = (int32_t *)&ir[1]; |
| 693 | } else if (sz == 8) { | 693 | } else if (sz == 8) { |
| 694 | tmp = (uint64_t)(uint32_t)ir->i; | 694 | tmp = (uint64_t)(uint32_t)ir->i; |
