]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
PPC: Add dispatch target for call hook.
authorMike Pall <mike>
Thu, 23 Sep 2010 00:42:29 +0000 (02:42 +0200)
committerMike Pall <mike>
Thu, 23 Sep 2010 00:42:29 +0000 (02:42 +0200)
src/buildvm_ppc.dasc

index a27591e5fe50ac0d2ba16bc03c8061bdab11f42d..e0eaa95bb5709805961ca9a5b8557958a38ddcc2 100644 (file)
@@ -1182,12 +1182,32 @@ static void build_subroutines(BuildCtx *ctx)
 #endif
   |
   |->vm_callhook:                      // Dispatch target for call hooks.
-  |  NYI
+  |  mr CARG2, PC
+#if LJ_HASJIT
+  |  b >1
+#endif
   |
   |->vm_hotcall:                       // Hot call counter underflow.
 #if LJ_HASJIT
-  |  NYI
+  |  ori CARG2, PC, 1
+  |1:
 #endif
+  |  add TMP0, BASE, RC
+  |   stw PC, SAVE_PC
+  |  mr CARG1, L
+  |   stw BASE, L->base
+  |  sub RA, RA, BASE
+  |   stw TMP0, L->top
+  |  bl extern lj_dispatch_call                // (lua_State *L, const BCIns *pc)
+  |  // Returns ASMFunction.
+  |  lwz BASE, L->base
+  |   lwz TMP0, L->top
+  |   stw ZERO, SAVE_PC                        // Invalidate for subsequent line hook.
+  |  sub NARGS8:RC, TMP0, BASE
+  |  add RA, BASE, RA
+  |  lwz LFUNC:RB, FRAME_FUNC(BASE)
+  |  mtctr CRET1
+  |  bctr
   |
   |//-----------------------------------------------------------------------
   |//-- Trace exit handler -------------------------------------------------