diff options
| author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-20 13:23:02 +0000 |
|---|---|---|
| committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-20 13:23:02 +0000 |
| commit | c870705df4b76913c4e335ca5e4a92e5f833f940 (patch) | |
| tree | 0e577df4ea0600f82231958d9af21c4153883f19 | |
| parent | cc3a7df13ba3e7329f20c9fd48b488d8b3329416 (diff) | |
merges r29885 from trunk into ruby_1_9_2.
--
* vm.c (rb_thread_mark): should mark self in conrol
frames. [ruby-core:33289]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | test/ruby/test_optimization.rb | 23 | ||||
| -rw-r--r-- | version.h | 2 | ||||
| -rw-r--r-- | vm.c | 1 |
4 files changed, 30 insertions, 1 deletions
@@ -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] + Sat Oct 30 00:35:13 2010 Koichi Sasada <ko1@atdot.net> * iseq.c (iseq_s_compile): fix optional argument. diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb index 8e8311e6ef..b581b7dfd3 100644 --- a/test/ruby/test_optimization.rb +++ b/test/ruby/test_optimization.rb @@ -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, 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 @@ -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 @@ -1650,6 +1650,7 @@ rb_thread_mark(void *ptr) 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); } |
