summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-21 15:37:01 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-21 15:37:01 +0000
commit29ff037211ba5a7516931d691cb6cc33f77ca6a9 (patch)
tree90e5224d6b650b76ff32e87f731c1d9f07226b2e /gc.c
parent2b2ccf4235296dde3fdbbe0e2519d1e6ea4ef3ea (diff)
merge revision(s) 38493,38539: [Backport #7454]
* gc.c (nonspecial_obj_id): VALUE is not compatible with Fixnum on LLP64 platform, such as 64bit Windows. reporeted by Heesob Park at [ruby-core:50255] [Bug #7454], and the fix is suggested by akr. * object.c (rb_obj_hash): shouldn't assume object_id can be long. based on a patch by Heesob Park at [ruby-core:51060]. cf. [Backport #7454] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gc.c b/gc.c
index 1d37e0ceb4..b42105bbcd 100644
--- a/gc.c
+++ b/gc.c
@@ -99,6 +99,14 @@ ruby_gc_params_t initial_params = {
#define nomem_error GET_VM()->special_exceptions[ruby_error_nomemory]
+#if SIZEOF_LONG == SIZEOF_VOIDP
+# define nonspecial_obj_id(obj) (VALUE)((SIGNED_VALUE)(obj)|FIXNUM_FLAG)
+#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
+# define nonspecial_obj_id(obj) LL2NUM((SIGNED_VALUE)(obj) / 2)
+#else
+# error not supported
+#endif
+
int ruby_gc_debug_indent = 0;
/* for GC profile */
@@ -3283,7 +3291,7 @@ rb_obj_id(VALUE obj)
if (SPECIAL_CONST_P(obj)) {
return LONG2NUM((SIGNED_VALUE)obj);
}
- return (VALUE)((SIGNED_VALUE)obj|FIXNUM_FLAG);
+ return nonspecial_obj_id(obj);
}
static int