summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-25 11:42:55 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-25 11:42:55 +0000
commit8e095cea57a5a6d05a1e34654ad4f772c434fbe8 (patch)
treeb7a23a41ce59064e9f7b778447cd636a336e1738 /thread.c
parent2a9ac6af7c022fe79ecbfb4b40fa4b538eab9be9 (diff)
merge revision(s) 38595,38596: [Backport #7607]
* bignum.c, include/ruby/intern.h (rb_big_eql): exported. * thread.c (recursive_check): object_id maybe a Bignum, not Fixnum on LLP64. see also r38493 and r38548. reported by Heesob Park at [ruby-core:51083] [Bug #7607], and patched by shirosaki at [ruby-core:51095] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/thread.c b/thread.c
index 710035d828..5393e4b453 100644
--- a/thread.c
+++ b/thread.c
@@ -3855,17 +3855,24 @@ recursive_list_access(void)
static VALUE
recursive_check(VALUE list, VALUE obj_id, VALUE paired_obj_id)
{
+#if SIZEOF_LONG == SIZEOF_VOIDP
+ #define OBJ_ID_EQL(obj_id, other) ((obj_id) == (other))
+#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
+ #define OBJ_ID_EQL(obj_id, other) (RB_TYPE_P((obj_id), T_BIGNUM) ? \
+ rb_big_eql((obj_id), (other)) : ((obj_id) == (other)))
+#endif
+
VALUE pair_list = rb_hash_lookup2(list, obj_id, Qundef);
if (pair_list == Qundef)
return Qfalse;
if (paired_obj_id) {
if (TYPE(pair_list) != T_HASH) {
- if (pair_list != paired_obj_id)
- return Qfalse;
+ if (!OBJ_ID_EQL(paired_obj_id, pair_list))
+ return Qfalse;
}
else {
- if (NIL_P(rb_hash_lookup(pair_list, paired_obj_id)))
- return Qfalse;
+ if (NIL_P(rb_hash_lookup(pair_list, paired_obj_id)))
+ return Qfalse;
}
}
return Qtrue;