ruby-changes:43730
From: ko1 <ko1@a...>
Date: Wed, 3 Aug 2016 09:28:16 +0900 (JST)
Subject: [ruby-changes:43730] ko1:r55803 (trunk): * vm_core.h: rename macros and make them inline functions.
ko1 2016-08-03 09:28:12 +0900 (Wed, 03 Aug 2016) New Revision: 55803 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55803 Log: * vm_core.h: rename macros and make them inline functions. * rename VM_FRAME_TYPE_FINISH_P() to VM_FRAME_FINISHED_P(). * rename VM_FRAME_TYPE_BMETHOD_P() to VM_FRAME_BMETHOD_P(). Modified files: trunk/ChangeLog trunk/vm.c trunk/vm_core.h trunk/vm_dump.c trunk/vm_insnhelper.c trunk/vm_trace.c Index: vm_trace.c =================================================================== --- vm_trace.c (revision 55802) +++ vm_trace.c (revision 55803) @@ -359,7 +359,7 @@ rb_threadptr_exec_event_hooks_orig(rb_tr https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L359 if (state) { if (pop_p) { - if (VM_FRAME_TYPE_FINISH_P(th->cfp)) { + if (VM_FRAME_FINISHED_P(th->cfp)) { th->tag = th->tag->prev; } rb_vm_pop_frame(th); Index: ChangeLog =================================================================== --- ChangeLog (revision 55802) +++ ChangeLog (revision 55803) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Aug 3 09:25:16 2016 Koichi Sasada <ko1@a...> + + * vm_core.h: rename macros and make them inline functions. + + * rename VM_FRAME_TYPE_FINISH_P() to VM_FRAME_FINISHED_P(). + * rename VM_FRAME_TYPE_BMETHOD_P() to VM_FRAME_BMETHOD_P(). + Wed Aug 03 09:15:02 2016 Koichi Sasada <ko1@a...> * vm_core.h: introduce VM_FRAME_FLAG_CFRAME to represent cfp->iseq Index: vm.c =================================================================== --- vm.c (revision 55802) +++ vm.c (revision 55803) @@ -1595,7 +1595,7 @@ hook_before_rewind(rb_thread_t *th, rb_c https://github.com/ruby/ruby/blob/trunk/vm.c#L1595 break; case VM_FRAME_MAGIC_BLOCK: case VM_FRAME_MAGIC_LAMBDA: - if (VM_FRAME_TYPE_BMETHOD_P(th->cfp)) { + if (VM_FRAME_BMETHOD_P(th->cfp)) { EXEC_EVENT_HOOK(th, RUBY_EVENT_B_RETURN, th->cfp->self, 0, 0, Qnil); if (!will_finish_vm_exec) { @@ -1751,7 +1751,7 @@ vm_exec(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/vm.c#L1751 if (cfp == escape_cfp) { if (state == TAG_RETURN) { - if (!VM_FRAME_TYPE_FINISH_P(cfp)) { + if (!VM_FRAME_FINISHED_P(cfp)) { THROW_DATA_CATCH_FRAME_SET(err, cfp + 1); THROW_DATA_STATE_SET(err, state = TAG_BREAK); } @@ -1916,7 +1916,7 @@ vm_exec(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/vm.c#L1916 /* skip frame */ hook_before_rewind(th, th->cfp, FALSE); - if (VM_FRAME_TYPE_FINISH_P(th->cfp)) { + if (VM_FRAME_FINISHED_P(th->cfp)) { rb_vm_pop_frame(th); th->errinfo = (VALUE)err; TH_TMPPOP_TAG(); Index: vm_core.h =================================================================== --- vm_core.h (revision 55802) +++ vm_core.h (revision 55803) @@ -986,11 +986,6 @@ enum { https://github.com/ruby/ruby/blob/trunk/vm_core.h#L986 VM_ENV_FLAG_WB_REQUIRED = 0x0008 }; -static inline void VM_FORCE_WRITE_SPECIAL_CONST(const VALUE *ptr, VALUE special_const_value); - -#define VM_FRAME_TYPE_FINISH_P(cfp) (VM_ENV_FLAGS((cfp)->ep, VM_FRAME_FLAG_FINISH ) != 0) -#define VM_FRAME_TYPE_BMETHOD_P(cfp) (VM_ENV_FLAGS((cfp)->ep, VM_FRAME_FLAG_BMETHOD) != 0) - #define VM_ENV_DATA_SIZE ( 3) #define VM_ENV_DATA_INDEX_ME_CREF (-2) /* ep[-2] */ @@ -1001,6 +996,8 @@ static inline void VM_FORCE_WRITE_SPECIA https://github.com/ruby/ruby/blob/trunk/vm_core.h#L996 #define VM_ENV_INDEX_LAST_LVAR (-VM_ENV_DATA_SIZE) +static inline void VM_FORCE_WRITE_SPECIAL_CONST(const VALUE *ptr, VALUE special_const_value); + static inline void VM_ENV_FLAGS_SET(const VALUE *ep, VALUE flag) { @@ -1031,6 +1028,18 @@ VM_FRAME_TYPE(const rb_control_frame_t * https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1028 return VM_ENV_FLAGS(cfp->ep, VM_FRAME_MAGIC_MASK); } +static inline int +VM_FRAME_FINISHED_P(const rb_control_frame_t *cfp) +{ + return VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_FINISH ) != 0; +} + +static inline int +VM_FRAME_BMETHOD_P(const rb_control_frame_t *cfp) +{ + return VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_BMETHOD) != 0; +} + #define RUBYVM_CFUNC_FRAME_P(cfp) \ (VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_CFUNC) Index: vm_dump.c =================================================================== --- vm_dump.c (revision 55802) +++ vm_dump.c (revision 55803) @@ -130,7 +130,7 @@ control_frame_dump(rb_thread_t *th, rb_c https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L130 if (line) { fprintf(stderr, " %s", posbuf); } - if (VM_FRAME_TYPE_FINISH_P(cfp)) { + if (VM_FRAME_FINISHED_P(cfp)) { fprintf(stderr, " [FINISH]"); } if (0) { @@ -295,7 +295,7 @@ vm_stack_dump_each(rb_thread_t *th, rb_c https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L295 (ptr - th->stack)); } } - else if (VM_FRAME_TYPE_FINISH_P(cfp)) { + else if (VM_FRAME_FINISHED_P(cfp)) { if ((th)->stack + (th)->stack_size > (VALUE *)(cfp + 1)) { vm_stack_dump_each(th, cfp + 1); } Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 55802) +++ vm_insnhelper.c (revision 55803) @@ -1507,7 +1507,7 @@ vm_call_iseq_setup_tailcall(rb_thread_t https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1507 const rb_iseq_t *iseq = def_iseq_ptr(me->def); VALUE *src_argv = argv; VALUE *sp_orig, *sp; - VALUE finish_flag = VM_FRAME_TYPE_FINISH_P(cfp) ? VM_FRAME_FLAG_FINISH : 0; + VALUE finish_flag = VM_FRAME_FINISHED_P(cfp) ? VM_FRAME_FLAG_FINISH : 0; if (VM_BH_FROM_CFP_P(calling->block_handler, cfp)) { struct rb_captured_block *dst_captured = VM_CFP_TO_CAPTURED_BLOCK(RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp)); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/