ruby-changes:47503
From: nobu <ko1@a...>
Date: Fri, 18 Aug 2017 21:44:34 +0900 (JST)
Subject: [ruby-changes:47503] nobu:r59619 (trunk): vm_insnhelper.c: vm_cfp_consistent_p
nobu 2017-08-18 21:44:30 +0900 (Fri, 18 Aug 2017) New Revision: 59619 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59619 Log: vm_insnhelper.c: vm_cfp_consistent_p * vm_insnhelper.c (vm_cfp_consistent_p): extracted the conditions for cfp consistency. Modified files: trunk/vm_insnhelper.c Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 59618) +++ vm_insnhelper.c (revision 59619) @@ -1833,10 +1833,20 @@ vm_profile_show_result(void) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1833 #define VM_PROFILE_ATEXIT() #endif +static inline int +vm_cfp_consistent_p(rb_thread_t *th, const rb_control_frame_t *reg_cfp) +{ + const int ov_flags = RAISED_STACKOVERFLOW; + if (LIKELY(reg_cfp == th->ec.cfp + 1)) return TRUE; + if (rb_thread_raised_p(th, ov_flags)) { + rb_thread_raised_reset(th, ov_flags); + return TRUE; + } + return FALSE; +} + #define CHECK_CFP_CONSISTENCY(func) \ - (LIKELY(reg_cfp == th->ec.cfp + 1) ? (void) 0 : \ - rb_thread_raised_p(th, RAISED_STACKOVERFLOW) ? \ - rb_thread_raised_reset(th, RAISED_STACKOVERFLOW) : \ + (LIKELY(vm_cfp_consistent_p(th, reg_cfp)) ? (void)0 : \ rb_bug(func ": cfp consistency error (%p, %p)", reg_cfp, th->ec.cfp+1)) static inline -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/