diff options
author | Mike Pall <mike> | 2010-02-13 04:51:56 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2010-02-13 04:51:56 +0100 |
commit | c93138b59e8f28b3d412cd7ec0c6631fd27e3e1b (patch) | |
tree | 8c0ffe2086ab0b032ed8e9f92ae6fb9d4d040d66 /src/buildvm.c | |
parent | 4f8d7be8ea8a103f4d9046188d6005740b74f3d4 (diff) | |
download | luajit-c93138b59e8f28b3d412cd7ec0c6631fd27e3e1b.tar.gz luajit-c93138b59e8f28b3d412cd7ec0c6631fd27e3e1b.tar.bz2 luajit-c93138b59e8f28b3d412cd7ec0c6631fd27e3e1b.zip |
Major redesign of function call handling.
Drop call gates. Use function headers, dispatched like bytecodes.
Emit BC_FUNCF/BC_FUNCV bytecode at PC 0 for all Lua functions.
C functions and ASM fast functions get extra bytecodes.
Modify internal calling convention: new base in BASE (formerly in RA).
Can now use better C function wrapper semantics (dynamic on/off).
Prerequisite for call hooks with zero-overhead if disabled.
Prerequisite for compiling recursive calls.
Prerequisite for efficient 32/64 bit prototype guards.
Diffstat (limited to 'src/buildvm.c')
-rw-r--r-- | src/buildvm.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/buildvm.c b/src/buildvm.c index 44fd2c71..dd0cbcc6 100644 --- a/src/buildvm.c +++ b/src/buildvm.c | |||
@@ -256,12 +256,12 @@ static void emit_bcdef(BuildCtx *ctx) | |||
256 | { | 256 | { |
257 | int i; | 257 | int i; |
258 | fprintf(ctx->fp, "/* This is a generated file. DO NOT EDIT! */\n\n"); | 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 "); | 259 | fprintf(ctx->fp, "LJ_DATADEF const uint16_t lj_bc_ofs[] = {\n"); |
260 | for (i = 0; i < ctx->npc; i++) { | 260 | for (i = 0; i < ctx->npc; i++) { |
261 | fprintf(ctx->fp, " %4d,", ctx->sym_ofs[i]); | 261 | if (i != 0) |
262 | if ((i & 7) == 7) fprintf(ctx->fp, "\n "); | 262 | fprintf(ctx->fp, ",\n"); |
263 | fprintf(ctx->fp, "%d", ctx->sym_ofs[i]); | ||
263 | } | 264 | } |
264 | fprintf(ctx->fp, " 0\n};\n\n"); | ||
265 | } | 265 | } |
266 | 266 | ||
267 | /* Emit VM definitions as Lua code for debug modules. */ | 267 | /* Emit VM definitions as Lua code for debug modules. */ |
@@ -433,10 +433,12 @@ int main(int argc, char **argv) | |||
433 | break; | 433 | break; |
434 | case BUILD_bcdef: | 434 | case BUILD_bcdef: |
435 | emit_bcdef(ctx); | 435 | emit_bcdef(ctx); |
436 | emit_lib(ctx); | ||
436 | break; | 437 | break; |
437 | case BUILD_vmdef: | 438 | case BUILD_vmdef: |
438 | emit_vmdef(ctx); | 439 | emit_vmdef(ctx); |
439 | /* fallthrough */ | 440 | emit_lib(ctx); |
441 | break; | ||
440 | case BUILD_ffdef: | 442 | case BUILD_ffdef: |
441 | case BUILD_libdef: | 443 | case BUILD_libdef: |
442 | case BUILD_recdef: | 444 | case BUILD_recdef: |