[前][次][番号順一覧][スレッド一覧]

ruby-changes:33413

From: ktsj <ko1@a...>
Date: Tue, 1 Apr 2014 09:08:04 +0900 (JST)
Subject: [ruby-changes:33413] ktsj:r45492 (trunk): * parse.y (rb_str_dynamic_intern): set mark bit if dynamic symbol

ktsj	2014-04-01 09:07:58 +0900 (Tue, 01 Apr 2014)

  New Revision: 45492

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45492

  Log:
    * parse.y (rb_str_dynamic_intern): set mark bit if dynamic symbol
      is before sweeping.

  Modified files:
    trunk/ChangeLog
    trunk/parse.y
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45491)
+++ ChangeLog	(revision 45492)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Apr  1 08:58:39 2014  Kazuki Tsujimoto  <kazuki@c...>
+
+	* parse.y (rb_str_dynamic_intern): set mark bit if dynamic symbol
+	  is before sweeping.
+
 Tue Apr  1 07:37:00 2014  NARUSE, Yui  <naruse@r...>
 
 	* addr2line.c (fill_lines): use dynsym, which is used for dynamic
Index: parse.y
===================================================================
--- parse.y	(revision 45491)
+++ parse.y	(revision 45492)
@@ -10705,7 +10705,13 @@ rb_str_dynamic_intern(VALUE str) https://github.com/ruby/ruby/blob/trunk/parse.y#L10705
     ID id, type;
 
     if (st_lookup(global_symbols.sym_id, str, &id)) {
-	return ID2SYM(id);
+	VALUE sym = ID2SYM(id);
+	if (!STATIC_SYM_P(sym)) {
+	    /* because of lazy sweep, dynamic symbol may be unmarked already and swept
+	     * at next time */
+	    rb_gc_resurrect(sym);
+	}
+	return sym;
     }
 
     enc = rb_enc_get(str);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]