summaryrefslogtreecommitdiff
path: root/ext/objspace
diff options
context:
space:
mode:
authoryui-knk <spiketeika@gmail.com>2023-08-22 10:26:38 +0900
committerYuichiro Kaneko <spiketeika@gmail.com>2023-09-28 11:58:10 +0900
commit74c67811537c0c1840668c218dc0e2510d00b473 (patch)
tree1f387a71cf9f797217721345e85e098b790187e5 /ext/objspace
parent684686a1e14d923b43cfd6c1d5a80222281a4070 (diff)
Change RNode structure from union to struct
All kind of AST nodes use same struct RNode, which has u1, u2, u3 union members for holding different kind of data. This has two problems. 1. Low flexibility of data structure Some nodes, for example NODE_TRUE, don’t use u1, u2, u3. On the other hand, NODE_OP_ASGN2 needs more than three union members. However they use same structure definition, need to allocate three union members for NODE_TRUE and need to separate NODE_OP_ASGN2 into another node. This change removes the restriction so make it possible to change data structure by each node type. 2. No compile time check for union member access It’s developer’s responsibility for using correct member for each node type when it’s union. This change clarifies which node has which type of fields and enables compile time check. This commit also changes node_buffer_elem_struct buf management to handle different size data with alignment.
Diffstat (limited to 'ext/objspace')
-rw-r--r--ext/objspace/objspace.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c
index e8762d1be6..94ae2d5e2c 100644
--- a/ext/objspace/objspace.c
+++ b/ext/objspace/objspace.c
@@ -493,6 +493,10 @@ count_nodes(int argc, VALUE *argv, VALUE os)
COUNT_NODE(NODE_ARYPTN);
COUNT_NODE(NODE_FNDPTN);
COUNT_NODE(NODE_HSHPTN);
+ COUNT_NODE(NODE_DEF_TEMP);
+ COUNT_NODE(NODE_DEF_TEMP2);
+ COUNT_NODE(NODE_RIPPER);
+ COUNT_NODE(NODE_RIPPER_VALUES);
COUNT_NODE(NODE_ERROR);
#undef COUNT_NODE
case NODE_LAST: break;