Skip to content

Commit 90b240d

Browse files
committed
Fix MJIT's ISEQ_BODY macro usage at 5f10bd6
1 parent 2931957 commit 90b240d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

mjit_compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ mjit_compile_body(FILE *f, const rb_iseq_t *iseq, struct compile_status *status)
370370
if (body->param.flags.has_opt) {
371371
int i;
372372
fprintf(f, "\n");
373-
fprintf(f, " switch (reg_cfp->pc - reg_cfp->ISEQ_BODY(iseq)->iseq_encoded) {\n");
373+
fprintf(f, " switch (reg_cfp->pc - ISEQ_BODY(reg_cfp->iseq)->iseq_encoded) {\n");
374374
for (i = 0; i <= body->param.opt_num; i++) {
375375
VALUE pc_offset = body->param.opt_table[i];
376376
fprintf(f, " case %"PRIdVALUE":\n", pc_offset);

test/ruby/test_mjit.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,16 @@ def test_compile_insn_checkmatch
621621
end;
622622
end
623623

624+
def test_compile_opt_pc
625+
assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: 'hello', success_count: 1)
626+
begin;
627+
def test(arg = 'hello')
628+
print arg
629+
end
630+
test
631+
end;
632+
end
633+
624634
def test_mjit_output
625635
out, err = eval_with_jit('5.times { puts "MJIT" }', verbose: 1, min_calls: 5)
626636
assert_equal("MJIT\n" * 5, out)

0 commit comments

Comments
 (0)