summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-01-09 07:29:05 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-01-09 07:29:05 +0000
commit81084557eb94190f6289d64285d32601a0e739ab (patch)
treee93dd155e62ffce37bb72549f50c4e8b4a33f405 /gc.c
parent32d0e703297ef4d7270aa5a64d7e02c9316f700c (diff)
* pack.c (pack_pack): template "m2" or "u2" caused inifinite loop.
* eval.c (ruby_finalize): should enclosed by PUSH_TAG/POP_TAG. * eval.c (rb_mod_define_method): wrong comparison for blocks. * gc.c (id2ref): should handle Symbol too. * gc.c (id2ref): should print original ptr value * eval.c (rb_iterate): NODE_CFUNC does not protect its data (nd_tval), so create new node NODE_IFUNC for iteration C function. * eval.c (rb_yield_0): use NODE_IFUNC. * gc.c (rb_gc_mark): support NODE_IFUNC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/gc.c b/gc.c
index 6015b81e0a..40108a084b 100644
--- a/gc.c
+++ b/gc.c
@@ -315,10 +315,7 @@ rb_data_object_alloc(klass, datap, dmark, dfree)
extern st_table *rb_class_tbl;
VALUE *rb_gc_stack_start = 0;
-#if defined(__GNUC__) && __GNUC__ >= 2
-__inline__
-#endif
-static int
+static INLINE int
is_pointer_to_heap(ptr)
void *ptr;
{
@@ -483,6 +480,7 @@ rb_gc_mark(ptr)
case NODE_OP_ASGN_AND:
rb_gc_mark(obj->as.node.u1.node);
/* fall through */
+ case NODE_IFUNC:
case NODE_METHOD: /* 2 */
case NODE_NOT:
case NODE_GASGN:
@@ -1262,21 +1260,22 @@ static VALUE
id2ref(obj, id)
VALUE obj, id;
{
- unsigned long ptr;
+ unsigned long ptr, p0;
rb_secure(4);
- ptr = NUM2UINT(id);
+ p0 = ptr = NUM2UINT(id);
if (FIXNUM_P(ptr)) return (VALUE)ptr;
+ if (SYMBOL_P(ptr)) return (VALUE)ptr;
if (ptr == Qtrue) return Qtrue;
if (ptr == Qfalse) return Qfalse;
if (ptr == Qnil) return Qnil;
ptr = id ^ FIXNUM_FLAG; /* unset FIXNUM_FLAG */
if (!is_pointer_to_heap(ptr)) {
- rb_raise(rb_eRangeError, "0x%x is not id value", ptr);
+ rb_raise(rb_eRangeError, "0x%x is not id value", p0);
}
if (BUILTIN_TYPE(ptr) == 0) {
- rb_raise(rb_eRangeError, "0x%x is recycled object", ptr);
+ rb_raise(rb_eRangeError, "0x%x is recycled object", p0);
}
return (VALUE)ptr;
}