diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-12-17 13:22:24 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-12-17 16:12:17 +0900 |
commit | ea717d1ce1199bbd2e6532f1607bab6e1a1f9274 (patch) | |
tree | e346bebbd12d9ad4d6816a3435aa3e6026bc1919 /vm_insnhelper.h | |
parent | d616926af916d140f0bd1be3cdc232193d46286a (diff) |
convert macros into inline functions
For better readability.
Diffstat (limited to 'vm_insnhelper.h')
-rw-r--r-- | vm_insnhelper.h | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/vm_insnhelper.h b/vm_insnhelper.h index c96522fc98..aabbf8387d 100644 --- a/vm_insnhelper.h +++ b/vm_insnhelper.h @@ -120,17 +120,20 @@ enum vm_regan_acttype { * 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]) |