Fix MJIT's ISEQ_BODY macro usage at 5f10bd634fb
This commit is contained in:
parent
2931957d6f
commit
90b240d127
@ -370,7 +370,7 @@ mjit_compile_body(FILE *f, const rb_iseq_t *iseq, struct compile_status *status)
|
||||
if (body->param.flags.has_opt) {
|
||||
int i;
|
||||
fprintf(f, "\n");
|
||||
fprintf(f, " switch (reg_cfp->pc - reg_cfp->ISEQ_BODY(iseq)->iseq_encoded) {\n");
|
||||
fprintf(f, " switch (reg_cfp->pc - ISEQ_BODY(reg_cfp->iseq)->iseq_encoded) {\n");
|
||||
for (i = 0; i <= body->param.opt_num; i++) {
|
||||
VALUE pc_offset = body->param.opt_table[i];
|
||||
fprintf(f, " case %"PRIdVALUE":\n", pc_offset);
|
||||
|
@ -621,6 +621,16 @@ class TestMJIT < Test::Unit::TestCase
|
||||
end;
|
||||
end
|
||||
|
||||
def test_compile_opt_pc
|
||||
assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: 'hello', success_count: 1)
|
||||
begin;
|
||||
def test(arg = 'hello')
|
||||
print arg
|
||||
end
|
||||
test
|
||||
end;
|
||||
end
|
||||
|
||||
def test_mjit_output
|
||||
out, err = eval_with_jit('5.times { puts "MJIT" }', verbose: 1, min_calls: 5)
|
||||
assert_equal("MJIT\n" * 5, out)
|
||||
|
Loading…
x
Reference in New Issue
Block a user