diff options
Diffstat (limited to 'vm_insnhelper.h')
-rw-r--r-- | vm_insnhelper.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/vm_insnhelper.h b/vm_insnhelper.h index 126867025f..2199ee37cc 100644 --- a/vm_insnhelper.h +++ b/vm_insnhelper.h @@ -252,13 +252,18 @@ THROW_DATA_CONSUMED_SET(struct vm_throw_data *obj) #define IS_ARGS_KW_OR_KW_SPLAT(ci) (vm_ci_flag(ci) & (VM_CALL_KWARG | VM_CALL_KW_SPLAT)) #define IS_ARGS_KW_SPLAT_MUT(ci) (vm_ci_flag(ci) & VM_CALL_KW_SPLAT_MUT) +static inline bool +vm_call_cacheable(const struct rb_callinfo *ci, const struct rb_callcache *cc) +{ + return (vm_ci_flag(ci) & VM_CALL_FCALL) || + METHOD_ENTRY_VISI(vm_cc_cme(cc)) != METHOD_VISI_PROTECTED; +} /* If this returns true, an optimized function returned by `vm_call_iseq_setup_func` can be used as a fastpath. */ static inline bool vm_call_iseq_optimizable_p(const struct rb_callinfo *ci, const struct rb_callcache *cc) { - return !IS_ARGS_SPLAT(ci) && !IS_ARGS_KEYWORD(ci) && - METHOD_ENTRY_CACHEABLE(vm_cc_cme(cc)); + return !IS_ARGS_SPLAT(ci) && !IS_ARGS_KEYWORD(ci) && vm_call_cacheable(ci, cc); } #endif /* RUBY_INSNHELPER_H */ |