Feature #19780
Updated by k0kubun (Takashi Kokubun) about 1 year ago
## Proposal
Remove `tailcall_optimization` flag from `RubyVM::InstructionSequence`
## 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.
```rb
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, or add another flag in iseqs, which will consume more memory. It just doesn't seem worth the effort.