mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 12:14:51 +00:00
Remove ObjectSpace.count_nodes
ObjectSpace.count_nodes has been a no-op and returning an empty hash since Ruby 2.5 because parser nodes are not GC managed.
This commit is contained in:
parent
ef488bff98
commit
e8c61f5139
Notes:
git
2026-01-09 23:06:10 +00:00
@ -336,35 +336,6 @@ count_symbols(int argc, VALUE *argv, VALUE os)
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* call-seq:
|
|
||||||
* ObjectSpace.count_nodes([result_hash]) -> hash
|
|
||||||
*
|
|
||||||
* Counts nodes for each node type.
|
|
||||||
*
|
|
||||||
* This method is only for MRI developers interested in performance and memory
|
|
||||||
* usage of Ruby programs.
|
|
||||||
*
|
|
||||||
* It returns a hash as:
|
|
||||||
*
|
|
||||||
* {:NODE_METHOD=>2027, :NODE_FBODY=>1927, :NODE_CFUNC=>1798, ...}
|
|
||||||
*
|
|
||||||
* If the optional argument, result_hash, is given, it is overwritten and
|
|
||||||
* returned. This is intended to avoid probe effect.
|
|
||||||
*
|
|
||||||
* Note:
|
|
||||||
* The contents of the returned hash is implementation defined.
|
|
||||||
* It may be changed in future.
|
|
||||||
*
|
|
||||||
* This method is only expected to work with C Ruby.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static VALUE
|
|
||||||
count_nodes(int argc, VALUE *argv, VALUE os)
|
|
||||||
{
|
|
||||||
return setup_hash(argc, argv);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cto_i(VALUE v, void *data)
|
cto_i(VALUE v, void *data)
|
||||||
{
|
{
|
||||||
@ -834,7 +805,6 @@ Init_objspace(void)
|
|||||||
|
|
||||||
rb_define_module_function(rb_mObjSpace, "count_objects_size", count_objects_size, -1);
|
rb_define_module_function(rb_mObjSpace, "count_objects_size", count_objects_size, -1);
|
||||||
rb_define_module_function(rb_mObjSpace, "count_symbols", count_symbols, -1);
|
rb_define_module_function(rb_mObjSpace, "count_symbols", count_symbols, -1);
|
||||||
rb_define_module_function(rb_mObjSpace, "count_nodes", count_nodes, -1);
|
|
||||||
rb_define_module_function(rb_mObjSpace, "count_tdata_objects", count_tdata_objects, -1);
|
rb_define_module_function(rb_mObjSpace, "count_tdata_objects", count_tdata_objects, -1);
|
||||||
rb_define_module_function(rb_mObjSpace, "count_imemo_objects", count_imemo_objects, -1);
|
rb_define_module_function(rb_mObjSpace, "count_imemo_objects", count_imemo_objects, -1);
|
||||||
|
|
||||||
|
|||||||
@ -76,16 +76,6 @@ class TestObjSpace < Test::Unit::TestCase
|
|||||||
assert_raise(TypeError) { ObjectSpace.count_objects_size(0) }
|
assert_raise(TypeError) { ObjectSpace.count_objects_size(0) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_count_nodes
|
|
||||||
res = ObjectSpace.count_nodes
|
|
||||||
assert_not_empty(res)
|
|
||||||
arg = {}
|
|
||||||
ObjectSpace.count_nodes(arg)
|
|
||||||
assert_not_empty(arg)
|
|
||||||
bug8014 = '[ruby-core:53130] [Bug #8014]'
|
|
||||||
assert_empty(arg.select {|k, v| !(Symbol === k && Integer === v)}, bug8014)
|
|
||||||
end if false
|
|
||||||
|
|
||||||
def test_count_tdata_objects
|
def test_count_tdata_objects
|
||||||
res = ObjectSpace.count_tdata_objects
|
res = ObjectSpace.count_tdata_objects
|
||||||
assert_not_empty(res)
|
assert_not_empty(res)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user