diff options
author | Mike Pall <mike> | 2010-09-23 02:38:39 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2010-09-23 02:41:06 +0200 |
commit | 493d0aa259428170c3da819b157dcdce5a1b5765 (patch) | |
tree | 2b00e8ef100c03b69f4dc2dfec484656fd44ac28 /src | |
parent | 6aedfa79196027b25d39986ea5f5e182e5f63497 (diff) | |
download | luajit-493d0aa259428170c3da819b157dcdce5a1b5765.tar.gz luajit-493d0aa259428170c3da819b157dcdce5a1b5765.tar.bz2 luajit-493d0aa259428170c3da819b157dcdce5a1b5765.zip |
PPC: Add dispatch targets for instruction and return hooks.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildvm_ppc.dasc | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/src/buildvm_ppc.dasc b/src/buildvm_ppc.dasc index 6f352bd3..a27591e5 100644 --- a/src/buildvm_ppc.dasc +++ b/src/buildvm_ppc.dasc | |||
@@ -1128,13 +1128,53 @@ static void build_subroutines(BuildCtx *ctx) | |||
1128 | #endif | 1128 | #endif |
1129 | | | 1129 | | |
1130 | |->vm_rethook: // Dispatch target for return hooks. | 1130 | |->vm_rethook: // Dispatch target for return hooks. |
1131 | | NYI | 1131 | | lbz TMP3, DISPATCH_GL(hookmask)(DISPATCH) |
1132 | | andi. TMP0, TMP3, HOOK_ACTIVE // Hook already active? | ||
1133 | | beq >1 | ||
1134 | |5: // Re-dispatch to static ins. | ||
1135 | | addi TMP1, TMP1, GG_DISP2STATIC // Assumes decode_OP4 TMP1, INS. | ||
1136 | | lwzx TMP0, DISPATCH, TMP1 | ||
1137 | | mtctr TMP0 | ||
1138 | | bctr | ||
1132 | | | 1139 | | |
1133 | |->vm_inshook: // Dispatch target for instr/line hooks. | 1140 | |->vm_inshook: // Dispatch target for instr/line hooks. |
1134 | | NYI | 1141 | | lbz TMP3, DISPATCH_GL(hookmask)(DISPATCH) |
1142 | | lwz TMP2, DISPATCH_GL(hookcount)(DISPATCH) | ||
1143 | | andi. TMP0, TMP3, HOOK_ACTIVE // Hook already active? | ||
1144 | | rlwinm TMP0, TMP3, 31-LUA_HOOKLINE, 31, 0 | ||
1145 | | bne <5 | ||
1146 | | | ||
1147 | | cmpwi cr1, TMP0, 0 | ||
1148 | | addic. TMP2, TMP2, -1 | ||
1149 | | beq cr1, <5 | ||
1150 | | stw TMP2, DISPATCH_GL(hookcount)(DISPATCH) | ||
1151 | | beq >1 | ||
1152 | | bge cr1, <5 | ||
1153 | |1: | ||
1154 | | mr CARG1, L | ||
1155 | | stw MULTRES, SAVE_MULTRES | ||
1156 | | mr CARG2, PC | ||
1157 | | stw BASE, L->base | ||
1158 | | // SAVE_PC must hold the _previous_ PC. The callee updates it with PC. | ||
1159 | | bl extern lj_dispatch_ins // (lua_State *L, const BCIns *pc) | ||
1160 | |3: | ||
1161 | | lwz BASE, L->base | ||
1162 | |4: // Re-dispatch to static ins. | ||
1163 | | lwz INS, -4(PC) | ||
1164 | | decode_OP4 TMP1, INS | ||
1165 | | decode_RB8 RB, INS | ||
1166 | | addi TMP1, TMP1, GG_DISP2STATIC | ||
1167 | | decode_RD8 RD, INS | ||
1168 | | lwzx TMP0, DISPATCH, TMP1 | ||
1169 | | decode_RA8 RA, INS | ||
1170 | | decode_RC8 RC, INS | ||
1171 | | mtctr TMP0 | ||
1172 | | bctr | ||
1135 | | | 1173 | | |
1136 | |->cont_hook: // Continue from hook yield. | 1174 | |->cont_hook: // Continue from hook yield. |
1137 | | NYI | 1175 | | addi PC, PC, 4 |
1176 | | lwz MULTRES, -20(RB) // Restore MULTRES for *M ins. | ||
1177 | | b <4 | ||
1138 | | | 1178 | | |
1139 | |->vm_hotloop: // Hot loop counter underflow. | 1179 | |->vm_hotloop: // Hot loop counter underflow. |
1140 | #if LJ_HASJIT | 1180 | #if LJ_HASJIT |