path: root/node.h
diff options
authorKoichi Sasada <>2020-07-03 16:56:44 +0900
committerGitHub <>2020-07-03 16:56:44 +0900
commita0f12a0258e4020bd657ee80b7d8f22bd33ea223 (patch)
treef6ebafa85cba2bddddc090f8d3c3b74c2c9f374b /node.h
parent8655c2e69041cc812d30c2e951a8ac9ea7a60c47 (diff)
Use ID instead of GENTRY for gvars. (#3278)
Use ID instead of GENTRY for gvars. Global variables are compiled into GENTRY (a pointer to struct rb_global_entry). This patch replace this GENTRY to ID and make the code simple. We need to search GENTRY from ID every time (st_lookup), so additional overhead will be introduced. However, the performance of accessing global variables is not important now a day and this simplicity helps Ractor development.
Notes: Merged-By: ko1 <>
Diffstat (limited to 'node.h')
1 files changed, 3 insertions, 4 deletions
diff --git a/node.h b/node.h
index 60e9604f46..84c5d09b83 100644
--- a/node.h
+++ b/node.h
@@ -164,7 +164,6 @@ typedef struct RNode {
struct RNode *node;
ID id;
long state;
- struct rb_global_entry *entry;
struct rb_args_info *args;
struct rb_ary_pattern_info *apinfo;
struct rb_fnd_pattern_info *fpinfo;
@@ -228,7 +227,7 @@ typedef struct RNode {
#define nd_stts u1.node
-#define nd_entry u3.entry
+#define nd_entry
#define nd_vid
#define nd_cflag
#define nd_cval u3.value
@@ -316,7 +315,7 @@ typedef struct RNode {
#define NEW_ZLIST(loc) NEW_NODE(NODE_ZLIST,0,0,0,loc)
#define NEW_HASH(a,loc) NEW_NODE(NODE_HASH,a,0,0,loc)
#define NEW_MASGN(l,r,loc) NEW_NODE(NODE_MASGN,l,0,r,loc)
-#define NEW_GASGN(v,val,loc) NEW_NODE(NODE_GASGN,v,val,rb_global_entry(v),loc)
+#define NEW_GASGN(v,val,loc) NEW_NODE(NODE_GASGN,v,val,v,loc)
#define NEW_LASGN(v,val,loc) NEW_NODE(NODE_LASGN,v,val,0,loc)
#define NEW_DASGN(v,val,loc) NEW_NODE(NODE_DASGN,v,val,0,loc)
#define NEW_DASGN_CURR(v,val,loc) NEW_NODE(NODE_DASGN_CURR,v,val,0,loc)
@@ -329,7 +328,7 @@ typedef struct RNode {
#define NEW_OP_ASGN_OR(i,val,loc) NEW_NODE(NODE_OP_ASGN_OR,i,val,0,loc)
#define NEW_OP_ASGN_AND(i,val,loc) NEW_NODE(NODE_OP_ASGN_AND,i,val,0,loc)
#define NEW_OP_CDECL(v,op,val,loc) NEW_NODE(NODE_OP_CDECL,v,val,op,loc)
-#define NEW_GVAR(v,loc) NEW_NODE(NODE_GVAR,v,0,rb_global_entry(v),loc)
+#define NEW_GVAR(v,loc) NEW_NODE(NODE_GVAR,v,0,v,loc)
#define NEW_LVAR(v,loc) NEW_NODE(NODE_LVAR,v,0,0,loc)
#define NEW_DVAR(v,loc) NEW_NODE(NODE_DVAR,v,0,0,loc)
#define NEW_IVAR(v,loc) NEW_NODE(NODE_IVAR,v,0,0,loc)