diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-23 00:05:07 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-23 00:05:07 +0000 |
commit | 7522f722760fb5e113e383ed0efc746e51847ade (patch) | |
tree | 4a7caa1f112f561c1ae8927afb88733240076e71 /gc.c | |
parent | 502ceb090258d0d9f1012d91b3bc4d68fb9c280a (diff) |
* gc.c (os_obj_of, os_each_obj): hide objects to be finalized.
[ruby-dev:31810]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 41 |
1 files changed, 4 insertions, 37 deletions
@@ -1599,38 +1599,6 @@ Init_heap() } static VALUE -os_live_obj() -{ - int i; - int n = 0; - - for (i = 0; i < heaps_used; i++) { - RVALUE *p, *pend; - - p = heaps[i].slot; pend = p + heaps[i].limit; - for (;p < pend; p++) { - if (p->as.basic.flags) { - switch (TYPE(p)) { - case T_ICLASS: - case T_VARMAP: - case T_SCOPE: - case T_NODE: - continue; - case T_CLASS: - if (FL_TEST(p, FL_SINGLETON)) continue; - default: - if (!p->as.basic.klass) continue; - rb_yield((VALUE)p); - n++; - } - } - } - } - - return INT2FIX(n); -} - -static VALUE os_obj_of(of) VALUE of; { @@ -1644,6 +1612,7 @@ os_obj_of(of) for (;p < pend; p++) { if (p->as.basic.flags) { switch (TYPE(p)) { + case T_NONE: case T_ICLASS: case T_VARMAP: case T_SCOPE: @@ -1653,7 +1622,7 @@ os_obj_of(of) if (FL_TEST(p, FL_SINGLETON)) continue; default: if (!p->as.basic.klass) continue; - if (rb_obj_is_kind_of((VALUE)p, of)) { + if (!of || rb_obj_is_kind_of((VALUE)p, of)) { rb_yield((VALUE)p); n++; } @@ -1707,11 +1676,9 @@ os_each_obj(argc, argv) rb_secure(4); if (rb_scan_args(argc, argv, "01", &of) == 0) { - return os_live_obj(); - } - else { - return os_obj_of(of); + of = 0; } + return os_obj_of(of); } static VALUE finalizers; |