ruby-changes:18243
From: yugui <ko1@a...>
Date: Mon, 20 Dec 2010 22:30:46 +0900 (JST)
Subject: [ruby-changes:18243] Ruby:r30265 (ruby_1_9_2): merges r29885 from trunk into ruby_1_9_2.
yugui 2010-12-20 22:23:02 +0900 (Mon, 20 Dec 2010) New Revision: 30265 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30265 Log: merges r29885 from trunk into ruby_1_9_2. -- * vm.c (rb_thread_mark): should mark self in conrol frames. [ruby-core:33289] Modified files: branches/ruby_1_9_2/ChangeLog branches/ruby_1_9_2/test/ruby/test_optimization.rb branches/ruby_1_9_2/version.h branches/ruby_1_9_2/vm.c Index: ruby_1_9_2/ChangeLog =================================================================== --- ruby_1_9_2/ChangeLog (revision 30264) +++ ruby_1_9_2/ChangeLog (revision 30265) @@ -1,3 +1,8 @@ +Tue Nov 23 18:54:03 2010 Nobuyoshi Nakada <nobu@r...> + + * vm.c (rb_thread_mark): should mark self in conrol + frames. [ruby-core:33289] + Sat Oct 30 00:35:13 2010 Koichi Sasada <ko1@a...> * iseq.c (iseq_s_compile): fix optional argument. Index: ruby_1_9_2/vm.c =================================================================== --- ruby_1_9_2/vm.c (revision 30264) +++ ruby_1_9_2/vm.c (revision 30265) @@ -1650,6 +1650,7 @@ while (cfp != limit_cfp) { rb_iseq_t *iseq = cfp->iseq; rb_gc_mark(cfp->proc); + rb_gc_mark(cfp->self); if (iseq) { rb_gc_mark(RUBY_VM_NORMAL_ISEQ_P(iseq) ? iseq->self : (VALUE)iseq); } Index: ruby_1_9_2/version.h =================================================================== --- ruby_1_9_2/version.h (revision 30264) +++ ruby_1_9_2/version.h (revision 30265) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 105 +#define RUBY_PATCHLEVEL 106 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 Index: ruby_1_9_2/test/ruby/test_optimization.rb =================================================================== --- ruby_1_9_2/test/ruby/test_optimization.rb (revision 30264) +++ ruby_1_9_2/test/ruby/test_optimization.rb (revision 30265) @@ -137,4 +137,27 @@ 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, bug4082, __FILE__, __LINE__+1, 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/