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

* gc.c, include/ruby/ruby.h: rename T_DEFERRED to T_ZOMBIE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2008-08-29 11:22:42 +00:00
parent 889acc8185
commit fa4c17e712
3 changed files with 13 additions and 9 deletions

View file

@ -1,3 +1,7 @@
Fri Aug 29 19:46:02 2008 Koichi Sasada <ko1@atdot.net>
* gc.c, include/ruby/ruby.h: rename T_DEFERRED to T_ZOMBIE.
Fri Aug 29 18:22:27 2008 NARUSE, Yui <naruse@ruby-lang.org>
* encoding.c (enc_compatible_p): raise TypeError when argument is not

14
gc.c
View file

@ -1652,7 +1652,7 @@ gc_sweep(rb_objspace_t *objspace)
((deferred = obj_free(objspace, (VALUE)p)) ||
((FL_TEST(p, FL_FINALIZE)) && need_call_final))) {
if (!deferred) {
p->as.free.flags = T_DEFERRED;
p->as.free.flags = T_ZOMBIE;
RDATA(p)->dfree = 0;
}
p->as.free.flags |= FL_MARK;
@ -1665,7 +1665,7 @@ gc_sweep(rb_objspace_t *objspace)
free_num++;
}
}
else if (BUILTIN_TYPE(p) == T_DEFERRED) {
else if (BUILTIN_TYPE(p) == T_ZOMBIE) {
/* objects to be finalized */
/* do nothing remain marked */
}
@ -1724,7 +1724,7 @@ rb_gc_force_recycle(VALUE p)
static inline void
make_deferred(RVALUE *p)
{
p->as.basic.flags = (p->as.basic.flags & ~T_MASK) | T_DEFERRED;
p->as.basic.flags = (p->as.basic.flags & ~T_MASK) | T_ZOMBIE;
}
static int
@ -2127,7 +2127,7 @@ os_obj_of(rb_objspace_t *objspace, VALUE of)
case T_NONE:
case T_ICLASS:
case T_NODE:
case T_DEFERRED:
case T_ZOMBIE:
continue;
case T_CLASS:
if (FL_TEST(p, FL_SINGLETON)) continue;
@ -2327,8 +2327,8 @@ chain_finalized_object(st_data_t key, st_data_t val, st_data_t arg)
{
RVALUE *p = (RVALUE *)key, **final_list = (RVALUE **)arg;
if (p->as.basic.flags & FL_FINALIZE) {
if (BUILTIN_TYPE(p) != T_DEFERRED) {
p->as.free.flags = FL_MARK | T_DEFERRED; /* remain marked */
if (BUILTIN_TYPE(p) != T_ZOMBIE) {
p->as.free.flags = FL_MARK | T_ZOMBIE; /* remain marked */
RDATA(p)->dfree = 0;
}
p->as.free.next = *final_list;
@ -2622,7 +2622,7 @@ count_objects(int argc, VALUE *argv, VALUE os)
COUNT_TYPE(T_UNDEF);
COUNT_TYPE(T_NODE);
COUNT_TYPE(T_ICLASS);
COUNT_TYPE(T_DEFERRED);
COUNT_TYPE(T_ZOMBIE);
#undef COUNT_TYPE
default: type = INT2NUM(i); break;
}

View file

@ -319,7 +319,7 @@ enum ruby_value_type {
RUBY_T_UNDEF = 0x1b,
RUBY_T_NODE = 0x1c,
RUBY_T_ICLASS = 0x1d,
RUBY_T_DEFERRED = 0x1e,
RUBY_T_ZOMBIE = 0x1e,
RUBY_T_MASK = 0x1f
};
@ -348,7 +348,7 @@ enum ruby_value_type {
#define T_COMPLEX RUBY_T_COMPLEX
#define T_UNDEF RUBY_T_UNDEF
#define T_NODE RUBY_T_NODE
#define T_DEFERRED RUBY_T_DEFERRED
#define T_ZOMBIE RUBY_T_ZOMBIE
#define T_MASK RUBY_T_MASK
#define BUILTIN_TYPE(x) (((struct RBasic*)(x))->flags & T_MASK)