diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-03 01:50:50 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-03 01:50:50 +0000 |
commit | 03cad835932205e9ca9e11bed1e6394272ca3f5c (patch) | |
tree | e99a0dbd528aa38d6b384eaa2518a9f0510e5838 /vm_core.h | |
parent | 0cd7f5fe87fb2d047a5423cd24c24f9fea530502 (diff) |
* 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.h | 26 |
1 files changed, 24 insertions, 2 deletions
@@ -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) { |