ruby-changes:33660
From: ktsj <ko1@a...>
Date: Tue, 29 Apr 2014 10:25:41 +0900 (JST)
Subject: [ruby-changes:33660] ktsj:r45741 (trunk): * parse.y (symbols_i): like r45492, call rb_gc_resurrect().
ktsj 2014-04-29 10:25:36 +0900 (Tue, 29 Apr 2014) New Revision: 45741 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45741 Log: * parse.y (symbols_i): like r45492, call rb_gc_resurrect(). Modified files: trunk/ChangeLog trunk/parse.y trunk/test/ruby/test_symbol.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 45740) +++ ChangeLog (revision 45741) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Apr 29 10:21:38 2014 Kazuki Tsujimoto <kazuki@c...> + + * parse.y (symbols_i): like r45492, call rb_gc_resurrect(). + Tue Apr 29 04:29:05 2014 Kazuhiro NISHIYAMA <zn@m...> * file.c (HAVE_STRUCT_STATFS_T_F_FSTYPENAME): Add new macro for Index: parse.y =================================================================== --- parse.y (revision 45740) +++ parse.y (revision 45741) @@ -10908,9 +10908,13 @@ rb_make_internal_id(void) https://github.com/ruby/ruby/blob/trunk/parse.y#L10908 } static int -symbols_i(VALUE sym, ID value, VALUE ary) +symbols_i(VALUE key, ID value, VALUE ary) { - rb_ary_push(ary, ID2SYM(value)); + VALUE sym = ID2SYM(value); + if (ID_DYNAMIC_SYM_P(value)) { + rb_gc_resurrect(sym); + } + rb_ary_push(ary, sym); return ST_CONTINUE; } Index: test/ruby/test_symbol.rb =================================================================== --- test/ruby/test_symbol.rb (revision 45740) +++ test/ruby/test_symbol.rb (revision 45741) @@ -232,5 +232,9 @@ class TestSymbol < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_symbol.rb#L232 assert_normal_exit('".".intern;GC.start(immediate_sweep:false);eval %[GC.start;%i"."]', '', child_env: '--disable-gems') + assert_normal_exit('tap{".".intern};GC.start(immediate_sweep:false);' + + 'eval %[syms=Symbol.all_symbols;GC.start;syms.each(&:to_sym)]', + '', + child_env: '--disable-gems') end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/