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

ruby-changes:31955

From: nobu <ko1@a...>
Date: Fri, 6 Dec 2013 16:50:23 +0900 (JST)
Subject: [ruby-changes:31955] nobu:r44034 (trunk): thread.c: compare_by_id

nobu	2013-12-06 16:50:19 +0900 (Fri, 06 Dec 2013)

  New Revision: 44034

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

  Log:
    thread.c: compare_by_id
    
    * thread.c (recursive_list_access): let symbol only hashes compare
      the elements by id.

  Modified files:
    trunk/thread.c
Index: thread.c
===================================================================
--- thread.c	(revision 44033)
+++ thread.c	(revision 44034)
@@ -4738,6 +4738,16 @@ rb_thread_shield_destroy(VALUE self) https://github.com/ruby/ruby/blob/trunk/thread.c#L4738
 /* variables for recursive traversals */
 static ID recursive_key;
 
+extern const struct st_hash_type st_hashtype_num;
+
+static VALUE
+ident_hash_new(void)
+{
+    VALUE hash = rb_hash_new();
+    rb_hash_tbl_raw(hash)->type = &st_hashtype_num;
+    return hash;
+}
+
 /*
  * Returns the current "recursive list" used to detect recursion.
  * This list is a hash table, unique for the current thread and for
@@ -4751,7 +4761,7 @@ recursive_list_access(void) https://github.com/ruby/ruby/blob/trunk/thread.c#L4761
     VALUE sym = ID2SYM(rb_frame_this_func());
     VALUE list;
     if (NIL_P(hash) || !RB_TYPE_P(hash, T_HASH)) {
-	hash = rb_hash_new();
+	hash = ident_hash_new();
 	rb_thread_local_aset(rb_thread_current(), recursive_key, hash);
 	list = Qnil;
     }
@@ -4759,7 +4769,7 @@ recursive_list_access(void) https://github.com/ruby/ruby/blob/trunk/thread.c#L4769
 	list = rb_hash_aref(hash, sym);
     }
     if (NIL_P(list) || !RB_TYPE_P(list, T_HASH)) {
-	list = rb_hash_new();
+	list = ident_hash_new();
 	rb_hash_aset(hash, sym, list);
     }
     return list;

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

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