Project

General

Profile

Actions

Feature #19780

open

Remove tailcall_optimization support

Added by k0kubun (Takashi Kokubun) 9 months ago. Updated 9 months ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:114252]

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.


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #19781: Stack consistency error with tailcall and YJIT enabledClosedyjitActions
Actions #1

Updated by k0kubun (Takashi Kokubun) 9 months ago

  • Description updated (diff)
Actions #2

Updated by k0kubun (Takashi Kokubun) 9 months ago

  • Description updated (diff)
Actions #3

Updated by k0kubun (Takashi Kokubun) 9 months ago

  • Description updated (diff)
Actions #4

Updated by k0kubun (Takashi Kokubun) 9 months ago

  • Description updated (diff)
Actions #5

Updated by k0kubun (Takashi Kokubun) 9 months ago

  • Related to Bug #19781: Stack consistency error with tailcall and YJIT enabled added
Actions #6

Updated by k0kubun (Takashi Kokubun) 9 months ago

  • Description updated (diff)
Actions #7

Updated by k0kubun (Takashi Kokubun) 9 months ago

  • Description updated (diff)
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0