ruby-changes:59294
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Tue, 17 Dec 2019 16:12:55 +0900 (JST)
Subject: [ruby-changes:59294] ea717d1ce1 (master): convert macros into inline functions
https://git.ruby-lang.org/ruby.git/commit/?id=ea717d1ce1 From ea717d1ce1199bbd2e6532f1607bab6e1a1f9274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= <shyouhei@r...> Date: Tue, 17 Dec 2019 13:22:24 +0900 Subject: convert macros into inline functions For better readability. diff --git a/vm_insnhelper.h b/vm_insnhelper.h index c96522f..aabbf83 100644 --- a/vm_insnhelper.h +++ b/vm_insnhelper.h @@ -120,17 +120,20 @@ enum vm_regan_acttype { https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.h#L120 * because inline method cache does not care about receiver. */ -#define CC_SET_FASTPATH(cc, func, enabled) do { \ - if (LIKELY(enabled)) ((cc)->call = (func)); \ -} while (0) +static inline void +CC_SET_FASTPATH(CALL_CACHE cc, vm_call_handler func, bool enabled) +{ + if (LIKELY(enabled)) { + cc->call = func; + } +} -#define CC_SET_ME(cc, newme) do { \ - CALL_CACHE ccx = (cc); \ - const rb_callable_method_entry_t *mex = (newme); \ - const rb_method_definition_t *defx = mex ? mex->def : NULL; \ - ccx->me = mex; \ - ccx->def = defx; \ -} while (0) +static inline void +CC_SET_ME(CALL_CACHE cc, const rb_callable_method_entry_t *me) +{ + cc->me = me; + cc->def = me ? me->def : NULL; +} #define GET_BLOCK_HANDLER() (GET_LEP()[VM_ENV_DATA_INDEX_SPECVAL]) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/