summaryrefslogtreecommitdiff
path: root/eval_intern.h
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-13 20:02:19 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-13 20:02:19 (GMT)
commit32a96472648fac55ae5651f404de4c75e697409c (patch)
tree4fab0e3ff9178fe160fe61fc63e1c4569286aa0b /eval_intern.h
parentb73e900f50e74504c48f05811dbfb2aabdf40cdc (diff)
* refactoring CREF related code.
* eval_intern.h: remove unused setter functions. CREF_CLASS_SET() CREF_NEXT_SET() CREF_SCOPE_VISI_COPY() * eval_intern.h: rename flags: * NODE_FL_CREF_PUSHED_BY_EVAL_ -> CREF_FL_PUSHED_BY_EVAL * NODE_FL_CREF_OMOD_SHARED_ -> CREF_FL_OMOD_SHARED and use IMEMO_FL_USER1/2. * vm.c (vm_cref_new): accept push_by_eval parameter. * vm.c (vm_cref_new_use_prev): added for rb_vm_rewrite_cref(). * vm_insnhelper.c (vm_cref_push): accept pushed_by_eval parameter. * vm_insnhelper.h: remove unused macros: COPY_CREF_OMOD() and COPY_CREF(). * vm_eval.c, insns.def: catch up this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval_intern.h')
-rw-r--r--eval_intern.h36
1 files changed, 7 insertions, 29 deletions
diff --git a/eval_intern.h b/eval_intern.h
index d78bb39..5dbdf00 100644
--- a/eval_intern.h
+++ b/eval_intern.h
@@ -179,8 +179,8 @@ rb_threadptr_tag_jump(rb_thread_t *th, int st)
/* CREF operators */
-#define NODE_FL_CREF_PUSHED_BY_EVAL_ (((VALUE)1)<<15)
-#define NODE_FL_CREF_OMOD_SHARED_ (((VALUE)1)<<16)
+#define CREF_FL_PUSHED_BY_EVAL IMEMO_FL_USER1
+#define CREF_FL_OMOD_SHARED IMEMO_FL_USER2
static inline VALUE
CREF_CLASS(const rb_cref_t *cref)
@@ -188,40 +188,18 @@ CREF_CLASS(const rb_cref_t *cref)
return cref->klass;
}
-static inline void
-CREF_CLASS_SET(rb_cref_t *cref, VALUE klass)
-{
- RB_OBJ_WRITE(cref, &cref->klass, klass);
-}
-
static inline rb_cref_t *
CREF_NEXT(const rb_cref_t *cref)
{
return cref->next;
}
-static inline void
-CREF_NEXT_SET(rb_cref_t *cref, const rb_cref_t *next_cref)
-{
- RB_OBJ_WRITE(cref, &cref->next, next_cref);
-}
-
static inline const rb_scope_visibility_t *
CREF_SCOPE_VISI(const rb_cref_t *cref)
{
return &cref->scope_visi;
}
-static inline void
-CREF_SCOPE_VISI_COPY(rb_cref_t *dst_cref, const rb_cref_t *src_cref)
-{
- const rb_scope_visibility_t *src = &src_cref->scope_visi;
- rb_scope_visibility_t *dst = (rb_scope_visibility_t *)&dst_cref->scope_visi; /* OK for const cast */
-
- dst->method_visi = src->method_visi;
- dst->module_func = src->module_func;
-}
-
static inline VALUE
CREF_REFINEMENTS(const rb_cref_t *cref)
{
@@ -237,31 +215,31 @@ CREF_REFINEMENTS_SET(rb_cref_t *cref, VALUE refs)
static inline int
CREF_PUSHED_BY_EVAL(const rb_cref_t *cref)
{
- return cref->flags & NODE_FL_CREF_PUSHED_BY_EVAL_;
+ return cref->flags & CREF_FL_PUSHED_BY_EVAL;
}
static inline void
CREF_PUSHED_BY_EVAL_SET(rb_cref_t *cref)
{
- cref->flags |= NODE_FL_CREF_PUSHED_BY_EVAL_;
+ cref->flags |= CREF_FL_PUSHED_BY_EVAL;
}
static inline int
CREF_OMOD_SHARED(const rb_cref_t *cref)
{
- return cref->flags & NODE_FL_CREF_OMOD_SHARED_;
+ return cref->flags & CREF_FL_OMOD_SHARED;
}
static inline void
CREF_OMOD_SHARED_SET(rb_cref_t *cref)
{
- cref->flags |= NODE_FL_CREF_OMOD_SHARED_;
+ cref->flags |= CREF_FL_OMOD_SHARED;
}
static inline void
CREF_OMOD_SHARED_UNSET(rb_cref_t *cref)
{
- cref->flags &= ~NODE_FL_CREF_OMOD_SHARED_;
+ cref->flags &= ~CREF_FL_OMOD_SHARED;
}
void rb_thread_cleanup(void);