1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* gc.c (obj_id_to_ref): add a macro to treat Bignum object id.

This follows the change r38493.

* gc.c (id2ref): fix for working fine with Bignum object id on x64
  Windows.
* gc.c (wmap_finalize): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shirosaki 2012-12-22 04:25:18 +00:00
parent f9e621372d
commit ca2fce0cf2
2 changed files with 14 additions and 2 deletions

View file

@ -1,3 +1,12 @@
Sat Dec 22 13:15:08 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
* gc.c (obj_id_to_ref): add a macro to treat Bignum object id.
This follows the change r38493.
* gc.c (id2ref): fix for working fine with Bignum object id on x64
Windows.
* gc.c (wmap_finalize): ditto.
Sat Dec 22 11:30:21 2012 Masaki Matsushita <glass.saga@gmail.com>
* struct.c (make_struct): remove junk ID check to allow members who

7
gc.c
View file

@ -292,8 +292,11 @@ int *ruby_initial_gc_stress_ptr = &rb_objspace.gc_stress;
#if SIZEOF_LONG == SIZEOF_VOIDP
# define nonspecial_obj_id(obj) (VALUE)((SIGNED_VALUE)(obj)|FIXNUM_FLAG)
# define obj_id_to_ref(objid) ((objid) ^ FIXNUM_FLAG) /* unset FIXNUM_FLAG */
#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
# define nonspecial_obj_id(obj) LL2NUM((SIGNED_VALUE)(obj) / 2)
# define obj_id_to_ref(objid) (FIXNUM_P(objid) ? \
((objid) ^ FIXNUM_FLAG) : (NUM2PTR(objid) << 1))
#else
# error not supported
#endif
@ -1630,7 +1633,7 @@ id2ref(VALUE obj, VALUE objid)
if (ptr == Qnil) return Qnil;
if (FIXNUM_P(ptr)) return (VALUE)ptr;
if (FLONUM_P(ptr)) return (VALUE)ptr;
ptr = objid ^ FIXNUM_FLAG; /* unset FIXNUM_FLAG */
ptr = obj_id_to_ref(objid);
if ((ptr % sizeof(RVALUE)) == (4 << 2)) {
ID symid = ptr / sizeof(RVALUE);
@ -3795,7 +3798,7 @@ wmap_finalize(VALUE self, VALUE objid)
TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
/* Get reference from object id. */
obj = objid ^ FIXNUM_FLAG; /* unset FIXNUM_FLAG */
obj = obj_id_to_ref(objid);
/* obj is original referenced object and/or weak reference. */
orig = (st_data_t)obj;