mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* gc.c (os_obj_of): heaps may be modified in yield.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
eef10d71dd
commit
18d4c1f044
2 changed files with 19 additions and 4 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Thu Jun 5 22:50:50 2008 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* gc.c (os_obj_of): heaps may be modified in yield.
|
||||||
|
|
||||||
Thu Jun 5 21:46:50 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
Thu Jun 5 21:46:50 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
* st.c (st_reverse_foreach): comment out unused function.
|
* st.c (st_reverse_foreach): comment out unused function.
|
||||||
|
|
19
gc.c
19
gc.c
|
@ -1856,9 +1856,19 @@ os_obj_of(rb_objspace_t *objspace, VALUE of)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
|
RVALUE *membase = 0;
|
||||||
for (i = 0; i < heaps_used; i++) {
|
|
||||||
RVALUE *p, *pend;
|
RVALUE *p, *pend;
|
||||||
|
volatile VALUE v;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (i < heaps_used) {
|
||||||
|
while (0 < i && (uintptr_t)membase < (uintptr_t)heaps[i-1].membase)
|
||||||
|
i--;
|
||||||
|
while (i < heaps_used && (uintptr_t)heaps[i].membase <= (uintptr_t)membase )
|
||||||
|
i++;
|
||||||
|
if (heaps_used <= i)
|
||||||
|
break;
|
||||||
|
membase = heaps[i].membase;
|
||||||
|
|
||||||
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++) {
|
||||||
|
@ -1872,8 +1882,9 @@ os_obj_of(rb_objspace_t *objspace, 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 (!of || rb_obj_is_kind_of((VALUE)p, of)) {
|
v = (VALUE)p;
|
||||||
rb_yield((VALUE)p);
|
if (!of || rb_obj_is_kind_of(v, of)) {
|
||||||
|
rb_yield(v);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue