Feature #19780
openRemove tailcall_optimization support
Description
Proposal¶
Remove tailcall_optimization
support from RubyVM::InstructionSequence
(make it no-op)
Motivation¶
The consensus at [Feature #6602] seems to be that we're not going to enable tailcall optimization by default until we introduce syntax for it. Until this syntax is introduced, this feature is useless. Can we remove this flag until we do support that future syntax?
Background¶
This script crashes with --yjit-call-threshold=1
on any YJIT-enabled build.
src = <<-EOS
def apply_one_and_two(&block)
[1, p(1)]
end
def add_one_and_two
apply_one_and_two(&:+)
end
EOS
RubyVM::InstructionSequence.new(
"proc {|_|_.class_eval {#{src}}}",
__FILE__, __FILE__, 1,
tailcall_optimization: true,
trace_instruction: false,
).eval[self.singleton_class]
def entry
add_one_and_two
end
entry
I already wasted a lot of time just for noticing it's already broken. I don't want to waste time for users that do not exist yet.
It's possible to fix, but you need to add some code that needs to be executed even if you don't enable it unless you add another flag to iseqs (which will consume more memory). The complexity just doesn't seem worth it. Removing tailcall support would simplify the implementation and problems we need to deal with.