mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-08 07:34:07 +00:00
Get rid of module() in all internal modules.
This commit is contained in:
parent
647cc4613f
commit
fe87736777
@ -314,20 +314,20 @@ static void emit_vmdef(BuildCtx *ctx)
|
|||||||
char buf[80];
|
char buf[80];
|
||||||
int i;
|
int i;
|
||||||
fprintf(ctx->fp, "-- This is a generated file. DO NOT EDIT!\n\n");
|
fprintf(ctx->fp, "-- This is a generated file. DO NOT EDIT!\n\n");
|
||||||
fprintf(ctx->fp, "module(...)\n\n");
|
fprintf(ctx->fp, "return {\n\n");
|
||||||
|
|
||||||
fprintf(ctx->fp, "bcnames = \"");
|
fprintf(ctx->fp, "bcnames = \"");
|
||||||
for (i = 0; bc_names[i]; i++) fprintf(ctx->fp, "%-6s", bc_names[i]);
|
for (i = 0; bc_names[i]; i++) fprintf(ctx->fp, "%-6s", bc_names[i]);
|
||||||
fprintf(ctx->fp, "\"\n\n");
|
fprintf(ctx->fp, "\",\n\n");
|
||||||
|
|
||||||
fprintf(ctx->fp, "irnames = \"");
|
fprintf(ctx->fp, "irnames = \"");
|
||||||
for (i = 0; ir_names[i]; i++) fprintf(ctx->fp, "%-6s", ir_names[i]);
|
for (i = 0; ir_names[i]; i++) fprintf(ctx->fp, "%-6s", ir_names[i]);
|
||||||
fprintf(ctx->fp, "\"\n\n");
|
fprintf(ctx->fp, "\",\n\n");
|
||||||
|
|
||||||
fprintf(ctx->fp, "irfpm = { [0]=");
|
fprintf(ctx->fp, "irfpm = { [0]=");
|
||||||
for (i = 0; irfpm_names[i]; i++)
|
for (i = 0; irfpm_names[i]; i++)
|
||||||
fprintf(ctx->fp, "\"%s\", ", lower(buf, irfpm_names[i]));
|
fprintf(ctx->fp, "\"%s\", ", lower(buf, irfpm_names[i]));
|
||||||
fprintf(ctx->fp, "}\n\n");
|
fprintf(ctx->fp, "},\n\n");
|
||||||
|
|
||||||
fprintf(ctx->fp, "irfield = { [0]=");
|
fprintf(ctx->fp, "irfield = { [0]=");
|
||||||
for (i = 0; irfield_names[i]; i++) {
|
for (i = 0; irfield_names[i]; i++) {
|
||||||
@ -337,17 +337,17 @@ static void emit_vmdef(BuildCtx *ctx)
|
|||||||
if (p) *p = '.';
|
if (p) *p = '.';
|
||||||
fprintf(ctx->fp, "\"%s\", ", buf);
|
fprintf(ctx->fp, "\"%s\", ", buf);
|
||||||
}
|
}
|
||||||
fprintf(ctx->fp, "}\n\n");
|
fprintf(ctx->fp, "},\n\n");
|
||||||
|
|
||||||
fprintf(ctx->fp, "ircall = {\n[0]=");
|
fprintf(ctx->fp, "ircall = {\n[0]=");
|
||||||
for (i = 0; ircall_names[i]; i++)
|
for (i = 0; ircall_names[i]; i++)
|
||||||
fprintf(ctx->fp, "\"%s\",\n", ircall_names[i]);
|
fprintf(ctx->fp, "\"%s\",\n", ircall_names[i]);
|
||||||
fprintf(ctx->fp, "}\n\n");
|
fprintf(ctx->fp, "},\n\n");
|
||||||
|
|
||||||
fprintf(ctx->fp, "traceerr = {\n[0]=");
|
fprintf(ctx->fp, "traceerr = {\n[0]=");
|
||||||
for (i = 0; trace_errors[i]; i++)
|
for (i = 0; trace_errors[i]; i++)
|
||||||
fprintf(ctx->fp, "\"%s\",\n", trace_errors[i]);
|
fprintf(ctx->fp, "\"%s\",\n", trace_errors[i]);
|
||||||
fprintf(ctx->fp, "}\n\n");
|
fprintf(ctx->fp, "},\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -- Argument parsing ---------------------------------------------------- */
|
/* -- Argument parsing ---------------------------------------------------- */
|
||||||
@ -484,6 +484,7 @@ int main(int argc, char **argv)
|
|||||||
case BUILD_vmdef:
|
case BUILD_vmdef:
|
||||||
emit_vmdef(ctx);
|
emit_vmdef(ctx);
|
||||||
emit_lib(ctx);
|
emit_lib(ctx);
|
||||||
|
fprintf(ctx->fp, "}\n\n");
|
||||||
break;
|
break;
|
||||||
case BUILD_ffdef:
|
case BUILD_ffdef:
|
||||||
case BUILD_libdef:
|
case BUILD_libdef:
|
||||||
|
@ -432,7 +432,7 @@ void emit_lib(BuildCtx *ctx)
|
|||||||
"#ifndef FF_NUM_ASMFUNC\n#define FF_NUM_ASMFUNC %d\n#endif\n\n",
|
"#ifndef FF_NUM_ASMFUNC\n#define FF_NUM_ASMFUNC %d\n#endif\n\n",
|
||||||
ffasmfunc);
|
ffasmfunc);
|
||||||
} else if (ctx->mode == BUILD_vmdef) {
|
} else if (ctx->mode == BUILD_vmdef) {
|
||||||
fprintf(ctx->fp, "}\n\n");
|
fprintf(ctx->fp, "},\n\n");
|
||||||
} else if (ctx->mode == BUILD_bcdef) {
|
} else if (ctx->mode == BUILD_bcdef) {
|
||||||
int i;
|
int i;
|
||||||
fprintf(ctx->fp, "\n};\n\n");
|
fprintf(ctx->fp, "\n};\n\n");
|
||||||
|
@ -179,13 +179,12 @@ local function bcliston(outfile)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Public module functions.
|
-- Public module functions.
|
||||||
module(...)
|
return {
|
||||||
|
line = bcline,
|
||||||
line = bcline
|
dump = bcdump,
|
||||||
dump = bcdump
|
targets = bctargets,
|
||||||
targets = bctargets
|
on = bcliston,
|
||||||
|
off = bclistoff,
|
||||||
on = bcliston
|
start = bcliston -- For -j command line option.
|
||||||
off = bclistoff
|
}
|
||||||
start = bcliston -- For -j command line option.
|
|
||||||
|
|
||||||
|
@ -653,7 +653,7 @@ end
|
|||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- Public module functions.
|
-- Public module functions.
|
||||||
module(...)
|
return {
|
||||||
|
start = docmd -- Process -b command line option.
|
||||||
start = docmd -- Process -b command line option.
|
}
|
||||||
|
|
||||||
|
@ -658,7 +658,7 @@ local function disass_block(ctx, ofs, len)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).
|
-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).
|
||||||
local function create_(code, addr, out)
|
local function create(code, addr, out)
|
||||||
local ctx = {}
|
local ctx = {}
|
||||||
ctx.code = code
|
ctx.code = code
|
||||||
ctx.addr = addr or 0
|
ctx.addr = addr or 0
|
||||||
@ -670,20 +670,20 @@ local function create_(code, addr, out)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Simple API: disassemble code (a string) at address and output via out.
|
-- Simple API: disassemble code (a string) at address and output via out.
|
||||||
local function disass_(code, addr, out)
|
local function disass(code, addr, out)
|
||||||
create_(code, addr, out):disass()
|
create(code, addr, out):disass()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Return register name for RID.
|
-- Return register name for RID.
|
||||||
local function regname_(r)
|
local function regname(r)
|
||||||
if r < 16 then return map_gpr[r] end
|
if r < 16 then return map_gpr[r] end
|
||||||
return "d"..(r-16)
|
return "d"..(r-16)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Public module functions.
|
-- Public module functions.
|
||||||
module(...)
|
return {
|
||||||
|
create = create,
|
||||||
create = create_
|
disass = disass,
|
||||||
disass = disass_
|
regname = regname
|
||||||
regname = regname_
|
}
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ local function disass_block(ctx, ofs, len)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).
|
-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).
|
||||||
local function create_(code, addr, out)
|
local function create(code, addr, out)
|
||||||
local ctx = {}
|
local ctx = {}
|
||||||
ctx.code = code
|
ctx.code = code
|
||||||
ctx.addr = addr or 0
|
ctx.addr = addr or 0
|
||||||
@ -396,33 +396,33 @@ local function create_(code, addr, out)
|
|||||||
return ctx
|
return ctx
|
||||||
end
|
end
|
||||||
|
|
||||||
local function create_el_(code, addr, out)
|
local function create_el(code, addr, out)
|
||||||
local ctx = create_(code, addr, out)
|
local ctx = create(code, addr, out)
|
||||||
ctx.get = get_le
|
ctx.get = get_le
|
||||||
return ctx
|
return ctx
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Simple API: disassemble code (a string) at address and output via out.
|
-- Simple API: disassemble code (a string) at address and output via out.
|
||||||
local function disass_(code, addr, out)
|
local function disass(code, addr, out)
|
||||||
create_(code, addr, out):disass()
|
create(code, addr, out):disass()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function disass_el_(code, addr, out)
|
local function disass_el(code, addr, out)
|
||||||
create_el_(code, addr, out):disass()
|
create_el(code, addr, out):disass()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Return register name for RID.
|
-- Return register name for RID.
|
||||||
local function regname_(r)
|
local function regname(r)
|
||||||
if r < 32 then return map_gpr[r] end
|
if r < 32 then return map_gpr[r] end
|
||||||
return "f"..(r-32)
|
return "f"..(r-32)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Public module functions.
|
-- Public module functions.
|
||||||
module(...)
|
return {
|
||||||
|
create = create,
|
||||||
create = create_
|
create_el = create_el,
|
||||||
create_el = create_el_
|
disass = disass,
|
||||||
disass = disass_
|
disass_el = disass_el,
|
||||||
disass_el = disass_el_
|
regname = regname
|
||||||
regname = regname_
|
}
|
||||||
|
|
||||||
|
@ -8,13 +8,10 @@
|
|||||||
-- MIPS disassembler module. All the interesting stuff is there.
|
-- MIPS disassembler module. All the interesting stuff is there.
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|
||||||
local require = require
|
local dis_mips = require((string.match(..., ".*%.") or "").."dis_mips")
|
||||||
|
return {
|
||||||
module(...)
|
create = dis_mips.create_el,
|
||||||
|
disass = dis_mips.disass_el,
|
||||||
local dis_mips = require(_PACKAGE.."dis_mips")
|
regname = dis_mips.regname
|
||||||
|
}
|
||||||
create = dis_mips.create_el
|
|
||||||
disass = dis_mips.disass_el
|
|
||||||
regname = dis_mips.regname
|
|
||||||
|
|
||||||
|
@ -560,7 +560,7 @@ local function disass_block(ctx, ofs, len)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).
|
-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).
|
||||||
local function create_(code, addr, out)
|
local function create(code, addr, out)
|
||||||
local ctx = {}
|
local ctx = {}
|
||||||
ctx.code = code
|
ctx.code = code
|
||||||
ctx.addr = addr or 0
|
ctx.addr = addr or 0
|
||||||
@ -572,20 +572,20 @@ local function create_(code, addr, out)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Simple API: disassemble code (a string) at address and output via out.
|
-- Simple API: disassemble code (a string) at address and output via out.
|
||||||
local function disass_(code, addr, out)
|
local function disass(code, addr, out)
|
||||||
create_(code, addr, out):disass()
|
create(code, addr, out):disass()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Return register name for RID.
|
-- Return register name for RID.
|
||||||
local function regname_(r)
|
local function regname(r)
|
||||||
if r < 32 then return map_gpr[r] end
|
if r < 32 then return map_gpr[r] end
|
||||||
return "f"..(r-32)
|
return "f"..(r-32)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Public module functions.
|
-- Public module functions.
|
||||||
module(...)
|
return {
|
||||||
|
create = create,
|
||||||
create = create_
|
disass = disass,
|
||||||
disass = disass_
|
regname = regname
|
||||||
regname = regname_
|
}
|
||||||
|
|
||||||
|
@ -8,13 +8,10 @@
|
|||||||
-- x86/x64 disassembler module. All the interesting stuff is there.
|
-- x86/x64 disassembler module. All the interesting stuff is there.
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|
||||||
local require = require
|
local dis_x86 = require((string.match(..., ".*%.") or "").."dis_x86")
|
||||||
|
return {
|
||||||
module(...)
|
create = dis_x86.create64,
|
||||||
|
disass = dis_x86.disass64,
|
||||||
local dis_x86 = require(_PACKAGE.."dis_x86")
|
regname = dis_x86.regname64
|
||||||
|
}
|
||||||
create = dis_x86.create64
|
|
||||||
disass = dis_x86.disass64
|
|
||||||
regname = dis_x86.regname64
|
|
||||||
|
|
||||||
|
@ -784,7 +784,7 @@ local function disass_block(ctx, ofs, len)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).
|
-- Extended API: create a disassembler context. Then call ctx:disass(ofs, len).
|
||||||
local function create_(code, addr, out)
|
local function create(code, addr, out)
|
||||||
local ctx = {}
|
local ctx = {}
|
||||||
ctx.code = code
|
ctx.code = code
|
||||||
ctx.addr = (addr or 0) - 1
|
ctx.addr = (addr or 0) - 1
|
||||||
@ -798,8 +798,8 @@ local function create_(code, addr, out)
|
|||||||
return ctx
|
return ctx
|
||||||
end
|
end
|
||||||
|
|
||||||
local function create64_(code, addr, out)
|
local function create64(code, addr, out)
|
||||||
local ctx = create_(code, addr, out)
|
local ctx = create(code, addr, out)
|
||||||
ctx.x64 = true
|
ctx.x64 = true
|
||||||
ctx.map1 = map_opc1_64
|
ctx.map1 = map_opc1_64
|
||||||
ctx.aregs = map_regs.Q
|
ctx.aregs = map_regs.Q
|
||||||
@ -807,32 +807,32 @@ local function create64_(code, addr, out)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Simple API: disassemble code (a string) at address and output via out.
|
-- Simple API: disassemble code (a string) at address and output via out.
|
||||||
local function disass_(code, addr, out)
|
local function disass(code, addr, out)
|
||||||
create_(code, addr, out):disass()
|
create(code, addr, out):disass()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function disass64_(code, addr, out)
|
local function disass64(code, addr, out)
|
||||||
create64_(code, addr, out):disass()
|
create64(code, addr, out):disass()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Return register name for RID.
|
-- Return register name for RID.
|
||||||
local function regname_(r)
|
local function regname(r)
|
||||||
if r < 8 then return map_regs.D[r+1] end
|
if r < 8 then return map_regs.D[r+1] end
|
||||||
return map_regs.X[r-7]
|
return map_regs.X[r-7]
|
||||||
end
|
end
|
||||||
|
|
||||||
local function regname64_(r)
|
local function regname64(r)
|
||||||
if r < 16 then return map_regs.Q[r+1] end
|
if r < 16 then return map_regs.Q[r+1] end
|
||||||
return map_regs.X[r-15]
|
return map_regs.X[r-15]
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Public module functions.
|
-- Public module functions.
|
||||||
module(...)
|
return {
|
||||||
|
create = create,
|
||||||
create = create_
|
create64 = create64,
|
||||||
create64 = create64_
|
disass = disass,
|
||||||
disass = disass_
|
disass64 = disass64,
|
||||||
disass64 = disass64_
|
regname = regname,
|
||||||
regname = regname_
|
regname64 = regname64
|
||||||
regname64 = regname64_
|
}
|
||||||
|
|
||||||
|
@ -694,9 +694,9 @@ local function dumpon(opt, outfile)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Public module functions.
|
-- Public module functions.
|
||||||
module(...)
|
return {
|
||||||
|
on = dumpon,
|
||||||
on = dumpon
|
off = dumpoff,
|
||||||
off = dumpoff
|
start = dumpon -- For -j command line option.
|
||||||
start = dumpon -- For -j command line option.
|
}
|
||||||
|
|
||||||
|
@ -159,9 +159,9 @@ local function dumpon(outfile)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Public module functions.
|
-- Public module functions.
|
||||||
module(...)
|
return {
|
||||||
|
on = dumpon,
|
||||||
on = dumpon
|
off = dumpoff,
|
||||||
off = dumpoff
|
start = dumpon -- For -j command line option.
|
||||||
start = dumpon -- For -j command line option.
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user