Skip to content

Commit

Permalink
Disable tailcall optimization [Bug #15303]
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Dec 12, 2018
1 parent c33e716 commit 241dced
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 14 deletions.
5 changes: 1 addition & 4 deletions ext/rubyvm/lib/forwardable/impl.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# :stopdoc:
module Forwardable
FILTER_EXCEPTION = ""

def self._valid_method?(method)
iseq = RubyVM::InstructionSequence.compile("().#{method}", nil, nil, 0, false)
rescue SyntaxError
Expand All @@ -12,8 +10,7 @@ def self._valid_method?(method)

def self._compile_method(src, file, line)
RubyVM::InstructionSequence.compile(src, file, file, line,
trace_instruction: false,
tailcall_optimization: true)
trace_instruction: false)
.eval
end
end
2 changes: 1 addition & 1 deletion lib/forwardable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def #{ali}(*args, &block)
#{pre}
begin
#{accessor}
end#{method_call}#{FILTER_EXCEPTION}
end#{method_call}
end
end
end;
Expand Down
8 changes: 0 additions & 8 deletions lib/forwardable/impl.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# :stopdoc:
module Forwardable
FILE_REGEXP = %r"#{Regexp.quote(File.dirname(__FILE__))}"
FILTER_EXCEPTION = <<-'END'
rescue ::Exception
[email protected]_if {|s| ::Forwardable::FILE_REGEXP =~ s} unless ::Forwardable::debug
::Kernel::raise
END

def self._valid_method?(method)
catch {|tag|
eval("BEGIN{throw tag}; ().#{method}", binding, __FILE__, __LINE__)
Expand Down
2 changes: 1 addition & 1 deletion template/prelude.c.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ prelude_eval(VALUE code, VALUE name, int line)
static const rb_compile_option_t optimization = {
TRUE, /* int inline_const_cache; */
TRUE, /* int peephole_optimization; */
TRUE, /* int tailcall_optimization; */
FALSE,/* int tailcall_optimization; */
TRUE, /* int specialized_instruction; */
TRUE, /* int operands_unification; */
TRUE, /* int instructions_unification; */
Expand Down

0 comments on commit 241dced

Please sign in to comment.