Add low-overhead profiler. Part 1: interpreter, low-level C API.

This commit is contained in:
Mike Pall
2013-09-02 01:49:19 +02:00
parent 19c2dd17db
commit 4dce22c40d
18 changed files with 558 additions and 33 deletions

View File

@@ -2010,6 +2010,20 @@ static void build_subroutines(BuildCtx *ctx)
| lw LFUNC:RB, FRAME_FUNC(BASE)
| jr CRET1
|. lw INS, -4(PC)
|
|->vm_profhook: // Dispatch target for profiler hook.
#if LJ_HASPROFILE
| load_got lj_dispatch_profile
| sw MULTRES, SAVE_MULTRES
| move CARG2, PC
| sw BASE, L->base
| call_intern lj_dispatch_profile // (lua_State *L, const BCIns *pc)
|. move CARG1, L
| // HOOK_PROFILE is off again, so re-dispatch to dynamic instruction.
| addiu PC, PC, -4
| b ->cont_nop
|. lw BASE, L->base
#endif
|
|//-----------------------------------------------------------------------
|//-- Trace exit handler -------------------------------------------------