diff options
author | Mike Pall <mike> | 2011-05-16 02:38:07 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2011-05-16 02:38:07 +0200 |
commit | 1ac71f1fa8c0ad0c691ca7a2a96d74121b75ec9e (patch) | |
tree | d8e690b8533d11caa287daab113f22738347a7e4 /src/lj_snap.c | |
parent | be73a96751261bb3a424aa1c5d28547f23037733 (diff) | |
download | luajit-1ac71f1fa8c0ad0c691ca7a2a96d74121b75ec9e.tar.gz luajit-1ac71f1fa8c0ad0c691ca7a2a96d74121b75ec9e.tar.bz2 luajit-1ac71f1fa8c0ad0c691ca7a2a96d74121b75ec9e.zip |
ARM: Add LJ_SOFTFP define. Add support for soft-float slot handling.
Diffstat (limited to 'src/lj_snap.c')
-rw-r--r-- | src/lj_snap.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/lj_snap.c b/src/lj_snap.c index a3c081e1..e1791b51 100644 --- a/src/lj_snap.c +++ b/src/lj_snap.c | |||
@@ -72,6 +72,8 @@ 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)) | ||
76 | sn |= SNAP_SOFTFPNUM; | ||
75 | map[n++] = sn; | 77 | map[n++] = sn; |
76 | } | 78 | } |
77 | } | 79 | } |
@@ -386,9 +388,11 @@ const BCIns *lj_snap_restore(jit_State *J, void *exptr) | |||
386 | rs = snap_renameref(T, snapno, ref, rs); | 388 | rs = snap_renameref(T, snapno, ref, rs); |
387 | if (ra_hasspill(regsp_spill(rs))) { /* Restore from spill slot. */ | 389 | if (ra_hasspill(regsp_spill(rs))) { /* Restore from spill slot. */ |
388 | int32_t *sps = &ex->spill[regsp_spill(rs)]; | 390 | int32_t *sps = &ex->spill[regsp_spill(rs)]; |
389 | if (irt_isinteger(t)) { | 391 | if (LJ_SOFTFP && (sn & SNAP_SOFTFPNUM)) { |
392 | o->u32.lo = (uint32_t)*sps; | ||
393 | } else if (irt_isinteger(t)) { | ||
390 | setintV(o, *sps); | 394 | setintV(o, *sps); |
391 | } else if (irt_isnum(t)) { | 395 | } else if (!LJ_SOFTFP && irt_isnum(t)) { |
392 | o->u64 = *(uint64_t *)sps; | 396 | o->u64 = *(uint64_t *)sps; |
393 | #if LJ_64 | 397 | #if LJ_64 |
394 | } else if (irt_islightud(t)) { | 398 | } else if (irt_islightud(t)) { |
@@ -403,13 +407,12 @@ const BCIns *lj_snap_restore(jit_State *J, void *exptr) | |||
403 | } else { /* Restore from register. */ | 407 | } else { /* Restore from register. */ |
404 | Reg r = regsp_reg(rs); | 408 | Reg r = regsp_reg(rs); |
405 | lua_assert(ra_hasreg(r)); | 409 | lua_assert(ra_hasreg(r)); |
406 | if (irt_isinteger(t)) { | 410 | if (LJ_SOFTFP && (sn & SNAP_SOFTFPNUM)) { |
411 | o->u32.lo = (uint32_t)ex->gpr[r-RID_MIN_GPR]; | ||
412 | } else if (irt_isinteger(t)) { | ||
407 | setintV(o, (int32_t)ex->gpr[r-RID_MIN_GPR]); | 413 | setintV(o, (int32_t)ex->gpr[r-RID_MIN_GPR]); |
408 | } else if (irt_isnum(t)) { | 414 | } else if (!LJ_SOFTFP && irt_isnum(t)) { |
409 | if (RID_NUM_FPR) | 415 | setnumV(o, ex->fpr[r-RID_MIN_FPR]); |
410 | setnumV(o, ex->fpr[r-RID_MIN_FPR]); | ||
411 | else | ||
412 | setnumV(o, *(double *)&ex->gpr[r-RID_MIN_GPR]); | ||
413 | #if LJ_64 | 416 | #if LJ_64 |
414 | } else if (irt_islightud(t)) { | 417 | } else if (irt_islightud(t)) { |
415 | /* 64 bit lightuserdata which may escape already has the tag bits. */ | 418 | /* 64 bit lightuserdata which may escape already has the tag bits. */ |
@@ -421,6 +424,14 @@ const BCIns *lj_snap_restore(jit_State *J, void *exptr) | |||
421 | setitype(o, irt_toitype(t)); | 424 | setitype(o, irt_toitype(t)); |
422 | } | 425 | } |
423 | } | 426 | } |
427 | if (LJ_SOFTFP && (sn & SNAP_SOFTFPNUM)) { | ||
428 | rs = (ir+1)->prev; | ||
429 | if (LJ_UNLIKELY(bloomtest(rfilt, ref+1))) | ||
430 | rs = snap_renameref(T, snapno, ref+1, rs); | ||
431 | o->u32.hi = (ra_hasspill(regsp_spill(rs))) ? | ||
432 | (uint32_t)*&ex->spill[regsp_spill(rs)] : | ||
433 | (uint32_t)ex->gpr[regsp_reg(rs)-RID_MIN_GPR]; | ||
434 | } | ||
424 | } | 435 | } |
425 | } | 436 | } |
426 | switch (bc_op(*pc)) { | 437 | switch (bc_op(*pc)) { |