Skip to content

Print opcode count and total size in debug output #929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -28814,6 +28814,7 @@ static __maybe_unused void js_dump_function_bytecode(JSContext *ctx, JSFunctionB
int i;
char atom_buf[ATOM_GET_STR_BUF_SIZE];
const char *str;
const uint8_t *op;

if (b->filename != JS_ATOM_NULL) {
str = JS_AtomGetStr(ctx, atom_buf, sizeof(atom_buf), b->filename);
Expand Down Expand Up @@ -28860,7 +28861,11 @@ static __maybe_unused void js_dump_function_bytecode(JSContext *ctx, JSFunctionB
}
}
printf(" stack_size: %d\n", b->stack_size);
printf(" opcodes:\n");
printf(" byte_code_len: %d\n", b->byte_code_len);
op = b->byte_code_buf;
for (i = 0; op < &b->byte_code_buf[b->byte_code_len]; i++)
op += short_opcode_info(*op).size;
printf(" opcodes: %d\n", i);
dump_byte_code(ctx, 3, b->byte_code_buf, b->byte_code_len,
b->vardefs, b->arg_count,
b->vardefs ? b->vardefs + b->arg_count : NULL, b->var_count,
Expand Down
Loading