diff options
author | Mike Pall <mike> | 2013-05-16 20:34:34 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2013-05-16 20:34:34 +0200 |
commit | fe8773677753040345afa2c2d708fe5ea8068c8e (patch) | |
tree | d4078f02a49227468543c800b450014ca46c0913 | |
parent | 647cc4613f3acd5ec8785920102af22b85cf2b9c (diff) | |
download | luajit-fe8773677753040345afa2c2d708fe5ea8068c8e.tar.gz luajit-fe8773677753040345afa2c2d708fe5ea8068c8e.tar.bz2 luajit-fe8773677753040345afa2c2d708fe5ea8068c8e.zip |
Get rid of module() in all internal modules.
-rw-r--r-- | src/host/buildvm.c | 15 | ||||
-rw-r--r-- | src/host/buildvm_lib.c | 2 | ||||
-rw-r--r-- | src/jit/bc.lua | 17 | ||||
-rw-r--r-- | src/jit/bcsave.lua | 6 | ||||
-rw-r--r-- | src/jit/dis_arm.lua | 18 | ||||
-rw-r--r-- | src/jit/dis_mips.lua | 30 | ||||
-rw-r--r-- | src/jit/dis_mipsel.lua | 15 | ||||
-rw-r--r-- | src/jit/dis_ppc.lua | 18 | ||||
-rw-r--r-- | src/jit/dis_x64.lua | 15 | ||||
-rw-r--r-- | src/jit/dis_x86.lua | 34 | ||||
-rw-r--r-- | src/jit/dump.lua | 10 | ||||
-rw-r--r-- | src/jit/v.lua | 10 |
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) | |||
179 | end | 179 | end |
180 | 180 | ||
181 | -- Public module functions. | 181 | -- Public module functions. |
182 | module(...) | 182 | return { |
183 | 183 | line = bcline, | |
184 | line = bcline | 184 | dump = bcdump, |
185 | dump = bcdump | 185 | targets = bctargets, |
186 | targets = bctargets | 186 | on = bcliston, |
187 | 187 | off = bclistoff, | |
188 | on = bcliston | 188 | start = bcliston -- For -j command line option. |
189 | off = bclistoff | 189 | } |
190 | start = 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. |
656 | module(...) | 656 | return { |
657 | 657 | start = docmd -- Process -b command line option. | |
658 | start = 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) | |||
658 | end | 658 | end |
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). |
661 | local function create_(code, addr, out) | 661 | local 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) | |||
670 | end | 670 | end |
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. |
673 | local function disass_(code, addr, out) | 673 | local function disass(code, addr, out) |
674 | create_(code, addr, out):disass() | 674 | create(code, addr, out):disass() |
675 | end | 675 | end |
676 | 676 | ||
677 | -- Return register name for RID. | 677 | -- Return register name for RID. |
678 | local function regname_(r) | 678 | local 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) |
681 | end | 681 | end |
682 | 682 | ||
683 | -- Public module functions. | 683 | -- Public module functions. |
684 | module(...) | 684 | return { |
685 | 685 | create = create, | |
686 | create = create_ | 686 | disass = disass, |
687 | disass = disass_ | 687 | regname = regname |
688 | regname = 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) | |||
384 | end | 384 | end |
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). |
387 | local function create_(code, addr, out) | 387 | local 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 |
397 | end | 397 | end |
398 | 398 | ||
399 | local function create_el_(code, addr, out) | 399 | local 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 |
403 | end | 403 | end |
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. |
406 | local function disass_(code, addr, out) | 406 | local function disass(code, addr, out) |
407 | create_(code, addr, out):disass() | 407 | create(code, addr, out):disass() |
408 | end | 408 | end |
409 | 409 | ||
410 | local function disass_el_(code, addr, out) | 410 | local function disass_el(code, addr, out) |
411 | create_el_(code, addr, out):disass() | 411 | create_el(code, addr, out):disass() |
412 | end | 412 | end |
413 | 413 | ||
414 | -- Return register name for RID. | 414 | -- Return register name for RID. |
415 | local function regname_(r) | 415 | local 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) |
418 | end | 418 | end |
419 | 419 | ||
420 | -- Public module functions. | 420 | -- Public module functions. |
421 | module(...) | 421 | return { |
422 | 422 | create = create, | |
423 | create = create_ | 423 | create_el = create_el, |
424 | create_el = create_el_ | 424 | disass = disass, |
425 | disass = disass_ | 425 | disass_el = disass_el, |
426 | disass_el = disass_el_ | 426 | regname = regname |
427 | regname = 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 | ||
11 | local require = require | 11 | local dis_mips = require((string.match(..., ".*%.") or "").."dis_mips") |
12 | 12 | return { | |
13 | module(...) | 13 | create = dis_mips.create_el, |
14 | 14 | disass = dis_mips.disass_el, | |
15 | local dis_mips = require(_PACKAGE.."dis_mips") | 15 | regname = dis_mips.regname |
16 | 16 | } | |
17 | create = dis_mips.create_el | ||
18 | disass = dis_mips.disass_el | ||
19 | regname = 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) | |||
560 | end | 560 | end |
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). |
563 | local function create_(code, addr, out) | 563 | local 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) | |||
572 | end | 572 | end |
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. |
575 | local function disass_(code, addr, out) | 575 | local function disass(code, addr, out) |
576 | create_(code, addr, out):disass() | 576 | create(code, addr, out):disass() |
577 | end | 577 | end |
578 | 578 | ||
579 | -- Return register name for RID. | 579 | -- Return register name for RID. |
580 | local function regname_(r) | 580 | local 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) |
583 | end | 583 | end |
584 | 584 | ||
585 | -- Public module functions. | 585 | -- Public module functions. |
586 | module(...) | 586 | return { |
587 | 587 | create = create, | |
588 | create = create_ | 588 | disass = disass, |
589 | disass = disass_ | 589 | regname = regname |
590 | regname = 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 | ||
11 | local require = require | 11 | local dis_x86 = require((string.match(..., ".*%.") or "").."dis_x86") |
12 | 12 | return { | |
13 | module(...) | 13 | create = dis_x86.create64, |
14 | 14 | disass = dis_x86.disass64, | |
15 | local dis_x86 = require(_PACKAGE.."dis_x86") | 15 | regname = dis_x86.regname64 |
16 | 16 | } | |
17 | create = dis_x86.create64 | ||
18 | disass = dis_x86.disass64 | ||
19 | regname = 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) | |||
784 | end | 784 | end |
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). |
787 | local function create_(code, addr, out) | 787 | local 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 |
799 | end | 799 | end |
800 | 800 | ||
801 | local function create64_(code, addr, out) | 801 | local 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) | |||
807 | end | 807 | end |
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. |
810 | local function disass_(code, addr, out) | 810 | local function disass(code, addr, out) |
811 | create_(code, addr, out):disass() | 811 | create(code, addr, out):disass() |
812 | end | 812 | end |
813 | 813 | ||
814 | local function disass64_(code, addr, out) | 814 | local function disass64(code, addr, out) |
815 | create64_(code, addr, out):disass() | 815 | create64(code, addr, out):disass() |
816 | end | 816 | end |
817 | 817 | ||
818 | -- Return register name for RID. | 818 | -- Return register name for RID. |
819 | local function regname_(r) | 819 | local 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] |
822 | end | 822 | end |
823 | 823 | ||
824 | local function regname64_(r) | 824 | local 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] |
827 | end | 827 | end |
828 | 828 | ||
829 | -- Public module functions. | 829 | -- Public module functions. |
830 | module(...) | 830 | return { |
831 | 831 | create = create, | |
832 | create = create_ | 832 | create64 = create64, |
833 | create64 = create64_ | 833 | disass = disass, |
834 | disass = disass_ | 834 | disass64 = disass64, |
835 | disass64 = disass64_ | 835 | regname = regname, |
836 | regname = regname_ | 836 | regname64 = regname64 |
837 | regname64 = 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) | |||
694 | end | 694 | end |
695 | 695 | ||
696 | -- Public module functions. | 696 | -- Public module functions. |
697 | module(...) | 697 | return { |
698 | 698 | on = dumpon, | |
699 | on = dumpon | 699 | off = dumpoff, |
700 | off = dumpoff | 700 | start = dumpon -- For -j command line option. |
701 | start = 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) | |||
159 | end | 159 | end |
160 | 160 | ||
161 | -- Public module functions. | 161 | -- Public module functions. |
162 | module(...) | 162 | return { |
163 | 163 | on = dumpon, | |
164 | on = dumpon | 164 | off = dumpoff, |
165 | off = dumpoff | 165 | start = dumpon -- For -j command line option. |
166 | start = dumpon -- For -j command line option. | 166 | } |
167 | 167 | ||