mirror of
https://github.com/DoneJS-Runtime/quickjs-done-nextgen.git
synced 2025-01-09 17:43:15 +00:00
Fix bytecode stack frame printing (#686)
Handle OP_get_loc0_loc1 specially. Fixes an off-by-one when printing variable names. Fixes: https://github.com/quickjs-ng/quickjs/issues/683
This commit is contained in:
parent
6d7448ed3e
commit
b5d41818e2
1 changed files with 11 additions and 2 deletions
13
quickjs.c
13
quickjs.c
|
@ -28783,8 +28783,17 @@ static void dump_byte_code(JSContext *ctx, int pass,
|
||||||
printf(",%u", get_u16(tab + pos + 8));
|
printf(",%u", get_u16(tab + pos + 8));
|
||||||
break;
|
break;
|
||||||
case OP_FMT_none_loc:
|
case OP_FMT_none_loc:
|
||||||
idx = (op - OP_get_loc0_loc1) % 4;
|
if (op == OP_get_loc0_loc1) {
|
||||||
goto has_loc;
|
printf(" 0, 1 ; ");
|
||||||
|
if (var_count > 0)
|
||||||
|
print_atom(ctx, vars[0].var_name);
|
||||||
|
if (var_count > 1)
|
||||||
|
print_atom(ctx, vars[1].var_name);
|
||||||
|
} else {
|
||||||
|
idx = (op - OP_get_loc0) % 4;
|
||||||
|
goto has_loc;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case OP_FMT_loc8:
|
case OP_FMT_loc8:
|
||||||
idx = get_u8(tab + pos);
|
idx = get_u8(tab + pos);
|
||||||
goto has_loc;
|
goto has_loc;
|
||||||
|
|
Loading…
Reference in a new issue