diff options
| author | Mike Pall <mike> | 2011-04-13 02:24:18 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2011-04-13 02:24:18 +0200 |
| commit | 7aa7069271d6794d49de5dd280a6b0b1bbf3e8e2 (patch) | |
| tree | 4e680fe730630b534b156fac88f157a1c46ee81f | |
| parent | 46d97d28f0ecf273375844f072c6f0a3e66e9ec5 (diff) | |
| download | luajit-7aa7069271d6794d49de5dd280a6b0b1bbf3e8e2.tar.gz luajit-7aa7069271d6794d49de5dd280a6b0b1bbf3e8e2.tar.bz2 luajit-7aa7069271d6794d49de5dd280a6b0b1bbf3e8e2.zip | |
ARM: Add dispatch targets for hooks.
| -rw-r--r-- | src/buildvm_arm.dasc | 67 |
1 files changed, 62 insertions, 5 deletions
diff --git a/src/buildvm_arm.dasc b/src/buildvm_arm.dasc index 321c4f3a..def37ecb 100644 --- a/src/buildvm_arm.dasc +++ b/src/buildvm_arm.dasc | |||
| @@ -1569,13 +1569,48 @@ static void build_subroutines(BuildCtx *ctx) | |||
| 1569 | #endif | 1569 | #endif |
| 1570 | | | 1570 | | |
| 1571 | |->vm_rethook: // Dispatch target for return hooks. | 1571 | |->vm_rethook: // Dispatch target for return hooks. |
| 1572 | | NYI | 1572 | | ldrb CARG1, [DISPATCH, #DISPATCH_GL(hookmask)] |
| 1573 | | tst CARG1, #HOOK_ACTIVE // Hook already active? | ||
| 1574 | | beq >1 | ||
| 1575 | |5: // Re-dispatch to static ins. | ||
| 1576 | | decode_OP OP, INS | ||
| 1577 | | add OP, DISPATCH, OP, lsl #2 | ||
| 1578 | | ldr pc, [OP, #GG_DISP2STATIC] | ||
| 1573 | | | 1579 | | |
| 1574 | |->vm_inshook: // Dispatch target for instr/line hooks. | 1580 | |->vm_inshook: // Dispatch target for instr/line hooks. |
| 1575 | | NYI | 1581 | | ldrb CARG1, [DISPATCH, #DISPATCH_GL(hookmask)] |
| 1582 | | ldr CARG2, [DISPATCH, #DISPATCH_GL(hookcount)] | ||
| 1583 | | tst CARG1, #HOOK_ACTIVE // Hook already active? | ||
| 1584 | | bne <5 | ||
| 1585 | | tst CARG1, #LUA_MASKLINE|LUA_MASKCOUNT | ||
| 1586 | | beq <5 | ||
| 1587 | | subs CARG2, CARG2, #1 | ||
| 1588 | | str CARG2, [DISPATCH, #DISPATCH_GL(hookcount)] | ||
| 1589 | | beq >1 | ||
| 1590 | | tst CARG1, #LUA_MASKLINE | ||
| 1591 | | beq <5 | ||
| 1592 | |1: | ||
| 1593 | | mov CARG1, L | ||
| 1594 | | str BASE, L->base | ||
| 1595 | | mov CARG2, PC | ||
| 1596 | | // SAVE_PC must hold the _previous_ PC. The callee updates it with PC. | ||
| 1597 | | bl extern lj_dispatch_ins // (lua_State *L, const BCIns *pc) | ||
| 1598 | |3: | ||
| 1599 | | ldr BASE, L->base | ||
| 1600 | |4: // Re-dispatch to static ins. | ||
| 1601 | | ldrb OP, [PC, #-4] | ||
| 1602 | | ldr INS, [PC, #-4] | ||
| 1603 | | add OP, DISPATCH, OP, lsl #2 | ||
| 1604 | | ldr OP, [OP, #GG_DISP2STATIC] | ||
| 1605 | | decode_RA8 RA, INS | ||
| 1606 | | decode_RD RC, INS | ||
| 1607 | | bx OP | ||
| 1576 | | | 1608 | | |
| 1577 | |->cont_hook: // Continue from hook yield. | 1609 | |->cont_hook: // Continue from hook yield. |
| 1578 | | NYI | 1610 | | ldr CARG1, [CARG4, #-24] |
| 1611 | | add PC, PC, #4 | ||
| 1612 | | str CARG1, SAVE_MULTRES // Restore MULTRES for *M ins. | ||
| 1613 | | b <4 | ||
| 1579 | | | 1614 | | |
| 1580 | |->vm_hotloop: // Hot loop counter underflow. | 1615 | |->vm_hotloop: // Hot loop counter underflow. |
| 1581 | #if LJ_HASJIT | 1616 | #if LJ_HASJIT |
| @@ -1583,10 +1618,32 @@ static void build_subroutines(BuildCtx *ctx) | |||
| 1583 | #endif | 1618 | #endif |
| 1584 | | | 1619 | | |
| 1585 | |->vm_callhook: // Dispatch target for call hooks. | 1620 | |->vm_callhook: // Dispatch target for call hooks. |
| 1586 | | NYI | 1621 | | mov CARG2, PC |
| 1622 | #if LJ_HASJIT | ||
| 1623 | | b >1 | ||
| 1624 | #endif | ||
| 1587 | | | 1625 | | |
| 1588 | |->vm_hotcall: // Hot call counter underflow. | 1626 | |->vm_hotcall: // Hot call counter underflow. |
| 1589 | | NYI | 1627 | #if LJ_HASJIT |
| 1628 | | orr CARG2, PC, #1 | ||
| 1629 | |1: | ||
| 1630 | #endif | ||
| 1631 | | add CARG4, BASE, RC | ||
| 1632 | | str PC, SAVE_PC | ||
| 1633 | | mov CARG1, L | ||
| 1634 | | str BASE, L->base | ||
| 1635 | | sub RA, RA, BASE | ||
| 1636 | | str CARG4, L->top | ||
| 1637 | | bl extern lj_dispatch_call // (lua_State *L, const BCIns *pc) | ||
| 1638 | | // Returns ASMFunction. | ||
| 1639 | | ldr BASE, L->base | ||
| 1640 | | ldr CARG4, L->top | ||
| 1641 | | mov CARG2, #0 | ||
| 1642 | | add RA, BASE, RA | ||
| 1643 | | sub NARGS8:RC, CARG4, BASE | ||
| 1644 | | str CARG2, SAVE_PC // Invalidate for subsequent line hook. | ||
| 1645 | | ldr LFUNC:CARG3, [BASE, FRAME_FUNC] | ||
| 1646 | | bx CRET1 | ||
| 1590 | | | 1647 | | |
| 1591 | |//----------------------------------------------------------------------- | 1648 | |//----------------------------------------------------------------------- |
| 1592 | |//-- Trace exit handler ------------------------------------------------- | 1649 | |//-- Trace exit handler ------------------------------------------------- |
