diff options
| author | Mike Pall <mike> | 2011-05-27 01:56:25 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2011-05-27 01:56:25 +0200 |
| commit | 46955be1e2cbd3406bbc8209dbece7238a984835 (patch) | |
| tree | dba6dc92268c81a1313aeb2b890be324752d838d | |
| parent | 840a067d4e3538ab7887d128a817be44333684d6 (diff) | |
| download | luajit-46955be1e2cbd3406bbc8209dbece7238a984835.tar.gz luajit-46955be1e2cbd3406bbc8209dbece7238a984835.tar.bz2 luajit-46955be1e2cbd3406bbc8209dbece7238a984835.zip | |
Fix handling of number constants in snapshots in SPLIT pass.
| -rw-r--r-- | lib/dump.lua | 10 | ||||
| -rw-r--r-- | src/lj_opt_split.c | 15 | ||||
| -rw-r--r-- | src/lj_snap.c | 5 |
3 files changed, 18 insertions, 12 deletions
diff --git a/lib/dump.lua b/lib/dump.lua index b049828f..5f32eb80 100644 --- a/lib/dump.lua +++ b/lib/dump.lua | |||
| @@ -321,13 +321,11 @@ local function printsnap(tr, snap) | |||
| 321 | local ref = band(sn, 0xffff) - 0x8000 -- REF_BIAS | 321 | local ref = band(sn, 0xffff) - 0x8000 -- REF_BIAS |
| 322 | if ref < 0 then | 322 | if ref < 0 then |
| 323 | out:write(formatk(tr, ref)) | 323 | out:write(formatk(tr, ref)) |
| 324 | elseif band(sn, 0x80000) ~= 0 then -- SNAP_SOFTFPNUM | ||
| 325 | out:write(colorize(format("%04d/%04d", ref, ref+1), 14)) | ||
| 324 | else | 326 | else |
| 325 | if band(sn, 0x80000) ~= 0 then -- SNAP_SOFTFPNUM | 327 | local m, ot, op1, op2 = traceir(tr, ref) |
| 326 | out:write(colorize(format("%04d/%04d", ref, ref+1), 14)) | 328 | out:write(colorize(format("%04d", ref), band(ot, 31))) |
| 327 | else | ||
| 328 | local m, ot, op1, op2 = traceir(tr, ref) | ||
| 329 | out:write(colorize(format("%04d", ref), band(ot, 31))) | ||
| 330 | end | ||
| 331 | end | 329 | end |
| 332 | out:write(band(sn, 0x10000) == 0 and " " or "|") -- SNAP_FRAME | 330 | out:write(band(sn, 0x10000) == 0 and " " or "|") -- SNAP_FRAME |
| 333 | else | 331 | else |
diff --git a/src/lj_opt_split.c b/src/lj_opt_split.c index b9fae10f..07c52564 100644 --- a/src/lj_opt_split.c +++ b/src/lj_opt_split.c | |||
| @@ -255,8 +255,10 @@ static void split_ir(jit_State *J) | |||
| 255 | if (irm12->op1 > J->loopref && irl1->o == IR_CALLN && | 255 | if (irm12->op1 > J->loopref && irl1->o == IR_CALLN && |
| 256 | irl1->op2 == IRCALL_log2) { | 256 | irl1->op2 == IRCALL_log2) { |
| 257 | IRRef tmp = irl1->op1; /* Recycle first two args from LOG2. */ | 257 | IRRef tmp = irl1->op1; /* Recycle first two args from LOG2. */ |
| 258 | tmp = split_emit(J, IRT(IR_CARG, IRT_NIL), tmp, irm3->op2); | 258 | IRRef arg3 = irm3->op2, arg4 = irm4->op2; |
| 259 | tmp = split_emit(J, IRT(IR_CARG, IRT_NIL), tmp, irm4->op2); | 259 | J->cur.nins--; |
| 260 | tmp = split_emit(J, IRT(IR_CARG, IRT_NIL), tmp, arg3); | ||
| 261 | tmp = split_emit(J, IRT(IR_CARG, IRT_NIL), tmp, arg4); | ||
| 260 | ir->prev = tmp = split_emit(J, IRTI(IR_CALLN), tmp, IRCALL_pow); | 262 | ir->prev = tmp = split_emit(J, IRTI(IR_CALLN), tmp, IRCALL_pow); |
| 261 | hi = split_emit(J, IRT(IR_HIOP, LJ_SOFTFP), tmp, tmp); | 263 | hi = split_emit(J, IRT(IR_HIOP, LJ_SOFTFP), tmp, tmp); |
| 262 | break; | 264 | break; |
| @@ -278,7 +280,7 @@ static void split_ir(jit_State *J) | |||
| 278 | hisubst[ir->op1], hisubst[ir->op2]); | 280 | hisubst[ir->op1], hisubst[ir->op2]); |
| 279 | break; | 281 | break; |
| 280 | case IR_SLOAD: case IR_ALOAD: case IR_HLOAD: case IR_ULOAD: case IR_VLOAD: | 282 | case IR_SLOAD: case IR_ALOAD: case IR_HLOAD: case IR_ULOAD: case IR_VLOAD: |
| 281 | case IR_MIN: case IR_MAX: | 283 | case IR_MIN: case IR_MAX: case IR_STRTO: |
| 282 | hi = split_emit(J, IRT(IR_HIOP, IRT_SOFTFP), nref, nref); | 284 | hi = split_emit(J, IRT(IR_HIOP, IRT_SOFTFP), nref, nref); |
| 283 | break; | 285 | break; |
| 284 | case IR_XLOAD: | 286 | case IR_XLOAD: |
| @@ -581,7 +583,12 @@ static void split_ir(jit_State *J) | |||
| 581 | snap->ref = oir[snap->ref].prev; | 583 | snap->ref = oir[snap->ref].prev; |
| 582 | for (n = 0; n < nent; n++) { | 584 | for (n = 0; n < nent; n++) { |
| 583 | SnapEntry sn = map[n]; | 585 | SnapEntry sn = map[n]; |
| 584 | map[n] = ((sn & 0xffff0000) | oir[snap_ref(sn)].prev); | 586 | IRIns *ir = &oir[snap_ref(sn)]; |
| 587 | if (LJ_SOFTFP && (sn & SNAP_SOFTFPNUM) && irref_isk(snap_ref(sn))) | ||
| 588 | map[n] = ((sn & 0xffff0000) | | ||
| 589 | (IRRef1)lj_ir_k64(J, IR_KNUM, ir_knum(ir))); | ||
| 590 | else | ||
| 591 | map[n] = ((sn & 0xffff0000) | ir->prev); | ||
| 585 | } | 592 | } |
| 586 | } | 593 | } |
| 587 | } | 594 | } |
diff --git a/src/lj_snap.c b/src/lj_snap.c index 1af7ef85..5fc90d8c 100644 --- a/src/lj_snap.c +++ b/src/lj_snap.c | |||
| @@ -72,7 +72,7 @@ static MSize snapshot_slots(jit_State *J, SnapEntry *map, BCReg nslots) | |||
| 72 | (ir->op2 & (IRSLOAD_READONLY|IRSLOAD_PARENT)) != IRSLOAD_PARENT) | 72 | (ir->op2 & (IRSLOAD_READONLY|IRSLOAD_PARENT)) != IRSLOAD_PARENT) |
| 73 | sn |= SNAP_NORESTORE; | 73 | sn |= SNAP_NORESTORE; |
| 74 | } | 74 | } |
| 75 | if (LJ_SOFTFP && !irref_isk(ref) && irt_isnum(ir->t)) | 75 | if (LJ_SOFTFP && irt_isnum(ir->t)) |
| 76 | sn |= SNAP_SOFTFPNUM; | 76 | sn |= SNAP_SOFTFPNUM; |
| 77 | map[n++] = sn; | 77 | map[n++] = sn; |
| 78 | } | 78 | } |
| @@ -316,7 +316,8 @@ void lj_snap_regspmap(uint16_t *rsmap, GCtrace *T, SnapNo snapno, int hi) | |||
| 316 | for (n = 0; n < nent; n++) { | 316 | for (n = 0; n < nent; n++) { |
| 317 | SnapEntry sn = map[n]; | 317 | SnapEntry sn = map[n]; |
| 318 | IRRef ref = snap_ref(sn); | 318 | IRRef ref = snap_ref(sn); |
| 319 | if ((LJ_SOFTFP && hi) ? (ref++, (sn & SNAP_SOFTFPNUM)) : !irref_isk(ref)) { | 319 | if (!irref_isk(ref) && |
| 320 | ((LJ_SOFTFP && hi) ? (ref++, (sn & SNAP_SOFTFPNUM)) : 1)) { | ||
| 320 | IRIns *ir = &T->ir[ref]; | 321 | IRIns *ir = &T->ir[ref]; |
| 321 | uint32_t rs = ir->prev; | 322 | uint32_t rs = ir->prev; |
| 322 | if (bloomtest(rfilt, ref)) | 323 | if (bloomtest(rfilt, ref)) |
