Use a different marker for hot calls.

This commit is contained in:
Mike Pall 2010-02-15 18:04:06 +01:00
parent 3452bfcf8c
commit e1905f498a
5 changed files with 1101 additions and 1085 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2518,14 +2518,15 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
#endif #endif
| |
|->vm_callhook: // Dispatch target for call hooks. |->vm_callhook: // Dispatch target for call hooks.
| mov SAVE_PC, PC
#if LJ_HASJIT #if LJ_HASJIT
| mov aword [DISPATCH+DISPATCH_J(L)], 0 // Marker for call hook.
| jmp >1 | jmp >1
#endif #endif
| |
|->vm_hotcall: // Hot call counter underflow. |->vm_hotcall: // Hot call counter underflow.
#if LJ_HASJIT #if LJ_HASJIT
| mov aword [DISPATCH+DISPATCH_J(L)], L:RBa | mov SAVE_PC, PC
| or PC, 1 // Marker for hot call.
|1: |1:
#endif #endif
| lea RD, [BASE+NARGS:RD*8-8] | lea RD, [BASE+NARGS:RD*8-8]
@ -2534,10 +2535,12 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
| mov L:RB->top, RD | mov L:RB->top, RD
| mov FCARG2, PC | mov FCARG2, PC
| mov FCARG1, L:RB | mov FCARG1, L:RB
| mov SAVE_PC, PC
| call extern lj_dispatch_call@8 // (lua_State *L, const BCIns *pc) | call extern lj_dispatch_call@8 // (lua_State *L, const BCIns *pc)
| // ASMFunction returned in eax/rax (RDa). | // ASMFunction returned in eax/rax (RDa).
| mov SAVE_PC, 0 // Invalidate for subsequent line hook. | mov SAVE_PC, 0 // Invalidate for subsequent line hook.
#if LJ_HASJIT
| and PC, -2
#endif
| mov BASE, L:RB->base | mov BASE, L:RB->base
| mov RAa, RDa | mov RAa, RDa
| mov RD, L:RB->top | mov RD, L:RB->top

File diff suppressed because it is too large Load Diff

View File

@ -409,8 +409,9 @@ ASMFunction LJ_FASTCALL lj_dispatch_call(lua_State *L, const BCIns *pc)
#endif #endif
call_init(L, fn); call_init(L, fn);
#if LJ_HASJIT #if LJ_HASJIT
if (J->L) { /* Marker for hot call. */ if ((uintptr_t)pc & 1) { /* Marker for hot call. */
lj_trace_hot(J, pc); J->L = L;
lj_trace_hot(J, (const BCIns *)((uintptr_t)pc & ~(uintptr_t)1));
goto out; goto out;
} }
#endif #endif