* vm.c (rb_thread_mark): should mark self in conrol
frames. [ruby-core:33289] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b828fb85dd
commit
3c575a15c2
@ -1,3 +1,8 @@
|
||||
Tue Nov 23 18:54:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm.c (rb_thread_mark): should mark self in conrol
|
||||
frames. [ruby-core:33289]
|
||||
|
||||
Tue Nov 23 07:57:31 2010 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* lib/date/delta/parser.{ry,rb}: fixed a bug of token scanner.
|
||||
|
@ -137,4 +137,27 @@ class TestRubyOptimization < Test::Unit::TestCase
|
||||
assert_equal true, MyObj.new == nil
|
||||
end
|
||||
|
||||
def test_tailcall
|
||||
bug4082 = '[ruby-core:33289]'
|
||||
|
||||
option = {
|
||||
tailcall_optimization: true,
|
||||
trace_instruction: false,
|
||||
}
|
||||
iseq = RubyVM::InstructionSequence.new(<<-EOF, "Bug#4082", bug4082, nil, option).eval
|
||||
class #{self.class}::Tailcall
|
||||
def fact_helper(n, res)
|
||||
if n == 1
|
||||
res
|
||||
else
|
||||
fact_helper(n - 1, n * res)
|
||||
end
|
||||
end
|
||||
def fact(n)
|
||||
fact_helper(n, 1)
|
||||
end
|
||||
end
|
||||
EOF
|
||||
assert_equal(9131, Tailcall.new.fact(3000).to_s.size, bug4082)
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user