aboutsummaryrefslogtreecommitdiffstats
path: root/vm_core.h
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-03 01:50:50 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-03 01:50:50 +0000
commit41bdfb4673aa000750aefc1f79bd33192dece267 (patch)
treee99a0dbd528aa38d6b384eaa2518a9f0510e5838 /vm_core.h
parent7cd730b33c917f27c68eb269c195de458cf420d8 (diff)
downloadruby-41bdfb4673aa000750aefc1f79bd33192dece267.tar.gz
* vm_core.h: introduce VM_FRAME_RUBYFRAME_P()
and VM_FRAME_CFRAME_P(). Most of case, RUBY_VM_NORMAL_ISEQ_P() is no longer needed. * vm_core.h: introduce rb_obj_is_iseq(). * cont.c, vm.c: VM_FRAME_MAGIC_DUMMY with VM_FRAME_FLAG_CFRAME. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_core.h')
-rw-r--r--vm_core.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/vm_core.h b/vm_core.h
index d7cf0bb2d8..ccba902a36 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -1040,6 +1040,30 @@ VM_FRAME_BMETHOD_P(const rb_control_frame_t *cfp)
return VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_BMETHOD) != 0;
}
+static inline int
+rb_obj_is_iseq(VALUE iseq)
+{
+ return RB_TYPE_P(iseq, T_IMEMO) && imemo_type(iseq) == imemo_iseq;
+}
+
+#if VM_CHECK_MODE > 0
+#define RUBY_VM_NORMAL_ISEQ_P(iseq) rb_obj_is_iseq((VALUE)iseq)
+#endif
+
+static inline int
+VM_FRAME_CFRAME_P(const rb_control_frame_t *cfp)
+{
+ int cframe_p = VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_CFRAME) != 0;
+ VM_ASSERT(RUBY_VM_NORMAL_ISEQ_P(cfp->iseq) != cframe_p);
+ return cframe_p;
+}
+
+static inline int
+VM_FRAME_RUBYFRAME_P(const rb_control_frame_t *cfp)
+{
+ return !VM_FRAME_CFRAME_P(cfp);
+}
+
#define RUBYVM_CFUNC_FRAME_P(cfp) \
(VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_CFUNC)
@@ -1153,8 +1177,6 @@ VALUE rb_vm_frame_block_handler(const rb_control_frame_t *cfp);
#define RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp) \
(!RUBY_VM_VALID_CONTROL_FRAME_P((cfp), RUBY_VM_END_CONTROL_FRAME(th)))
-#define RUBY_VM_NORMAL_ISEQ_P(ptr) (RB_TYPE_P((VALUE)(ptr), T_IMEMO) && imemo_type((VALUE)ptr) == imemo_iseq && rb_iseq_check((rb_iseq_t *)ptr))
-
static inline int
VM_BH_ISEQ_BLOCK_P(VALUE block_handler)
{