ruby-changes:39200
From: nobu <ko1@a...>
Date: Fri, 17 Jul 2015 16:29:09 +0900 (JST)
Subject: [ruby-changes:39200] nobu:r51281 (trunk): RUBY_VM_CHECK_INTS: eval the argument only once
nobu 2015-07-17 16:28:53 +0900 (Fri, 17 Jul 2015) New Revision: 51281 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51281 Log: RUBY_VM_CHECK_INTS: eval the argument only once * vm_core.h (RUBY_VM_CHECK_INTS): evaluate the argument only once to get rid of inadvertent side effects. Modified files: trunk/vm_core.h Index: vm_core.h =================================================================== --- vm_core.h (revision 51280) +++ vm_core.h (revision 51281) @@ -1090,11 +1090,14 @@ void rb_threadptr_pending_interrupt_clea https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1090 void rb_threadptr_pending_interrupt_enque(rb_thread_t *th, VALUE v); int rb_threadptr_pending_interrupt_active_p(rb_thread_t *th); -#define RUBY_VM_CHECK_INTS(th) do { \ - if (UNLIKELY(RUBY_VM_INTERRUPTED_ANY(th))) { \ - rb_threadptr_execute_interrupts(th, 0); \ - } \ -} while (0) +#define RUBY_VM_CHECK_INTS(th) ruby_vm_check_ints(th) +static inline void +ruby_vm_check_ints(rb_thread_t *th) +{ + if (UNLIKELY(RUBY_VM_INTERRUPTED_ANY(th))) { + rb_threadptr_execute_interrupts(th, 0); + } +} /* tracer */ struct rb_trace_arg_struct { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/