aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2010-02-05 20:15:01 +0100
committerMike Pall <mike>2010-02-05 20:15:01 +0100
commitc4dadf1d67b5f91e7b80d92859eb85ae080f41f0 (patch)
tree2cd0b4a39eac8fad887b530c7727a10b39065078 /src
parenta0914c409b615af85eafb7e2787be628483ffde2 (diff)
downloadluajit-c4dadf1d67b5f91e7b80d92859eb85ae080f41f0.tar.gz
luajit-c4dadf1d67b5f91e7b80d92859eb85ae080f41f0.tar.bz2
luajit-c4dadf1d67b5f91e7b80d92859eb85ae080f41f0.zip
Move bytecode offsets from lj_vm.* to generated header.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile9
-rw-r--r--src/Makefile.dep24
-rw-r--r--src/buildvm.c16
-rw-r--r--src/buildvm.h3
-rw-r--r--src/buildvm_asm.c20
-rw-r--r--src/buildvm_peobj.c23
-rw-r--r--src/lj_bc.c2
-rw-r--r--src/lj_bc.h1
-rw-r--r--src/lj_dispatch.c8
-rw-r--r--src/lj_vm.h4
-rw-r--r--src/msvcbuild.bat1
11 files changed, 49 insertions, 62 deletions
diff --git a/src/Makefile b/src/Makefile
index da9d143b..e3a3fbc2 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -279,7 +279,8 @@ LUAJIT_SO= libluajit.so
279LUAJIT_T= luajit 279LUAJIT_T= luajit
280 280
281ALL_T= $(LUAJIT_T) $(LUAJIT_A) $(LUAJIT_SO) $(BUILDVM_T) 281ALL_T= $(LUAJIT_T) $(LUAJIT_A) $(LUAJIT_SO) $(BUILDVM_T)
282ALL_GEN= $(LJVM_S) lj_ffdef.h lj_libdef.h lj_recdef.h $(LIB_VMDEFP) lj_folddef.h 282ALL_GEN= $(LJVM_S) lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h \
283 $(LIB_VMDEFP) lj_folddef.h
283ALL_DYNGEN= buildvm_*.h 284ALL_DYNGEN= buildvm_*.h
284WIN_RM= *.obj *.lib *.exp *.dll *.exe *.manifest *.pdb *.ilk 285WIN_RM= *.obj *.lib *.exp *.dll *.exe *.manifest *.pdb *.ilk
285ALL_RM= $(ALL_T) $(ALL_GEN) *.o $(WIN_RM) 286ALL_RM= $(ALL_T) $(ALL_GEN) *.o $(WIN_RM)
@@ -365,6 +366,7 @@ distclean: clean
365 $(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_X64WIN) -o buildvm_x64win.h buildvm_x86.dasc 366 $(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_X64WIN) -o buildvm_x64win.h buildvm_x86.dasc
366 367
367depend: 368depend:
369 @test -f lj_bcdef.h || touch lj_bcdef.h
368 @test -f lj_ffdef.h || touch lj_ffdef.h 370 @test -f lj_ffdef.h || touch lj_ffdef.h
369 @test -f lj_libdef.h || touch lj_libdef.h 371 @test -f lj_libdef.h || touch lj_libdef.h
370 @test -f lj_recdef.h || touch lj_recdef.h 372 @test -f lj_recdef.h || touch lj_recdef.h
@@ -373,6 +375,7 @@ depend:
373 @test -f buildvm_x64.h || touch buildvm_x64.h 375 @test -f buildvm_x64.h || touch buildvm_x64.h
374 @test -f buildvm_x64win.h || touch buildvm_x64win.h 376 @test -f buildvm_x64win.h || touch buildvm_x64win.h
375 @$(HOST_CC) $(HOST_ACFLAGS) -MM *.c | sed "s|$(DASM_DIR)|\$$(DASM_DIR)|g" >Makefile.dep 377 @$(HOST_CC) $(HOST_ACFLAGS) -MM *.c | sed "s|$(DASM_DIR)|\$$(DASM_DIR)|g" >Makefile.dep
378 @test -s lj_bcdef.h || $(HOST_RM) lj_bcdef.h
376 @test -s lj_ffdef.h || $(HOST_RM) lj_ffdef.h 379 @test -s lj_ffdef.h || $(HOST_RM) lj_ffdef.h
377 @test -s lj_libdef.h || $(HOST_RM) lj_libdef.h 380 @test -s lj_libdef.h || $(HOST_RM) lj_libdef.h
378 @test -s lj_recdef.h || $(HOST_RM) lj_recdef.h 381 @test -s lj_recdef.h || $(HOST_RM) lj_recdef.h
@@ -409,6 +412,10 @@ $(LJVM_BOUT): $(BUILDVM_T)
409 $(E) "BUILDVM $@" 412 $(E) "BUILDVM $@"
410 $(Q)$(BUILDVM_X) -m $(LJVM_MODE) -o $@ 413 $(Q)$(BUILDVM_X) -m $(LJVM_MODE) -o $@
411 414
415lj_bcdef.h: $(BUILDVM_T)
416 $(E) "BUILDVM $@"
417 $(Q)$(BUILDVM_X) -m bcdef -o $@
418
412lj_ffdef.h: $(BUILDVM_T) $(LJLIB_C) 419lj_ffdef.h: $(BUILDVM_T) $(LJLIB_C)
413 $(E) "BUILDVM $@" 420 $(E) "BUILDVM $@"
414 $(Q)$(BUILDVM_X) -m ffdef -o $@ $(LJLIB_C) 421 $(Q)$(BUILDVM_X) -m ffdef -o $@ $(LJLIB_C)
diff --git a/src/Makefile.dep b/src/Makefile.dep
index ffb7d79b..d1ed9094 100644
--- a/src/Makefile.dep
+++ b/src/Makefile.dep
@@ -49,7 +49,8 @@ lj_asm.o: lj_asm.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
49 lj_str.h lj_tab.h lj_frame.h lj_bc.h lj_ir.h lj_jit.h lj_iropt.h \ 49 lj_str.h lj_tab.h lj_frame.h lj_bc.h lj_ir.h lj_jit.h lj_iropt.h \
50 lj_mcode.h lj_trace.h lj_dispatch.h lj_traceerr.h lj_snap.h lj_asm.h \ 50 lj_mcode.h lj_trace.h lj_dispatch.h lj_traceerr.h lj_snap.h lj_asm.h \
51 lj_vm.h lj_target.h lj_target_x86.h 51 lj_vm.h lj_target.h lj_target_x86.h
52lj_bc.o: lj_bc.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_bc.h 52lj_bc.o: lj_bc.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_bc.h \
53 lj_bcdef.h
53lj_ctype.o: lj_ctype.c lj_ctype.h lj_def.h lua.h luaconf.h 54lj_ctype.o: lj_ctype.c lj_ctype.h lj_def.h lua.h luaconf.h
54lj_dispatch.o: lj_dispatch.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \ 55lj_dispatch.o: lj_dispatch.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
55 lj_err.h lj_errmsg.h lj_state.h lj_frame.h lj_bc.h lj_jit.h lj_ir.h \ 56 lj_err.h lj_errmsg.h lj_state.h lj_frame.h lj_bc.h lj_jit.h lj_ir.h \
@@ -127,14 +128,15 @@ ljamalg.o: ljamalg.c lua.h luaconf.h lauxlib.h lj_gc.c lj_obj.h lj_def.h \
127 lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_func.h \ 128 lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_func.h \
128 lj_udata.h lj_meta.h lj_state.h lj_frame.h lj_bc.h lj_trace.h lj_jit.h \ 129 lj_udata.h lj_meta.h lj_state.h lj_frame.h lj_bc.h lj_trace.h lj_jit.h \
129 lj_ir.h lj_dispatch.h lj_traceerr.h lj_vm.h lj_err.c lj_ctype.c \ 130 lj_ir.h lj_dispatch.h lj_traceerr.h lj_vm.h lj_err.c lj_ctype.c \
130 lj_ctype.h lj_bc.c lj_obj.c lj_str.c lj_tab.c lj_func.c lj_udata.c \ 131 lj_ctype.h lj_bc.c lj_bcdef.h lj_obj.c lj_str.c lj_tab.c lj_func.c \
131 lj_meta.c lj_state.c lj_lex.h lj_alloc.h lj_dispatch.c luajit.h \ 132 lj_udata.c lj_meta.c lj_state.c lj_lex.h lj_alloc.h lj_dispatch.c \
132 lj_vmevent.c lj_vmevent.h lj_api.c lj_parse.h lj_lex.c lj_parse.c \ 133 luajit.h lj_vmevent.c lj_vmevent.h lj_api.c lj_parse.h lj_lex.c \
133 lj_lib.c lj_lib.h lj_ir.c lj_iropt.h lj_opt_mem.c lj_opt_fold.c \ 134 lj_parse.c lj_lib.c lj_lib.h lj_ir.c lj_iropt.h lj_opt_mem.c \
134 lj_folddef.h lj_opt_narrow.c lj_opt_dce.c lj_opt_loop.c lj_snap.h \ 135 lj_opt_fold.c lj_folddef.h lj_opt_narrow.c lj_opt_dce.c lj_opt_loop.c \
135 lj_mcode.c lj_mcode.h lj_snap.c lj_target.h lj_target_x86.h lj_record.c \ 136 lj_snap.h lj_mcode.c lj_mcode.h lj_snap.c lj_target.h lj_target_x86.h \
136 lj_ff.h lj_ffdef.h lj_record.h lj_asm.h lj_recdef.h lj_asm.c lj_trace.c \ 137 lj_record.c lj_ff.h lj_ffdef.h lj_record.h lj_asm.h lj_recdef.h \
137 lj_gdbjit.h lj_gdbjit.c lj_alloc.c lib_aux.c lib_base.c lualib.h \ 138 lj_asm.c lj_trace.c lj_gdbjit.h lj_gdbjit.c lj_alloc.c lib_aux.c \
138 lj_libdef.h lib_math.c lib_string.c lib_table.c lib_io.c lib_os.c \ 139 lib_base.c lualib.h lj_libdef.h lib_math.c lib_string.c lib_table.c \
139 lib_package.c lib_debug.c lib_bit.c lib_jit.c lib_init.c 140 lib_io.c lib_os.c lib_package.c lib_debug.c lib_bit.c lib_jit.c \
141 lib_init.c
140luajit.o: luajit.c lua.h luaconf.h lauxlib.h lualib.h luajit.h 142luajit.o: luajit.c lua.h luaconf.h lauxlib.h lualib.h luajit.h
diff --git a/src/buildvm.c b/src/buildvm.c
index 34f3df96..375e8b2b 100644
--- a/src/buildvm.c
+++ b/src/buildvm.c
@@ -251,6 +251,19 @@ static const char *lower(char *buf, const char *s)
251 return buf; 251 return buf;
252} 252}
253 253
254/* Emit C source code for bytecode-related definitions. */
255static void emit_bcdef(BuildCtx *ctx)
256{
257 int i;
258 fprintf(ctx->fp, "/* This is a generated file. DO NOT EDIT! */\n\n");
259 fprintf(ctx->fp, "LJ_DATADEF const uint16_t lj_bc_ofs[BC__MAX+1] = {\n ");
260 for (i = 0; i < ctx->npc; i++) {
261 fprintf(ctx->fp, "%4d, ", ctx->sym_ofs[i]);
262 if ((i & 7) == 7) fprintf(ctx->fp, "\n ");
263 }
264 fprintf(ctx->fp, "0\n};\n\n");
265}
266
254/* Emit VM definitions as Lua code for debug modules. */ 267/* Emit VM definitions as Lua code for debug modules. */
255static void emit_vmdef(BuildCtx *ctx) 268static void emit_vmdef(BuildCtx *ctx)
256{ 269{
@@ -418,6 +431,9 @@ int main(int argc, char **argv)
418 case BUILD_raw: 431 case BUILD_raw:
419 emit_raw(ctx); 432 emit_raw(ctx);
420 break; 433 break;
434 case BUILD_bcdef:
435 emit_bcdef(ctx);
436 break;
421 case BUILD_vmdef: 437 case BUILD_vmdef:
422 emit_vmdef(ctx); 438 emit_vmdef(ctx);
423 /* fallthrough */ 439 /* fallthrough */
diff --git a/src/buildvm.h b/src/buildvm.h
index 2581b548..6d242207 100644
--- a/src/buildvm.h
+++ b/src/buildvm.h
@@ -36,7 +36,6 @@
36 36
37/* Extra labels. */ 37/* Extra labels. */
38#define LABEL_ASM_BEGIN LABEL_PREFIX "vm_asm_begin" 38#define LABEL_ASM_BEGIN LABEL_PREFIX "vm_asm_begin"
39#define LABEL_OP_OFS LABEL_PREFIX "vm_op_ofs"
40 39
41/* Forward declaration. */ 40/* Forward declaration. */
42struct dasm_State; 41struct dasm_State;
@@ -50,7 +49,7 @@ struct dasm_State;
50 49
51#define BUILDDEF(_) \ 50#define BUILDDEF(_) \
52 _(elfasm) _(coffasm) _(machasm) BUILDDEFX(_) _(raw) \ 51 _(elfasm) _(coffasm) _(machasm) BUILDDEFX(_) _(raw) \
53 _(ffdef) _(libdef) _(recdef) _(vmdef) \ 52 _(bcdef) _(ffdef) _(libdef) _(recdef) _(vmdef) \
54 _(folddef) 53 _(folddef)
55 54
56typedef enum { 55typedef enum {
diff --git a/src/buildvm_asm.c b/src/buildvm_asm.c
index 2d0ba3b5..b135b864 100644
--- a/src/buildvm_asm.c
+++ b/src/buildvm_asm.c
@@ -193,26 +193,6 @@ void emit_asm(BuildCtx *ctx)
193 pi = ni; 193 pi = ni;
194 } 194 }
195 195
196 switch (ctx->mode) {
197 case BUILD_elfasm:
198 fprintf(ctx->fp, "\n\t.section .rodata\n");
199 break;
200 case BUILD_coffasm:
201 fprintf(ctx->fp, "\n\t.section .rdata,\"dr\"\n");
202 break;
203 case BUILD_machasm:
204 fprintf(ctx->fp, "\n\t.const\n");
205 break;
206 default:
207 break;
208 }
209 emit_asm_align(ctx, 5);
210
211 sprintf(name, "%s" LABEL_OP_OFS, symprefix);
212 emit_asm_label(ctx, name, 2*ctx->npc, 0);
213 for (i = 0; i < ctx->npc; i++)
214 fprintf(ctx->fp, "\t.short %d\n", ctx->sym_ofs[i]);
215
216 fprintf(ctx->fp, "\n"); 196 fprintf(ctx->fp, "\n");
217 switch (ctx->mode) { 197 switch (ctx->mode) {
218 case BUILD_elfasm: 198 case BUILD_elfasm:
diff --git a/src/buildvm_peobj.c b/src/buildvm_peobj.c
index 49b72930..5f4075af 100644
--- a/src/buildvm_peobj.c
+++ b/src/buildvm_peobj.c
@@ -103,7 +103,6 @@ enum {
103 PEOBJ_SECT_PDATA, 103 PEOBJ_SECT_PDATA,
104 PEOBJ_SECT_XDATA, 104 PEOBJ_SECT_XDATA,
105#endif 105#endif
106 PEOBJ_SECT_RDATA,
107 PEOBJ_SECT_RDATA_Z, 106 PEOBJ_SECT_RDATA_Z,
108 PEOBJ_NSECTIONS 107 PEOBJ_NSECTIONS
109}; 108};
@@ -168,9 +167,6 @@ static void emit_peobj_sym_sect(BuildCtx *ctx, PEsection *pesect, int sect)
168#define emit_peobj_sym_func(ctx, name, ofs) \ 167#define emit_peobj_sym_func(ctx, name, ofs) \
169 emit_peobj_sym(ctx, name, (uint32_t)(ofs), \ 168 emit_peobj_sym(ctx, name, (uint32_t)(ofs), \
170 PEOBJ_SECT_TEXT, PEOBJ_TYPE_FUNC, PEOBJ_SCL_EXTERN) 169 PEOBJ_SECT_TEXT, PEOBJ_TYPE_FUNC, PEOBJ_SCL_EXTERN)
171#define emit_peobj_sym_rdata(ctx, name, ofs) \
172 emit_peobj_sym(ctx, name, (uint32_t)(ofs), \
173 PEOBJ_SECT_RDATA, PEOBJ_TYPE_NULL, PEOBJ_SCL_EXTERN)
174 170
175/* Emit Windows PE object file. */ 171/* Emit Windows PE object file. */
176void emit_peobj(BuildCtx *ctx) 172void emit_peobj(BuildCtx *ctx)
@@ -218,12 +214,6 @@ void emit_peobj(BuildCtx *ctx)
218 pesect[PEOBJ_SECT_XDATA].flags = 0x40300040; 214 pesect[PEOBJ_SECT_XDATA].flags = 0x40300040;
219#endif 215#endif
220 216
221 memcpy(pesect[PEOBJ_SECT_RDATA].name, ".rdata", sizeof(".rdata")-1);
222 pesect[PEOBJ_SECT_RDATA].ofs = sofs;
223 sofs += (pesect[PEOBJ_SECT_RDATA].size = ctx->npc*sizeof(uint16_t));
224 /* Flags: 40 = read, 30 = align4, 40 = initialized data. */
225 pesect[PEOBJ_SECT_RDATA].flags = 0x40300040;
226
227 memcpy(pesect[PEOBJ_SECT_RDATA_Z].name, ".rdata$Z", sizeof(".rdata$Z")-1); 217 memcpy(pesect[PEOBJ_SECT_RDATA_Z].name, ".rdata$Z", sizeof(".rdata$Z")-1);
228 pesect[PEOBJ_SECT_RDATA_Z].ofs = sofs; 218 pesect[PEOBJ_SECT_RDATA_Z].ofs = sofs;
229 sofs += (pesect[PEOBJ_SECT_RDATA_Z].size = (uint32_t)strlen(ctx->dasm_ident)+1); 219 sofs += (pesect[PEOBJ_SECT_RDATA_Z].size = (uint32_t)strlen(ctx->dasm_ident)+1);
@@ -240,13 +230,13 @@ void emit_peobj(BuildCtx *ctx)
240 230
241 /* Compute the size of the symbol table: 231 /* Compute the size of the symbol table:
242 ** @feat.00 + nsections*2 232 ** @feat.00 + nsections*2
243 ** + asm_start + (nsyms-nzsym) + op_ofs 233 ** + asm_start + (nsyms-nzsym)
244 ** + relocsyms 234 ** + relocsyms
245 */ 235 */
246 /* Skip _Z syms. */ 236 /* Skip _Z syms. */
247 for (nzsym = 0; ctx->sym_ofs[ctx->perm[nzsym]] < 0; nzsym++) ; 237 for (nzsym = 0; ctx->sym_ofs[ctx->perm[nzsym]] < 0; nzsym++) ;
248 for (relocsyms = 0; ctx->extnames[relocsyms]; relocsyms++) ; 238 for (relocsyms = 0; ctx->extnames[relocsyms]; relocsyms++) ;
249 pehdr.nsyms = 1+PEOBJ_NSECTIONS*2 + 1+(ctx->nsym-nzsym)+1 + relocsyms; 239 pehdr.nsyms = 1+PEOBJ_NSECTIONS*2 + 1+(ctx->nsym-nzsym) + relocsyms;
250#if !LJ_HASJIT 240#if !LJ_HASJIT
251 pehdr.nsyms -= 7; 241 pehdr.nsyms -= 7;
252#endif 242#endif
@@ -303,12 +293,6 @@ void emit_peobj(BuildCtx *ctx)
303 } 293 }
304#endif 294#endif
305 295
306 /* Write .rdata section. */
307 for (i = 0; i < ctx->npc; i++) {
308 uint16_t pcofs = (uint16_t)ctx->sym_ofs[i];
309 owrite(ctx, &pcofs, 2);
310 }
311
312 /* Write .rdata$Z section. */ 296 /* Write .rdata$Z section. */
313 owrite(ctx, ctx->dasm_ident, strlen(ctx->dasm_ident)+1); 297 owrite(ctx, ctx->dasm_ident, strlen(ctx->dasm_ident)+1);
314 298
@@ -378,9 +362,6 @@ void emit_peobj(BuildCtx *ctx)
378 } 362 }
379 } 363 }
380 364
381 emit_peobj_sym_sect(ctx, pesect, PEOBJ_SECT_RDATA);
382 emit_peobj_sym_rdata(ctx, PEOBJ_SYM_PREFIX LABEL_OP_OFS, 0);
383
384 emit_peobj_sym_sect(ctx, pesect, PEOBJ_SECT_RDATA_Z); 365 emit_peobj_sym_sect(ctx, pesect, PEOBJ_SECT_RDATA_Z);
385 366
386 if (strtab) 367 if (strtab)
diff --git a/src/lj_bc.c b/src/lj_bc.c
index ec3cf735..58e97b30 100644
--- a/src/lj_bc.c
+++ b/src/lj_bc.c
@@ -15,3 +15,5 @@ BCDEF(BCMODE)
15 0 15 0
16}; 16};
17 17
18#include "lj_bcdef.h"
19
diff --git a/src/lj_bc.h b/src/lj_bc.h
index ca70d210..83e2dea3 100644
--- a/src/lj_bc.h
+++ b/src/lj_bc.h
@@ -231,5 +231,6 @@ typedef enum {
231 (BCM##ma|(BCM##mb<<3)|(BCM##mc<<7)|(MM_##mm<<11)), 231 (BCM##ma|(BCM##mb<<3)|(BCM##mc<<7)|(MM_##mm<<11)),
232 232
233LJ_DATA const uint16_t lj_bc_mode[BC__MAX+1]; 233LJ_DATA const uint16_t lj_bc_mode[BC__MAX+1];
234LJ_DATA const uint16_t lj_bc_ofs[BC__MAX+1];
234 235
235#endif 236#endif
diff --git a/src/lj_dispatch.c b/src/lj_dispatch.c
index 5378531d..02fcf6ef 100644
--- a/src/lj_dispatch.c
+++ b/src/lj_dispatch.c
@@ -27,7 +27,7 @@ void lj_dispatch_init(GG_State *GG)
27 uint32_t i; 27 uint32_t i;
28 ASMFunction *disp = GG->dispatch; 28 ASMFunction *disp = GG->dispatch;
29 for (i = 0; i < BC__MAX; i++) 29 for (i = 0; i < BC__MAX; i++)
30 disp[GG_DISP_STATIC+i] = disp[i] = makeasmfunc(lj_vm_op_ofs[i]); 30 disp[GG_DISP_STATIC+i] = disp[i] = makeasmfunc(lj_bc_ofs[i]);
31 /* The JIT engine is off by default. luaopen_jit() turns it on. */ 31 /* The JIT engine is off by default. luaopen_jit() turns it on. */
32 disp[BC_FORL] = disp[BC_IFORL]; 32 disp[BC_FORL] = disp[BC_IFORL];
33 disp[BC_ITERL] = disp[BC_IITERL]; 33 disp[BC_ITERL] = disp[BC_IITERL];
@@ -61,9 +61,9 @@ void lj_dispatch_update(global_State *g)
61 ASMFunction f_forl, f_iterl, f_loop; 61 ASMFunction f_forl, f_iterl, f_loop;
62 g->dispatchmode = mode; 62 g->dispatchmode = mode;
63 if ((mode & 5) == 1) { /* Hotcount if JIT is on, but not when recording. */ 63 if ((mode & 5) == 1) { /* Hotcount if JIT is on, but not when recording. */
64 f_forl = makeasmfunc(lj_vm_op_ofs[BC_FORL]); 64 f_forl = makeasmfunc(lj_bc_ofs[BC_FORL]);
65 f_iterl = makeasmfunc(lj_vm_op_ofs[BC_ITERL]); 65 f_iterl = makeasmfunc(lj_bc_ofs[BC_ITERL]);
66 f_loop = makeasmfunc(lj_vm_op_ofs[BC_LOOP]); 66 f_loop = makeasmfunc(lj_bc_ofs[BC_LOOP]);
67 } else { /* Otherwise use the non-hotcounting instructions. */ 67 } else { /* Otherwise use the non-hotcounting instructions. */
68 f_forl = disp[GG_DISP_STATIC+BC_IFORL]; 68 f_forl = disp[GG_DISP_STATIC+BC_IFORL];
69 f_iterl = disp[GG_DISP_STATIC+BC_IITERL]; 69 f_iterl = disp[GG_DISP_STATIC+BC_IITERL];
diff --git a/src/lj_vm.h b/src/lj_vm.h
index cf6a985f..b25f182a 100644
--- a/src/lj_vm.h
+++ b/src/lj_vm.h
@@ -61,9 +61,7 @@ LJ_ASMF void lj_cont_hook(void); /* Continue from hook yield. */
61/* Start of the ASM code. */ 61/* Start of the ASM code. */
62LJ_ASMF char lj_vm_asm_begin[]; 62LJ_ASMF char lj_vm_asm_begin[];
63 63
64/* Opcode handler offsets, relative to lj_vm_asm_begin. */ 64/* Bytecode offsets are relative to lj_vm_asm_begin. */
65LJ_ASMF const uint16_t lj_vm_op_ofs[];
66
67#define makeasmfunc(ofs) ((ASMFunction)(lj_vm_asm_begin + (ofs))) 65#define makeasmfunc(ofs) ((ASMFunction)(lj_vm_asm_begin + (ofs)))
68 66
69#endif 67#endif
diff --git a/src/msvcbuild.bat b/src/msvcbuild.bat
index 200c651f..200f4cc9 100644
--- a/src/msvcbuild.bat
+++ b/src/msvcbuild.bat
@@ -32,6 +32,7 @@ if exist buildvm.exe.manifest^
32 %LJMT% -manifest buildvm.exe.manifest -outputresource:buildvm.exe 32 %LJMT% -manifest buildvm.exe.manifest -outputresource:buildvm.exe
33 33
34buildvm -m peobj -o lj_vm.obj 34buildvm -m peobj -o lj_vm.obj
35buildvm -m bcdef -o lj_bcdef.h
35buildvm -m ffdef -o lj_ffdef.h %ALL_LIB% 36buildvm -m ffdef -o lj_ffdef.h %ALL_LIB%
36buildvm -m libdef -o lj_libdef.h %ALL_LIB% 37buildvm -m libdef -o lj_libdef.h %ALL_LIB%
37buildvm -m recdef -o lj_recdef.h %ALL_LIB% 38buildvm -m recdef -o lj_recdef.h %ALL_LIB%