Backport #8014

Add missing node types to ObjectSpace.count_nodes

Added by Aman Gupta about 1 year ago. Updated about 1 year ago.

[ruby-core:53130]
Status:Closed
Priority:Normal
Assignee:Usaku NAKAMURA

Description

diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c
index b8f524c..5857327 100644
--- a/ext/objspace/objspace.c
+++ b/ext/objspace/objspace.c
@@ -469,6 +469,7 @@ countnodes(int argc, VALUE *argv, VALUE os)
COUNT
NODE(NODEOPASGN2);
COUNTNODE(NODEOPASGNAND);
COUNTNODE(NODEOPASGNOR);
+ COUNTNODE(NODEOPCDECL);
COUNT
NODE(NODECALL);
COUNT
NODE(NODEFCALL);
COUNT
NODE(NODEVCALL);
@@ -502,6 +503,7 @@ count
nodes(int argc, VALUE *argv, VALUE os)
COUNTNODE(NODEARGS);
COUNTNODE(NODEARGSAUX);
COUNT
NODE(NODEOPTARG);
+ COUNTNODE(NODEKWARG);
COUNT
NODE(NODEPOSTARG);
COUNT
NODE(NODEARGSCAT);
COUNT
NODE(NODEARGSPUSH);
@@ -519,6 +521,7 @@ count
nodes(int argc, VALUE *argv, VALUE os)
COUNTNODE(NODESCLASS);
COUNTNODE(NODECOLON2);
COUNTNODE(NODECOLON3);
+ COUNTNODE(NODECREF);
COUNTNODE(NODEDOT2);
COUNTNODE(NODEDOT3);
COUNTNODE(NODEFLIP2);
@@ -539,7 +542,7 @@ countnodes(int argc, VALUE *argv, VALUE os)
COUNT
NODE(NODEPRELUDE);
COUNT
NODE(NODELAMBDA);
#undef COUNT
NODE
- default: node = INT2FIX(nodes[i]);
+ default: node = INT2FIX(i);
}
rbhashaset(hash, node, SIZET2NUM(nodes[i]));
}

Associated revisions

Revision 40099
Added by Usaku NAKAMURA about 1 year ago

  • ext/objspace/objspace.c (count_nodes): fix key for unknown node. based on a patch by tmm1 (Aman Gupta) in [Bug #8014]

History

#1 Updated by Nobuyoshi Nakada about 1 year ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r39595.
Aman, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


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 [Bug #8014]

#2 Updated by Tomoyuki Chikanaga about 1 year ago

  • Tracker changed from Bug to Backport
  • Project changed from ruby-trunk to Backport200
  • Status changed from Closed to Assigned
  • Assignee set to Tomoyuki Chikanaga

I believe this is definitely a bug fix. I will merge r39595.

#3 Updated by Tomoyuki Chikanaga about 1 year ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r39913.
Aman, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 39595: [Backport #8014]

* ext/objspace/objspace.c (count_nodes): count also newly added nodes,
  and fix key for unknown node.  patch by tmm1 (Aman Gupta) in
   [Bug #8014]

#4 Updated by Tomoyuki Chikanaga about 1 year ago

  • Project changed from Backport200 to Backport93
  • Status changed from Closed to Assigned
  • Assignee changed from Tomoyuki Chikanaga to Usaku NAKAMURA

I think r39595 need to backport partially (for NODEOPCDECL) to ruby19_3.

#5 Updated by Usaku NAKAMURA about 1 year ago

  • Status changed from Assigned to Closed

1.9.3 doesn't have NODEOPCDECL. so, this issue is closed.

#6 Updated by Aman Gupta about 1 year ago

1.9.3 still contains this bug:

@@ -539,7 +542,7 @@ countnodes(int argc, VALUE *argv, VALUE os)
COUNT
NODE(NODEPRELUDE);
COUNT
NODE(NODELAMBDA);
#undef COUNT
NODE
- default: node = INT2FIX(nodes[i]);
+ default: node = INT2FIX(i);
}
rbhashaset(hash, node, SIZET2NUM(nodes[i]));
}

#7 Updated by Usaku NAKAMURA about 1 year ago

  • Status changed from Closed to Assigned

#8 Updated by Usaku NAKAMURA about 1 year ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r40099.
Aman, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • ext/objspace/objspace.c (count_nodes): fix key for unknown node. based on a patch by tmm1 (Aman Gupta) in [Bug #8014]

Also available in: Atom PDF