Project

General

Profile

Actions

Backport #8014

closed

Add missing node types to ObjectSpace.count_nodes

Added by tmm1 (Aman Karmani) about 11 years ago. Updated almost 11 years ago.

Status:
Closed
[ruby-core:53130]

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 @@ 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]));
    
    }
Actions #1

Updated by nobu (Nobuyoshi Nakada) about 11 years 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
    [ruby-core:53130] [Bug #8014]
Actions #2

Updated by nagachika (Tomoyuki Chikanaga) about 11 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby master to Backport200
  • Status changed from Closed to Assigned
  • Assignee set to nagachika (Tomoyuki Chikanaga)

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

Actions #3

Updated by nagachika (Tomoyuki Chikanaga) about 11 years 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
  [ruby-core:53130] [Bug #8014]
Actions #4

Updated by nagachika (Tomoyuki Chikanaga) about 11 years ago

  • Project changed from Backport200 to Backport193
  • Status changed from Closed to Assigned
  • Assignee changed from nagachika (Tomoyuki Chikanaga) to usa (Usaku NAKAMURA)

I think r39595 need to backport partially (for NODE_OP_CDECL) to ruby_1_9_3.

Updated by usa (Usaku NAKAMURA) about 11 years ago

  • Status changed from Assigned to Closed

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

Updated by tmm1 (Aman Karmani) almost 11 years ago

1.9.3 still contains this bug:

@@ -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]));
    
    }

Updated by usa (Usaku NAKAMURA) almost 11 years ago

  • Status changed from Closed to Assigned
Actions #8

Updated by usa (Usaku NAKAMURA) almost 11 years 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 [ruby-core:53130] [Bug #8014]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0