Move bytecode offsets from lj_vm.* to generated header.
This commit is contained in:
@@ -251,6 +251,19 @@ static const char *lower(char *buf, const char *s)
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* Emit C source code for bytecode-related definitions. */
|
||||
static void emit_bcdef(BuildCtx *ctx)
|
||||
{
|
||||
int i;
|
||||
fprintf(ctx->fp, "/* This is a generated file. DO NOT EDIT! */\n\n");
|
||||
fprintf(ctx->fp, "LJ_DATADEF const uint16_t lj_bc_ofs[BC__MAX+1] = {\n ");
|
||||
for (i = 0; i < ctx->npc; i++) {
|
||||
fprintf(ctx->fp, "%4d, ", ctx->sym_ofs[i]);
|
||||
if ((i & 7) == 7) fprintf(ctx->fp, "\n ");
|
||||
}
|
||||
fprintf(ctx->fp, "0\n};\n\n");
|
||||
}
|
||||
|
||||
/* Emit VM definitions as Lua code for debug modules. */
|
||||
static void emit_vmdef(BuildCtx *ctx)
|
||||
{
|
||||
@@ -418,6 +431,9 @@ int main(int argc, char **argv)
|
||||
case BUILD_raw:
|
||||
emit_raw(ctx);
|
||||
break;
|
||||
case BUILD_bcdef:
|
||||
emit_bcdef(ctx);
|
||||
break;
|
||||
case BUILD_vmdef:
|
||||
emit_vmdef(ctx);
|
||||
/* fallthrough */
|
||||
|
||||
Reference in New Issue
Block a user