aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2013-05-16 20:34:34 +0200
committerMike Pall <mike>2013-05-16 20:34:34 +0200
commitfe8773677753040345afa2c2d708fe5ea8068c8e (patch)
treed4078f02a49227468543c800b450014ca46c0913
parent647cc4613f3acd5ec8785920102af22b85cf2b9c (diff)
downloadluajit-fe8773677753040345afa2c2d708fe5ea8068c8e.tar.gz
luajit-fe8773677753040345afa2c2d708fe5ea8068c8e.tar.bz2
luajit-fe8773677753040345afa2c2d708fe5ea8068c8e.zip
Get rid of module() in all internal modules.
-rw-r--r--src/host/buildvm.c15
-rw-r--r--src/host/buildvm_lib.c2
-rw-r--r--src/jit/bc.lua17
-rw-r--r--src/jit/bcsave.lua6
-rw-r--r--src/jit/dis_arm.lua18
-rw-r--r--src/jit/dis_mips.lua30
-rw-r--r--src/jit/dis_mipsel.lua15
-rw-r--r--src/jit/dis_ppc.lua18
-rw-r--r--src/jit/dis_x64.lua15
-rw-r--r--src/jit/dis_x86.lua34
-rw-r--r--src/jit/dump.lua10
-rw-r--r--src/jit/v.lua10
12 files changed, 92 insertions, 98 deletions
diff --git a/src/host/buildvm.c b/src/host/buildvm.c
index ba8fbcba..ef5f7fb9 100644
--- a/src/host/buildvm.c
+++ b/src/host/buildvm.c
@@ -314,20 +314,20 @@ static void emit_vmdef(BuildCtx *ctx)
314 char buf[80]; 314 char buf[80];
315 int i; 315 int i;
316 fprintf(ctx->fp, "-- This is a generated file. DO NOT EDIT!\n\n"); 316 fprintf(ctx->fp, "-- This is a generated file. DO NOT EDIT!\n\n");
317 fprintf(ctx->fp, "module(...)\n\n"); 317 fprintf(ctx->fp, "return {\n\n");
318 318
319 fprintf(ctx->fp, "bcnames = \""); 319 fprintf(ctx->fp, "bcnames = \"");
320 for (i = 0; bc_names[i]; i++) fprintf(ctx->fp, "%-6s", bc_names[i]); 320 for (i = 0; bc_names[i]; i++) fprintf(ctx->fp, "%-6s", bc_names[i]);
321 fprintf(ctx->fp, "\"\n\n"); 321 fprintf(ctx->fp, "\",\n\n");
322 322
323 fprintf(ctx->fp, "irnames = \""); 323 fprintf(ctx->fp, "irnames = \"");
324 for (i = 0; ir_names[i]; i++) fprintf(ctx->fp, "%-6s", ir_names[i]); 324 for (i = 0; ir_names[i]; i++) fprintf(ctx->fp, "%-6s", ir_names[i]);
325 fprintf(ctx->fp, "\"\n\n"); 325 fprintf(ctx->fp, "\",\n\n");
326 326
327 fprintf(ctx->fp, "irfpm = { [0]="); 327 fprintf(ctx->fp, "irfpm = { [0]=");
328 for (i = 0; irfpm_names[i]; i++) 328 for (i = 0; irfpm_names[i]; i++)
329 fprintf(ctx->fp, "\"%s\", ", lower(buf, irfpm_names[i])); 329 fprintf(ctx->fp, "\"%s\", ", lower(buf, irfpm_names[i]));
330 fprintf(ctx->fp, "}\n\n"); 330 fprintf(ctx->fp, "},\n\n");
331 331
332 fprintf(ctx->fp, "irfield = { [0]="); 332 fprintf(ctx->fp, "irfield = { [0]=");
333 for (i = 0; irfield_names[i]; i++) { 333 for (i = 0; irfield_names[i]; i++) {
@@ -337,17 +337,17 @@ static void emit_vmdef(BuildCtx *ctx)
337 if (p) *p = '.'; 337 if (p) *p = '.';
338 fprintf(ctx->fp, "\"%s\", ", buf); 338 fprintf(ctx->fp, "\"%s\", ", buf);
339 } 339 }
340 fprintf(ctx->fp, "}\n\n"); 340 fprintf(ctx->fp, "},\n\n");
341 341
342 fprintf(ctx->fp, "ircall = {\n[0]="); 342 fprintf(ctx->fp, "ircall = {\n[0]=");
343 for (i = 0; ircall_names[i]; i++) 343 for (i = 0; ircall_names[i]; i++)
344 fprintf(ctx->fp, "\"%s\",\n", ircall_names[i]); 344 fprintf(ctx->fp, "\"%s\",\n", ircall_names[i]);
345 fprintf(ctx->fp, "}\n\n"); 345 fprintf(ctx->fp, "},\n\n");
346 346
347 fprintf(ctx->fp, "traceerr = {\n[0]="); 347 fprintf(ctx->fp, "traceerr = {\n[0]=");
348 for (i = 0; trace_errors[i]; i++) 348 for (i = 0; trace_errors[i]; i++)
349 fprintf(ctx->fp, "\"%s\",\n", trace_errors[i]); 349 fprintf(ctx->fp, "\"%s\",\n", trace_errors[i]);
350 fprintf(ctx->fp, "}\n\n"); 350 fprintf(ctx->fp, "},\n\n");
351} 351}
352 352
353/* -- Argument parsing ---------------------------------------------------- */ 353/* -- Argument parsing ---------------------------------------------------- */
@@ -484,6 +484,7 @@ int main(int argc, char **argv)
484 case BUILD_vmdef: 484 case BUILD_vmdef:
485 emit_vmdef(ctx); 485 emit_vmdef(ctx);
486 emit_lib(ctx); 486 emit_lib(ctx);
487 fprintf(ctx->fp, "}\n\n");
487 break; 488 break;
488 case BUILD_ffdef: 489 case BUILD_ffdef:
489 case BUILD_libdef: 490 case BUILD_libdef:
diff --git a/src/host/buildvm_lib.c b/src/host/buildvm_lib.c
index dcd3ca41..f578bbc9 100644
--- a/src/host/buildvm_lib.c
+++ b/src/host/buildvm_lib.c
@@ -432,7 +432,7 @@ void emit_lib(BuildCtx *ctx)
432 "#ifndef FF_NUM_ASMFUNC\n#define FF_NUM_ASMFUNC %d\n#endif\n\n", 432 "#ifndef FF_NUM_ASMFUNC\n#define FF_NUM_ASMFUNC %d\n#endif\n\n",
433 ffasmfunc); 433 ffasmfunc);
434 } else if (ctx->mode == BUILD_vmdef) { 434 } else if (ctx->mode == BUILD_vmdef) {
435 fprintf(ctx->fp, "}\n\n"); 435 fprintf(ctx->fp, "},\n\n");
436 } else if (ctx->mode == BUILD_bcdef) { 436 } else if (ctx->mode == BUILD_bcdef) {
437 int i; 437 int i;
438 fprintf(ctx->fp, "\n};\n\n"); 438 fprintf(ctx->fp, "\n};\n\n");
diff --git a/src/jit/bc.lua b/src/jit/bc.lua
index dd1c1f3b..566b09c3 100644
--- a/src/jit/bc.lua
+++ b/src/jit/bc.lua
@@ -179,13 +179,12 @@ local function bcliston(outfile)
179end 179end
180 180
181-- Public module functions. 181-- Public module functions.
182module(...) 182return {
183 183 line = bcline,
184line = bcline 184 dump = bcdump,
185dump = bcdump 185 targets = bctargets,
186targets = bctargets 186 on = bcliston,
187 187 off = bclistoff,
188on = bcliston 188 start = bcliston -- For -j command line option.
189off = bclistoff 189}
190start = bcliston -- For -j command line option.
191 190
diff --git a/src/jit/bcsave.lua b/src/jit/bcsave.lua
index a54094dd..8aad7596 100644
--- a/src/jit/bcsave.lua
+++ b/src/jit/bcsave.lua
@@ -653,7 +653,7 @@ end
653------------------------------------------------------------------------------ 653------------------------------------------------------------------------------
654 654
655-- Public module functions. 655-- Public module functions.
656module(...) 656return {
657 657 start = docmd -- Process -b command line option.
658start = docmd -- Process -b command line option. 658}
659 659
diff --git a/src/jit/dis_arm.lua b/src/jit/dis_arm.lua
index dc7ca71f..87a84e93 100644
--- a/src/jit/dis_arm.lua
+++ b/src/jit/dis_arm.lua
@@ -658,7 +658,7 @@ local function disass_block(ctx, ofs, len)
658end 658end
659 659
660-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len). 660-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).
661local function create_(code, addr, out) 661local function create(code, addr, out)
662 local ctx = {} 662 local ctx = {}
663 ctx.code = code 663 ctx.code = code
664 ctx.addr = addr or 0 664 ctx.addr = addr or 0
@@ -670,20 +670,20 @@ local function create_(code, addr, out)
670end 670end
671 671
672-- Simple API: disassemble code (a string) at address and output via out. 672-- Simple API: disassemble code (a string) at address and output via out.
673local function disass_(code, addr, out) 673local function disass(code, addr, out)
674 create_(code, addr, out):disass() 674 create(code, addr, out):disass()
675end 675end
676 676
677-- Return register name for RID. 677-- Return register name for RID.
678local function regname_(r) 678local function regname(r)
679 if r < 16 then return map_gpr[r] end 679 if r < 16 then return map_gpr[r] end
680 return "d"..(r-16) 680 return "d"..(r-16)
681end 681end
682 682
683-- Public module functions. 683-- Public module functions.
684module(...) 684return {
685 685 create = create,
686create = create_ 686 disass = disass,
687disass = disass_ 687 regname = regname
688regname = regname_ 688}
689 689
diff --git a/src/jit/dis_mips.lua b/src/jit/dis_mips.lua
index 830db409..9ba0e019 100644
--- a/src/jit/dis_mips.lua
+++ b/src/jit/dis_mips.lua
@@ -384,7 +384,7 @@ local function disass_block(ctx, ofs, len)
384end 384end
385 385
386-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len). 386-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).
387local function create_(code, addr, out) 387local function create(code, addr, out)
388 local ctx = {} 388 local ctx = {}
389 ctx.code = code 389 ctx.code = code
390 ctx.addr = addr or 0 390 ctx.addr = addr or 0
@@ -396,33 +396,33 @@ local function create_(code, addr, out)
396 return ctx 396 return ctx
397end 397end
398 398
399local function create_el_(code, addr, out) 399local function create_el(code, addr, out)
400 local ctx = create_(code, addr, out) 400 local ctx = create(code, addr, out)
401 ctx.get = get_le 401 ctx.get = get_le
402 return ctx 402 return ctx
403end 403end
404 404
405-- Simple API: disassemble code (a string) at address and output via out. 405-- Simple API: disassemble code (a string) at address and output via out.
406local function disass_(code, addr, out) 406local function disass(code, addr, out)
407 create_(code, addr, out):disass() 407 create(code, addr, out):disass()
408end 408end
409 409
410local function disass_el_(code, addr, out) 410local function disass_el(code, addr, out)
411 create_el_(code, addr, out):disass() 411 create_el(code, addr, out):disass()
412end 412end
413 413
414-- Return register name for RID. 414-- Return register name for RID.
415local function regname_(r) 415local function regname(r)
416 if r < 32 then return map_gpr[r] end 416 if r < 32 then return map_gpr[r] end
417 return "f"..(r-32) 417 return "f"..(r-32)
418end 418end
419 419
420-- Public module functions. 420-- Public module functions.
421module(...) 421return {
422 422 create = create,
423create = create_ 423 create_el = create_el,
424create_el = create_el_ 424 disass = disass,
425disass = disass_ 425 disass_el = disass_el,
426disass_el = disass_el_ 426 regname = regname
427regname = regname_ 427}
428 428
diff --git a/src/jit/dis_mipsel.lua b/src/jit/dis_mipsel.lua
index 8a10c462..60e0233b 100644
--- a/src/jit/dis_mipsel.lua
+++ b/src/jit/dis_mipsel.lua
@@ -8,13 +8,10 @@
8-- MIPS disassembler module. All the interesting stuff is there. 8-- MIPS disassembler module. All the interesting stuff is there.
9------------------------------------------------------------------------------ 9------------------------------------------------------------------------------
10 10
11local require = require 11local dis_mips = require((string.match(..., ".*%.") or "").."dis_mips")
12 12return {
13module(...) 13 create = dis_mips.create_el,
14 14 disass = dis_mips.disass_el,
15local dis_mips = require(_PACKAGE.."dis_mips") 15 regname = dis_mips.regname
16 16}
17create = dis_mips.create_el
18disass = dis_mips.disass_el
19regname = dis_mips.regname
20 17
diff --git a/src/jit/dis_ppc.lua b/src/jit/dis_ppc.lua
index 169a534c..5143d47a 100644
--- a/src/jit/dis_ppc.lua
+++ b/src/jit/dis_ppc.lua
@@ -560,7 +560,7 @@ local function disass_block(ctx, ofs, len)
560end 560end
561 561
562-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len). 562-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).
563local function create_(code, addr, out) 563local function create(code, addr, out)
564 local ctx = {} 564 local ctx = {}
565 ctx.code = code 565 ctx.code = code
566 ctx.addr = addr or 0 566 ctx.addr = addr or 0
@@ -572,20 +572,20 @@ local function create_(code, addr, out)
572end 572end
573 573
574-- Simple API: disassemble code (a string) at address and output via out. 574-- Simple API: disassemble code (a string) at address and output via out.
575local function disass_(code, addr, out) 575local function disass(code, addr, out)
576 create_(code, addr, out):disass() 576 create(code, addr, out):disass()
577end 577end
578 578
579-- Return register name for RID. 579-- Return register name for RID.
580local function regname_(r) 580local function regname(r)
581 if r < 32 then return map_gpr[r] end 581 if r < 32 then return map_gpr[r] end
582 return "f"..(r-32) 582 return "f"..(r-32)
583end 583end
584 584
585-- Public module functions. 585-- Public module functions.
586module(...) 586return {
587 587 create = create,
588create = create_ 588 disass = disass,
589disass = disass_ 589 regname = regname
590regname = regname_ 590}
591 591
diff --git a/src/jit/dis_x64.lua b/src/jit/dis_x64.lua
index 4a1894ac..2f4f6e7c 100644
--- a/src/jit/dis_x64.lua
+++ b/src/jit/dis_x64.lua
@@ -8,13 +8,10 @@
8-- x86/x64 disassembler module. All the interesting stuff is there. 8-- x86/x64 disassembler module. All the interesting stuff is there.
9------------------------------------------------------------------------------ 9------------------------------------------------------------------------------
10 10
11local require = require 11local dis_x86 = require((string.match(..., ".*%.") or "").."dis_x86")
12 12return {
13module(...) 13 create = dis_x86.create64,
14 14 disass = dis_x86.disass64,
15local dis_x86 = require(_PACKAGE.."dis_x86") 15 regname = dis_x86.regname64
16 16}
17create = dis_x86.create64
18disass = dis_x86.disass64
19regname = dis_x86.regname64
20 17
diff --git a/src/jit/dis_x86.lua b/src/jit/dis_x86.lua
index 49101efe..14b0fd61 100644
--- a/src/jit/dis_x86.lua
+++ b/src/jit/dis_x86.lua
@@ -784,7 +784,7 @@ local function disass_block(ctx, ofs, len)
784end 784end
785 785
786-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len). 786-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).
787local function create_(code, addr, out) 787local function create(code, addr, out)
788 local ctx = {} 788 local ctx = {}
789 ctx.code = code 789 ctx.code = code
790 ctx.addr = (addr or 0) - 1 790 ctx.addr = (addr or 0) - 1
@@ -798,8 +798,8 @@ local function create_(code, addr, out)
798 return ctx 798 return ctx
799end 799end
800 800
801local function create64_(code, addr, out) 801local function create64(code, addr, out)
802 local ctx = create_(code, addr, out) 802 local ctx = create(code, addr, out)
803 ctx.x64 = true 803 ctx.x64 = true
804 ctx.map1 = map_opc1_64 804 ctx.map1 = map_opc1_64
805 ctx.aregs = map_regs.Q 805 ctx.aregs = map_regs.Q
@@ -807,32 +807,32 @@ local function create64_(code, addr, out)
807end 807end
808 808
809-- Simple API: disassemble code (a string) at address and output via out. 809-- Simple API: disassemble code (a string) at address and output via out.
810local function disass_(code, addr, out) 810local function disass(code, addr, out)
811 create_(code, addr, out):disass() 811 create(code, addr, out):disass()
812end 812end
813 813
814local function disass64_(code, addr, out) 814local function disass64(code, addr, out)
815 create64_(code, addr, out):disass() 815 create64(code, addr, out):disass()
816end 816end
817 817
818-- Return register name for RID. 818-- Return register name for RID.
819local function regname_(r) 819local function regname(r)
820 if r < 8 then return map_regs.D[r+1] end 820 if r < 8 then return map_regs.D[r+1] end
821 return map_regs.X[r-7] 821 return map_regs.X[r-7]
822end 822end
823 823
824local function regname64_(r) 824local function regname64(r)
825 if r < 16 then return map_regs.Q[r+1] end 825 if r < 16 then return map_regs.Q[r+1] end
826 return map_regs.X[r-15] 826 return map_regs.X[r-15]
827end 827end
828 828
829-- Public module functions. 829-- Public module functions.
830module(...) 830return {
831 831 create = create,
832create = create_ 832 create64 = create64,
833create64 = create64_ 833 disass = disass,
834disass = disass_ 834 disass64 = disass64,
835disass64 = disass64_ 835 regname = regname,
836regname = regname_ 836 regname64 = regname64
837regname64 = regname64_ 837}
838 838
diff --git a/src/jit/dump.lua b/src/jit/dump.lua
index e6c9d5b6..18a4d260 100644
--- a/src/jit/dump.lua
+++ b/src/jit/dump.lua
@@ -694,9 +694,9 @@ local function dumpon(opt, outfile)
694end 694end
695 695
696-- Public module functions. 696-- Public module functions.
697module(...) 697return {
698 698 on = dumpon,
699on = dumpon 699 off = dumpoff,
700off = dumpoff 700 start = dumpon -- For -j command line option.
701start = dumpon -- For -j command line option. 701}
702 702
diff --git a/src/jit/v.lua b/src/jit/v.lua
index 88c358b5..22bee3ff 100644
--- a/src/jit/v.lua
+++ b/src/jit/v.lua
@@ -159,9 +159,9 @@ local function dumpon(outfile)
159end 159end
160 160
161-- Public module functions. 161-- Public module functions.
162module(...) 162return {
163 163 on = dumpon,
164on = dumpon 164 off = dumpoff,
165off = dumpoff 165 start = dumpon -- For -j command line option.
166start = dumpon -- For -j command line option. 166}
167 167