mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/objspace/objspace.c (reachable_object_from_i): change data
structure of the result of reachable objects. Keys of table contains object_id of each reachable objects. Value of table is an object itself or an instance of InternalObjectWrapper. To avoid duplication, we use st_table and object_id keys. * ext/objspace/objspace.c (type2sym): bug fix. Should use `i' instead of `type'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
aab12ec054
commit
04c177e277
2 changed files with 20 additions and 7 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
Wed Oct 24 11:55:19 2012 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* ext/objspace/objspace.c (reachable_object_from_i): change data
|
||||
structure of the result of reachable objects. Keys of table
|
||||
contains object_id of each reachable objects. Value of table
|
||||
is an object itself or an instance of InternalObjectWrapper.
|
||||
To avoid duplication, we use st_table and object_id keys.
|
||||
|
||||
* ext/objspace/objspace.c (type2sym): bug fix.
|
||||
Should use `i' instead of `type'.
|
||||
|
||||
Wed Oct 24 10:33:09 2012 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* gc.c (garbage_collect, gc_marks): move the location of
|
||||
|
|
|
@ -302,7 +302,7 @@ type2sym(int i)
|
|||
CASE_TYPE(T_ICLASS);
|
||||
CASE_TYPE(T_ZOMBIE);
|
||||
#undef CASE_TYPE
|
||||
default: rb_bug("type2sym: unknown type (%d)", (int)type);
|
||||
default: rb_bug("type2sym: unknown type (%d)", i);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
@ -684,21 +684,23 @@ static void
|
|||
reachable_object_from_i(VALUE obj, void *data_ptr)
|
||||
{
|
||||
struct rof_data *data = (struct rof_data *)data_ptr;
|
||||
VALUE key = obj;
|
||||
VALUE val = obj;
|
||||
|
||||
if (rb_objspace_markable_object_p(obj)) {
|
||||
if (rb_objspace_internal_object_p(obj)) {
|
||||
obj = iow_newobj(obj);
|
||||
rb_ary_push(data->internals, obj);
|
||||
val = iow_newobj(obj);
|
||||
rb_ary_push(data->internals, val);
|
||||
}
|
||||
st_insert(data->refs, obj, Qtrue);
|
||||
st_insert(data->refs, key, val);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
collect_keys(st_data_t key, st_data_t value, st_data_t data)
|
||||
collect_values(st_data_t key, st_data_t value, st_data_t data)
|
||||
{
|
||||
VALUE ary = (VALUE)data;
|
||||
rb_ary_push(ary, (VALUE)key);
|
||||
rb_ary_push(ary, (VALUE)value);
|
||||
return ST_CONTINUE;
|
||||
}
|
||||
|
||||
|
@ -759,7 +761,7 @@ reachable_objects_from(VALUE self, VALUE obj)
|
|||
|
||||
rb_objspace_reachable_objects_from(obj, reachable_object_from_i, &data);
|
||||
|
||||
st_foreach(data.refs, collect_keys, (st_data_t)ret);
|
||||
st_foreach(data.refs, collect_values, (st_data_t)ret);
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in a new issue