ruby-changes:26544
From: usa <ko1@a...>
Date: Tue, 25 Dec 2012 19:14:22 +0900 (JST)
Subject: [ruby-changes:26544] usa:r38595 (trunk): * bignum.c, include/ruby/intern.h (rb_big_eql): exported.
usa 2012-12-25 19:14:12 +0900 (Tue, 25 Dec 2012) New Revision: 38595 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38595 Log: * 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] Modified files: trunk/ChangeLog trunk/bignum.c trunk/include/ruby/intern.h trunk/thread.c Index: include/ruby/intern.h =================================================================== --- include/ruby/intern.h (revision 38594) +++ include/ruby/intern.h (revision 38595) @@ -124,6 +124,7 @@ VALUE rb_dbl2big(double); https://github.com/ruby/ruby/blob/trunk/include/ruby/intern.h#L124 double rb_big2dbl(VALUE); VALUE rb_big_cmp(VALUE, VALUE); VALUE rb_big_eq(VALUE, VALUE); +VALUE rb_big_eql(VALUE, VALUE); VALUE rb_big_plus(VALUE, VALUE); VALUE rb_big_minus(VALUE, VALUE); VALUE rb_big_mul(VALUE, VALUE); Index: ChangeLog =================================================================== --- ChangeLog (revision 38594) +++ ChangeLog (revision 38595) @@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Dec 25 19:09:51 2012 NAKAMURA Usaku <usa@r...> + + * 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] + Tue Dec 25 18:53:35 2012 Koichi Sasada <ko1@a...> * vm_core.h, eval_intern.h (CHECK_STACK_OVERFLOW): move Index: thread.c =================================================================== --- thread.c (revision 38594) +++ thread.c (revision 38595) @@ -4599,7 +4599,7 @@ recursive_list_access(void) https://github.com/ruby/ruby/blob/trunk/thread.c#L4599 } /* - * Returns Qtrue iff obj_id (or the pair <obj, paired_obj>) is already + * Returns Qtrue if obj_id (or the pair <obj, paired_obj>) is already * in the recursion list. * Assumes the recursion list is valid. */ @@ -4607,17 +4607,24 @@ recursive_list_access(void) https://github.com/ruby/ruby/blob/trunk/thread.c#L4607 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 (!RB_TYPE_P(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; Index: bignum.c =================================================================== --- bignum.c (revision 38594) +++ bignum.c (revision 38595) @@ -1710,7 +1710,7 @@ rb_big_eq(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/bignum.c#L1710 * 68719476736.eql?(68719476736.0) #=> false */ -static VALUE +VALUE rb_big_eql(VALUE x, VALUE y) { if (!RB_TYPE_P(y, T_BIGNUM)) return Qfalse; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/