diff options
Diffstat (limited to '')
-rw-r--r-- | src/lj_asm_x86.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/lj_asm_x86.h b/src/lj_asm_x86.h index 0361a965..83fe22b2 100644 --- a/src/lj_asm_x86.h +++ b/src/lj_asm_x86.h | |||
@@ -348,7 +348,8 @@ static Reg asm_fuseload(ASMState *as, IRRef ref, RegSet allow) | |||
348 | if (!(ir->op2 & (IRSLOAD_PARENT|IRSLOAD_CONVERT)) && | 348 | if (!(ir->op2 & (IRSLOAD_PARENT|IRSLOAD_CONVERT)) && |
349 | noconflict(as, ref, IR_RETF, 0)) { | 349 | noconflict(as, ref, IR_RETF, 0)) { |
350 | as->mrm.base = (uint8_t)ra_alloc1(as, REF_BASE, xallow); | 350 | as->mrm.base = (uint8_t)ra_alloc1(as, REF_BASE, xallow); |
351 | as->mrm.ofs = 8*((int32_t)ir->op1-1) + ((ir->op2&IRSLOAD_FRAME)?4:0); | 351 | as->mrm.ofs = 8*((int32_t)ir->op1-1-LJ_FR2) + |
352 | (!LJ_FR2 && (ir->op2 & IRSLOAD_FRAME) ? 4 : 0); | ||
352 | as->mrm.idx = RID_NONE; | 353 | as->mrm.idx = RID_NONE; |
353 | return RID_MRM; | 354 | return RID_MRM; |
354 | } | 355 | } |
@@ -655,6 +656,9 @@ static void asm_callx(ASMState *as, IRIns *ir) | |||
655 | static void asm_retf(ASMState *as, IRIns *ir) | 656 | static void asm_retf(ASMState *as, IRIns *ir) |
656 | { | 657 | { |
657 | Reg base = ra_alloc1(as, REF_BASE, RSET_GPR); | 658 | Reg base = ra_alloc1(as, REF_BASE, RSET_GPR); |
659 | #if LJ_FR2 | ||
660 | Reg rpc = ra_scratch(as, rset_exclude(RSET_GPR, base)); | ||
661 | #endif | ||
658 | void *pc = ir_kptr(IR(ir->op2)); | 662 | void *pc = ir_kptr(IR(ir->op2)); |
659 | int32_t delta = 1+LJ_FR2+bc_a(*((const BCIns *)pc - 1)); | 663 | int32_t delta = 1+LJ_FR2+bc_a(*((const BCIns *)pc - 1)); |
660 | as->topslot -= (BCReg)delta; | 664 | as->topslot -= (BCReg)delta; |
@@ -663,7 +667,12 @@ static void asm_retf(ASMState *as, IRIns *ir) | |||
663 | emit_setgl(as, base, jit_base); | 667 | emit_setgl(as, base, jit_base); |
664 | emit_addptr(as, base, -8*delta); | 668 | emit_addptr(as, base, -8*delta); |
665 | asm_guardcc(as, CC_NE); | 669 | asm_guardcc(as, CC_NE); |
670 | #if LJ_FR2 | ||
671 | emit_rmro(as, XO_CMP, rpc, base, -8); | ||
672 | emit_loadu64(as, rpc, u64ptr(pc)); | ||
673 | #else | ||
666 | emit_gmroi(as, XG_ARITHi(XOg_CMP), base, -4, ptr2addr(pc)); | 674 | emit_gmroi(as, XG_ARITHi(XOg_CMP), base, -4, ptr2addr(pc)); |
675 | #endif | ||
667 | } | 676 | } |
668 | 677 | ||
669 | /* -- Type conversions ---------------------------------------------------- */ | 678 | /* -- Type conversions ---------------------------------------------------- */ |
@@ -1397,7 +1406,8 @@ static void asm_ahustore(ASMState *as, IRIns *ir) | |||
1397 | 1406 | ||
1398 | static void asm_sload(ASMState *as, IRIns *ir) | 1407 | static void asm_sload(ASMState *as, IRIns *ir) |
1399 | { | 1408 | { |
1400 | int32_t ofs = 8*((int32_t)ir->op1-1) + ((ir->op2 & IRSLOAD_FRAME) ? 4 : 0); | 1409 | int32_t ofs = 8*((int32_t)ir->op1-1-LJ_FR2) + |
1410 | (!LJ_FR2 && (ir->op2 & IRSLOAD_FRAME) ? 4 : 0); | ||
1401 | IRType1 t = ir->t; | 1411 | IRType1 t = ir->t; |
1402 | Reg base; | 1412 | Reg base; |
1403 | lua_assert(!(ir->op2 & IRSLOAD_PARENT)); /* Handled by asm_head_side(). */ | 1413 | lua_assert(!(ir->op2 & IRSLOAD_PARENT)); /* Handled by asm_head_side(). */ |
@@ -2383,13 +2393,15 @@ static void asm_stack_check(ASMState *as, BCReg topslot, | |||
2383 | static void asm_stack_restore(ASMState *as, SnapShot *snap) | 2393 | static void asm_stack_restore(ASMState *as, SnapShot *snap) |
2384 | { | 2394 | { |
2385 | SnapEntry *map = &as->T->snapmap[snap->mapofs]; | 2395 | SnapEntry *map = &as->T->snapmap[snap->mapofs]; |
2386 | SnapEntry *flinks = &as->T->snapmap[snap_nextofs(as->T, snap)-1]; | 2396 | #if !LJ_FR2 || defined(LUA_USE_ASSERT) |
2397 | SnapEntry *flinks = &as->T->snapmap[snap_nextofs(as->T, snap)-1-LJ_FR2]; | ||
2398 | #endif | ||
2387 | MSize n, nent = snap->nent; | 2399 | MSize n, nent = snap->nent; |
2388 | /* Store the value of all modified slots to the Lua stack. */ | 2400 | /* Store the value of all modified slots to the Lua stack. */ |
2389 | for (n = 0; n < nent; n++) { | 2401 | for (n = 0; n < nent; n++) { |
2390 | SnapEntry sn = map[n]; | 2402 | SnapEntry sn = map[n]; |
2391 | BCReg s = snap_slot(sn); | 2403 | BCReg s = snap_slot(sn); |
2392 | int32_t ofs = 8*((int32_t)s-1); | 2404 | int32_t ofs = 8*((int32_t)s-1-LJ_FR2); |
2393 | IRRef ref = snap_ref(sn); | 2405 | IRRef ref = snap_ref(sn); |
2394 | IRIns *ir = IR(ref); | 2406 | IRIns *ir = IR(ref); |
2395 | if ((sn & SNAP_NORESTORE)) | 2407 | if ((sn & SNAP_NORESTORE)) |
@@ -2407,8 +2419,10 @@ static void asm_stack_restore(ASMState *as, SnapShot *snap) | |||
2407 | emit_movmroi(as, RID_BASE, ofs, ir->i); | 2419 | emit_movmroi(as, RID_BASE, ofs, ir->i); |
2408 | } | 2420 | } |
2409 | if ((sn & (SNAP_CONT|SNAP_FRAME))) { | 2421 | if ((sn & (SNAP_CONT|SNAP_FRAME))) { |
2422 | #if !LJ_FR2 | ||
2410 | if (s != 0) /* Do not overwrite link to previous frame. */ | 2423 | if (s != 0) /* Do not overwrite link to previous frame. */ |
2411 | emit_movmroi(as, RID_BASE, ofs+4, (int32_t)(*flinks--)); | 2424 | emit_movmroi(as, RID_BASE, ofs+4, (int32_t)(*flinks--)); |
2425 | #endif | ||
2412 | } else { | 2426 | } else { |
2413 | if (!(LJ_64 && irt_islightud(ir->t))) | 2427 | if (!(LJ_64 && irt_islightud(ir->t))) |
2414 | emit_movmroi(as, RID_BASE, ofs+4, irt_toitype(ir->t)); | 2428 | emit_movmroi(as, RID_BASE, ofs+4, irt_toitype(ir->t)); |