diff options
Diffstat (limited to '')
-rw-r--r-- | src/lj_dispatch.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lj_dispatch.c b/src/lj_dispatch.c index bf8d8812..7b73d3dd 100644 --- a/src/lj_dispatch.c +++ b/src/lj_dispatch.c | |||
@@ -68,6 +68,8 @@ void lj_dispatch_init(GG_State *GG) | |||
68 | /* The JIT engine is off by default. luaopen_jit() turns it on. */ | 68 | /* The JIT engine is off by default. luaopen_jit() turns it on. */ |
69 | disp[BC_FORL] = disp[BC_IFORL]; | 69 | disp[BC_FORL] = disp[BC_IFORL]; |
70 | disp[BC_ITERL] = disp[BC_IITERL]; | 70 | disp[BC_ITERL] = disp[BC_IITERL]; |
71 | /* Workaround for stable v2.1 bytecode. TODO: Replace with BC_IITERN. */ | ||
72 | disp[BC_ITERN] = &lj_vm_IITERN; | ||
71 | disp[BC_LOOP] = disp[BC_ILOOP]; | 73 | disp[BC_LOOP] = disp[BC_ILOOP]; |
72 | disp[BC_FUNCF] = disp[BC_IFUNCF]; | 74 | disp[BC_FUNCF] = disp[BC_IFUNCF]; |
73 | disp[BC_FUNCV] = disp[BC_IFUNCV]; | 75 | disp[BC_FUNCV] = disp[BC_IFUNCV]; |
@@ -118,19 +120,21 @@ void lj_dispatch_update(global_State *g) | |||
118 | mode |= (g->hookmask & LUA_MASKRET) ? DISPMODE_RET : 0; | 120 | mode |= (g->hookmask & LUA_MASKRET) ? DISPMODE_RET : 0; |
119 | if (oldmode != mode) { /* Mode changed? */ | 121 | if (oldmode != mode) { /* Mode changed? */ |
120 | ASMFunction *disp = G2GG(g)->dispatch; | 122 | ASMFunction *disp = G2GG(g)->dispatch; |
121 | ASMFunction f_forl, f_iterl, f_loop, f_funcf, f_funcv; | 123 | ASMFunction f_forl, f_iterl, f_itern, f_loop, f_funcf, f_funcv; |
122 | g->dispatchmode = mode; | 124 | g->dispatchmode = mode; |
123 | 125 | ||
124 | /* Hotcount if JIT is on, but not while recording. */ | 126 | /* Hotcount if JIT is on, but not while recording. */ |
125 | if ((mode & (DISPMODE_JIT|DISPMODE_REC)) == DISPMODE_JIT) { | 127 | if ((mode & (DISPMODE_JIT|DISPMODE_REC)) == DISPMODE_JIT) { |
126 | f_forl = makeasmfunc(lj_bc_ofs[BC_FORL]); | 128 | f_forl = makeasmfunc(lj_bc_ofs[BC_FORL]); |
127 | f_iterl = makeasmfunc(lj_bc_ofs[BC_ITERL]); | 129 | f_iterl = makeasmfunc(lj_bc_ofs[BC_ITERL]); |
130 | f_itern = makeasmfunc(lj_bc_ofs[BC_ITERN]); | ||
128 | f_loop = makeasmfunc(lj_bc_ofs[BC_LOOP]); | 131 | f_loop = makeasmfunc(lj_bc_ofs[BC_LOOP]); |
129 | f_funcf = makeasmfunc(lj_bc_ofs[BC_FUNCF]); | 132 | f_funcf = makeasmfunc(lj_bc_ofs[BC_FUNCF]); |
130 | f_funcv = makeasmfunc(lj_bc_ofs[BC_FUNCV]); | 133 | f_funcv = makeasmfunc(lj_bc_ofs[BC_FUNCV]); |
131 | } else { /* Otherwise use the non-hotcounting instructions. */ | 134 | } else { /* Otherwise use the non-hotcounting instructions. */ |
132 | f_forl = disp[GG_LEN_DDISP+BC_IFORL]; | 135 | f_forl = disp[GG_LEN_DDISP+BC_IFORL]; |
133 | f_iterl = disp[GG_LEN_DDISP+BC_IITERL]; | 136 | f_iterl = disp[GG_LEN_DDISP+BC_IITERL]; |
137 | f_itern = &lj_vm_IITERN; | ||
134 | f_loop = disp[GG_LEN_DDISP+BC_ILOOP]; | 138 | f_loop = disp[GG_LEN_DDISP+BC_ILOOP]; |
135 | f_funcf = makeasmfunc(lj_bc_ofs[BC_IFUNCF]); | 139 | f_funcf = makeasmfunc(lj_bc_ofs[BC_IFUNCF]); |
136 | f_funcv = makeasmfunc(lj_bc_ofs[BC_IFUNCV]); | 140 | f_funcv = makeasmfunc(lj_bc_ofs[BC_IFUNCV]); |
@@ -138,6 +142,7 @@ void lj_dispatch_update(global_State *g) | |||
138 | /* Init static counting instruction dispatch first (may be copied below). */ | 142 | /* Init static counting instruction dispatch first (may be copied below). */ |
139 | disp[GG_LEN_DDISP+BC_FORL] = f_forl; | 143 | disp[GG_LEN_DDISP+BC_FORL] = f_forl; |
140 | disp[GG_LEN_DDISP+BC_ITERL] = f_iterl; | 144 | disp[GG_LEN_DDISP+BC_ITERL] = f_iterl; |
145 | disp[GG_LEN_DDISP+BC_ITERN] = f_itern; | ||
141 | disp[GG_LEN_DDISP+BC_LOOP] = f_loop; | 146 | disp[GG_LEN_DDISP+BC_LOOP] = f_loop; |
142 | 147 | ||
143 | /* Set dynamic instruction dispatch. */ | 148 | /* Set dynamic instruction dispatch. */ |
@@ -165,6 +170,7 @@ void lj_dispatch_update(global_State *g) | |||
165 | /* Otherwise set dynamic counting ins. */ | 170 | /* Otherwise set dynamic counting ins. */ |
166 | disp[BC_FORL] = f_forl; | 171 | disp[BC_FORL] = f_forl; |
167 | disp[BC_ITERL] = f_iterl; | 172 | disp[BC_ITERL] = f_iterl; |
173 | disp[BC_ITERN] = f_itern; | ||
168 | disp[BC_LOOP] = f_loop; | 174 | disp[BC_LOOP] = f_loop; |
169 | /* Set dynamic return dispatch. */ | 175 | /* Set dynamic return dispatch. */ |
170 | if ((mode & DISPMODE_RET)) { | 176 | if ((mode & DISPMODE_RET)) { |