Skip to content

Commit ac3be4b

Browse files
committed
do not compile forwardable iseqs
1 parent 82849fe commit ac3be4b

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

lib/ruby_vm/rjit/insn_compiler.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,6 +1435,10 @@ def send(jit, ctx, asm)
14351435
mid = C.vm_ci_mid(cd.ci)
14361436
calling = build_calling(ci: cd.ci, block_handler: blockiseq)
14371437

1438+
if calling.flags & C::VM_CALL_FORWARDING != 0
1439+
return CantCompile
1440+
end
1441+
14381442
# vm_sendish
14391443
cme, comptime_recv_klass = jit_search_method(jit, ctx, asm, mid, calling)
14401444
if cme == CantCompile
@@ -4622,6 +4626,11 @@ def jit_call_iseq(jit, ctx, asm, cme, calling, iseq, frame_type: nil, prev_ep: n
46224626
end
46234627
end
46244628

4629+
# Don't compile forwardable iseqs
4630+
if iseq.body.param.flags.forwardable
4631+
return CantCompile
4632+
end
4633+
46254634
# We will not have CantCompile from here.
46264635

46274636
if block_arg

rjit_c.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ def rb_iseqw_to_iseq(iseqw)
420420
C::VM_CALL_ARGS_BLOCKARG = Primitive.cexpr! %q{ SIZET2NUM(VM_CALL_ARGS_BLOCKARG) }
421421
C::VM_CALL_ARGS_SPLAT = Primitive.cexpr! %q{ SIZET2NUM(VM_CALL_ARGS_SPLAT) }
422422
C::VM_CALL_FCALL = Primitive.cexpr! %q{ SIZET2NUM(VM_CALL_FCALL) }
423+
C::VM_CALL_FORWARDING = Primitive.cexpr! %q{ SIZET2NUM(VM_CALL_FORWARDING) }
423424
C::VM_CALL_KWARG = Primitive.cexpr! %q{ SIZET2NUM(VM_CALL_KWARG) }
424425
C::VM_CALL_KW_SPLAT = Primitive.cexpr! %q{ SIZET2NUM(VM_CALL_KW_SPLAT) }
425426
C::VM_CALL_KW_SPLAT_MUT = Primitive.cexpr! %q{ SIZET2NUM(VM_CALL_KW_SPLAT_MUT) }
@@ -1094,7 +1095,7 @@ def C.rb_iseq_constant_body
10941095
anon_rest: [CType::BitField.new(1, 2), 10],
10951096
anon_kwrest: [CType::BitField.new(1, 3), 11],
10961097
use_block: [CType::BitField.new(1, 4), 12],
1097-
forwardable: [CType::BitField.new(1, 4), 13],
1098+
forwardable: [CType::BitField.new(1, 5), 13],
10981099
), Primitive.cexpr!("OFFSETOF(((struct rb_iseq_constant_body *)NULL)->param, flags)")],
10991100
size: [CType::Immediate.parse("unsigned int"), Primitive.cexpr!("OFFSETOF(((struct rb_iseq_constant_body *)NULL)->param, size)")],
11001101
lead_num: [CType::Immediate.parse("int"), Primitive.cexpr!("OFFSETOF(((struct rb_iseq_constant_body *)NULL)->param, lead_num)")],

tool/rjit/bindgen.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ def push_target(target)
447447
VM_CALL_ARGS_BLOCKARG
448448
VM_CALL_ARGS_SPLAT
449449
VM_CALL_FCALL
450+
VM_CALL_FORWARDING
450451
VM_CALL_KWARG
451452
VM_CALL_KW_SPLAT
452453
VM_CALL_KW_SPLAT_MUT

0 commit comments

Comments
 (0)