* 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/trunk@13497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0a274820bd
commit
c9faac88af
@ -1,3 +1,8 @@
|
|||||||
|
Sun Sep 23 09:05:05 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* gc.c (os_obj_of, os_each_obj): hide objects to be finalized.
|
||||||
|
[ruby-dev:31810]
|
||||||
|
|
||||||
Sun Sep 23 08:58:01 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Sep 23 08:58:01 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* eval_method.ci (rb_attr): should not use alloca for unknowen size
|
* eval_method.ci (rb_attr): should not use alloca for unknowen size
|
||||||
|
40
gc.c
40
gc.c
@ -1691,37 +1691,6 @@ Init_heap(void)
|
|||||||
add_heap();
|
add_heap();
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
|
||||||
os_live_obj(void)
|
|
||||||
{
|
|
||||||
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_NODE:
|
|
||||||
case T_VALUES:
|
|
||||||
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
|
static VALUE
|
||||||
os_obj_of(VALUE of)
|
os_obj_of(VALUE of)
|
||||||
{
|
{
|
||||||
@ -1734,7 +1703,8 @@ os_obj_of(VALUE of)
|
|||||||
p = heaps[i].slot; pend = p + heaps[i].limit;
|
p = heaps[i].slot; pend = p + heaps[i].limit;
|
||||||
for (;p < pend; p++) {
|
for (;p < pend; p++) {
|
||||||
if (p->as.basic.flags) {
|
if (p->as.basic.flags) {
|
||||||
switch (TYPE(p)) {
|
switch (BUILTIN_TYPE(p)) {
|
||||||
|
case T_NONE:
|
||||||
case T_ICLASS:
|
case T_ICLASS:
|
||||||
case T_NODE:
|
case T_NODE:
|
||||||
case T_VALUES:
|
case T_VALUES:
|
||||||
@ -1743,7 +1713,7 @@ os_obj_of(VALUE of)
|
|||||||
if (FL_TEST(p, FL_SINGLETON)) continue;
|
if (FL_TEST(p, FL_SINGLETON)) continue;
|
||||||
default:
|
default:
|
||||||
if (!p->as.basic.klass) continue;
|
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);
|
rb_yield((VALUE)p);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
@ -1795,11 +1765,9 @@ os_each_obj(int argc, VALUE *argv)
|
|||||||
|
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
if (rb_scan_args(argc, argv, "01", &of) == 0) {
|
if (rb_scan_args(argc, argv, "01", &of) == 0) {
|
||||||
return os_live_obj();
|
of = 0;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return os_obj_of(of);
|
return os_obj_of(of);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE finalizers;
|
static VALUE finalizers;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user