51 total_i(
void *vstart,
void *vend,
size_t stride,
void *ptr)
56 for (v = (
VALUE)vstart; v != (
VALUE)vend; v += stride) {
127 setup_hash(
int argc,
VALUE *argv)
147 cos_i(
void *vstart,
void *vend,
size_t stride,
void *data)
149 size_t *counts = (
size_t *)data;
152 for (;v != (
VALUE)vend; v += stride) {
165 #define CASE_TYPE(t) case t: type = ID2SYM(rb_intern(#t)); break; 193 default:
rb_bug(
"type2sym: unknown type (%d)", i);
222 count_objects_size(
int argc,
VALUE *argv,
VALUE os)
227 VALUE hash = setup_hash(argc, argv);
229 for (i = 0; i <=
T_MASK; i++) {
235 for (i = 0; i <=
T_MASK; i++) {
237 VALUE type = type2sym(i);
252 cs_i(
void *vstart,
void *vend,
size_t stride,
void *n)
257 for (; v != (
VALUE)vend; v += stride) {
301 count_symbols(
int argc,
VALUE *argv,
VALUE os)
304 VALUE hash = setup_hash(argc, argv);
318 cn_i(
void *vstart,
void *vend,
size_t stride,
void *n)
320 size_t *nodes = (
size_t *)n;
323 for (; v != (
VALUE)vend; v += stride) {
361 VALUE hash = setup_hash(argc, argv);
373 #define COUNT_NODE(n) case n: node = ID2SYM(rb_intern(#n)); break; 484 cto_i(
void *vstart,
void *vend,
size_t stride,
void *data)
489 for (; v != (
VALUE)vend; v += stride) {
496 if (name == 0) name =
"unknown";
501 if (
NIL_P(counter)) {
548 count_tdata_objects(
int argc,
VALUE *argv,
VALUE self)
550 VALUE hash = setup_hash(argc, argv);
558 count_imemo_objects_i(
void *vstart,
void *vend,
size_t stride,
void *data)
563 for (; v != (
VALUE)vend; v += stride) {
570 if (
NIL_P(counter)) {
613 count_imemo_objects(
int argc,
VALUE *argv,
VALUE self)
615 VALUE hash = setup_hash(argc, argv);
617 if (imemo_type_ids[0] == 0) {
618 imemo_type_ids[0] =
rb_intern(
"imemo_none");
619 imemo_type_ids[1] =
rb_intern(
"imemo_cref");
620 imemo_type_ids[2] =
rb_intern(
"imemo_svar");
621 imemo_type_ids[3] =
rb_intern(
"imemo_throw_data");
622 imemo_type_ids[4] =
rb_intern(
"imemo_ifunc");
623 imemo_type_ids[5] =
rb_intern(
"imemo_memo");
624 imemo_type_ids[6] =
rb_intern(
"imemo_ment");
625 imemo_type_ids[7] =
rb_intern(
"imemo_iseq");
626 imemo_type_ids[8] =
rb_intern(
"imemo_alloc");
641 iow_size(
const void *ptr)
648 "ObjectSpace::InternalObjectWrapper",
649 {iow_mark, 0, iow_size,},
653 static VALUE rb_mInternalObjectWrapper;
656 iow_newobj(
VALUE obj)
671 iow_inspect(
VALUE self)
681 iow_internal_object_id(
VALUE self)
693 reachable_object_from_i(
VALUE obj,
void *data_ptr)
701 val = iow_newobj(obj);
790 reachable_object_from_root_i(
const char *category,
VALUE obj,
void *ptr)
794 VALUE category_objects;
805 rb_bug(
"reachable_object_from_root_i: category should insert at once");
814 obj = iow_newobj(obj);
836 reachable_objects_from_root(
VALUE self)
855 return iow_newobj(klass);
872 objspace_internal_class_of(
VALUE self,
VALUE obj)
881 return wrap_klass_iow(klass);
894 objspace_internal_super_of(
VALUE self,
VALUE obj)
912 return wrap_klass_iow(super);
969 rb_define_method(rb_mInternalObjectWrapper,
"internal_object_id", iow_internal_object_id, 0);
void rb_bug(const char *fmt,...)
#define RUBY_TYPED_FREE_IMMEDIATELY
VALUE rb_obj_id(VALUE obj)
void rb_raise(VALUE exc, const char *fmt,...)
const char * last_category
#define TypedData_Wrap_Struct(klass, data_type, sval)
VALUE rb_ary_push(VALUE ary, VALUE item)
void rb_objspace_reachable_objects_from_root(void(func)(const char *category, VALUE, void *), void *passing_data)
struct st_table * rb_hash_tbl(VALUE hash)
VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
Defines a class under the namespace of outer.
void rb_objspace_each_objects(each_obj_callback *callback, void *data)
void rb_gc_mark(VALUE ptr)
VALUE rb_hash_lookup(VALUE hash, VALUE key)
int rb_objspace_markable_object_p(VALUE obj)
int rb_typeddata_is_kind_of(VALUE obj, const rb_data_type_t *data_type)
RUBY_SYMBOL_EXPORT_BEGIN typedef unsigned long st_data_t
void rb_hash_foreach(VALUE hash, int(*func)(ANYARGS), VALUE farg)
size_t rb_obj_memsize_of(VALUE obj)
#define RB_TYPE_P(obj, type)
VALUE rb_obj_is_kind_of(VALUE, VALUE)
call-seq: obj.is_a?(class) -> true or false obj.kind_of?(class) -> true or false
VALUE rb_hash_aset(VALUE hash, VALUE key, VALUE val)
RUBY_EXTERN VALUE rb_cObject
#define OBJ_BUILTIN_TYPE(obj)
VALUE rb_const_get(VALUE, ID)
void rb_define_module_function(VALUE module, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a module function for module.
int rb_objspace_internal_object_p(VALUE obj)
VALUE rb_sprintf(const char *format,...)
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
const char * rb_objspace_data_type_name(VALUE obj)
void Init_object_tracing(VALUE rb_mObjSpace)
VALUE rb_ident_hash_new(void)
void rb_objspace_reachable_objects_from(VALUE obj, void(func)(VALUE, void *), void *data)
VALUE rb_hash_aref(VALUE hash, VALUE key)
VALUE rb_define_module(const char *name)
size_t rb_sym_immortal_count(void)
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
void Init_objspace_dump(VALUE rb_mObjSpace)
VALUE last_category_objects