mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
objspace.c: newly added nodes
* ext/objspace/objspace.c (count_nodes): count also newly added nodes, and fix key for unknown node. patch by tmm1 (Aman Gupta) in [ruby-core:53130] [Bug #8014] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4a429c11e1
commit
b4a117f8d3
3 changed files with 13 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
Tue Mar 5 10:40:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/objspace/objspace.c (count_nodes): count also newly added nodes,
|
||||
and fix key for unknown node. patch by tmm1 (Aman Gupta) in
|
||||
[ruby-core:53130] [Bug #8014]
|
||||
|
||||
Tue Mar 5 10:20:16 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* enumerator.c (enumerator_with_index_i): allow Bignum as offset, to
|
||||
|
|
|
@ -469,6 +469,7 @@ count_nodes(int argc, VALUE *argv, VALUE os)
|
|||
COUNT_NODE(NODE_OP_ASGN2);
|
||||
COUNT_NODE(NODE_OP_ASGN_AND);
|
||||
COUNT_NODE(NODE_OP_ASGN_OR);
|
||||
COUNT_NODE(NODE_OP_CDECL);
|
||||
COUNT_NODE(NODE_CALL);
|
||||
COUNT_NODE(NODE_FCALL);
|
||||
COUNT_NODE(NODE_VCALL);
|
||||
|
@ -502,6 +503,7 @@ count_nodes(int argc, VALUE *argv, VALUE os)
|
|||
COUNT_NODE(NODE_ARGS);
|
||||
COUNT_NODE(NODE_ARGS_AUX);
|
||||
COUNT_NODE(NODE_OPT_ARG);
|
||||
COUNT_NODE(NODE_KW_ARG);
|
||||
COUNT_NODE(NODE_POSTARG);
|
||||
COUNT_NODE(NODE_ARGSCAT);
|
||||
COUNT_NODE(NODE_ARGSPUSH);
|
||||
|
@ -519,6 +521,7 @@ count_nodes(int argc, VALUE *argv, VALUE os)
|
|||
COUNT_NODE(NODE_SCLASS);
|
||||
COUNT_NODE(NODE_COLON2);
|
||||
COUNT_NODE(NODE_COLON3);
|
||||
COUNT_NODE(NODE_CREF);
|
||||
COUNT_NODE(NODE_DOT2);
|
||||
COUNT_NODE(NODE_DOT3);
|
||||
COUNT_NODE(NODE_FLIP2);
|
||||
|
@ -539,7 +542,7 @@ count_nodes(int argc, VALUE *argv, VALUE os)
|
|||
COUNT_NODE(NODE_PRELUDE);
|
||||
COUNT_NODE(NODE_LAMBDA);
|
||||
#undef COUNT_NODE
|
||||
default: node = INT2FIX(nodes[i]);
|
||||
default: node = INT2FIX(i);
|
||||
}
|
||||
rb_hash_aset(hash, node, SIZET2NUM(nodes[i]));
|
||||
}
|
||||
|
|
|
@ -58,7 +58,9 @@ class TestObjSpace < Test::Unit::TestCase
|
|||
assert_equal(false, res.empty?)
|
||||
arg = {}
|
||||
ObjectSpace.count_nodes(arg)
|
||||
assert_equal(false, arg.empty?)
|
||||
assert_not_empty(arg)
|
||||
bug8014 = '[ruby-core:53130] [Bug #8014]'
|
||||
assert_empty(arg.select {|k, v| !(Symbol === k && Integer === v)}, bug8014)
|
||||
end
|
||||
|
||||
def test_count_tdata_objects
|
||||
|
|
Loading…
Add table
Reference in a new issue