From c7572f2fe777c96880905ee37ab313cd52b5aa51 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 6 Dec 2013 07:50:19 +0000 Subject: thread.c: compare_by_id * thread.c (recursive_list_access): let symbol only hashes compare the elements by id. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'thread.c') diff --git a/thread.c b/thread.c index f111a5f0da..2ee530f6b6 100644 --- a/thread.c +++ b/thread.c @@ -4738,6 +4738,16 @@ rb_thread_shield_destroy(VALUE self) /* 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) 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) 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; -- cgit v1.2.3