diff options
author | Mike Pall <mike> | 2010-02-04 20:40:00 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2010-02-04 20:40:00 +0100 |
commit | 5d2690c6084d09ed6f5bb9cdb4fc5113bb4fa512 (patch) | |
tree | 8e18b1f103b3c8bd99c34d70cb678cc2772ca8c3 /src/lj_dispatch.c | |
parent | 7256690364a2c9a5e9269ffd89bc132ee188480d (diff) | |
download | luajit2-5d2690c6084d09ed6f5bb9cdb4fc5113bb4fa512.tar.gz |
Reset the hotcount table after a JIT off to on transition.
Diffstat (limited to 'src/lj_dispatch.c')
-rw-r--r-- | src/lj_dispatch.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lj_dispatch.c b/src/lj_dispatch.c index 1e5b574c..a94afea9 100644 --- a/src/lj_dispatch.c +++ b/src/lj_dispatch.c @@ -34,6 +34,18 @@ void lj_dispatch_init(GG_State *GG) disp[BC_LOOP] = disp[BC_ILOOP]; } +#if LJ_HASJIT +/* Initialize hotcount table. */ +void lj_dispatch_init_hotcount(global_State *g) +{ + HotCount start = (HotCount)G2J(g)->param[JIT_P_hotloop]; + HotCount *hotcount = G2GG(g)->hotcount; + uint32_t i; + for (i = 0; i < HOTCOUNT_SIZE; i++) + hotcount[i] = start; +} +#endif + /* Update dispatch table depending on various flags. */ void lj_dispatch_update(global_State *g) { @@ -77,6 +89,10 @@ void lj_dispatch_update(global_State *g) disp[BC_ITERL] = f_iterl; disp[BC_LOOP] = f_loop; } +#if LJ_HASJIT + if ((mode & 1) && !(oldmode & 1)) /* JIT off to on transition. */ + lj_dispatch_init_hotcount(g); +#endif } } |