diff options
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) | |||
34 | disp[BC_LOOP] = disp[BC_ILOOP]; | 34 | disp[BC_LOOP] = disp[BC_ILOOP]; |
35 | } | 35 | } |
36 | 36 | ||
37 | #if LJ_HASJIT | ||
38 | /* Initialize hotcount table. */ | ||
39 | void lj_dispatch_init_hotcount(global_State *g) | ||
40 | { | ||
41 | HotCount start = (HotCount)G2J(g)->param[JIT_P_hotloop]; | ||
42 | HotCount *hotcount = G2GG(g)->hotcount; | ||
43 | uint32_t i; | ||
44 | for (i = 0; i < HOTCOUNT_SIZE; i++) | ||
45 | hotcount[i] = start; | ||
46 | } | ||
47 | #endif | ||
48 | |||
37 | /* Update dispatch table depending on various flags. */ | 49 | /* Update dispatch table depending on various flags. */ |
38 | void lj_dispatch_update(global_State *g) | 50 | void lj_dispatch_update(global_State *g) |
39 | { | 51 | { |
@@ -77,6 +89,10 @@ void lj_dispatch_update(global_State *g) | |||
77 | disp[BC_ITERL] = f_iterl; | 89 | disp[BC_ITERL] = f_iterl; |
78 | disp[BC_LOOP] = f_loop; | 90 | disp[BC_LOOP] = f_loop; |
79 | } | 91 | } |
92 | #if LJ_HASJIT | ||
93 | if ((mode & 1) && !(oldmode & 1)) /* JIT off to on transition. */ | ||
94 | lj_dispatch_init_hotcount(g); | ||
95 | #endif | ||
80 | } | 96 | } |
81 | } | 97 | } |
82 | 98 | ||