aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.h
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2022-03-11 11:48:02 -0800
committerJohn Hawthorn <john@hawthorn.email>2022-06-21 18:33:51 -0700
commit9312f4bf62224cc0a11175cb6f9b7d0dd840a491 (patch)
tree39b12c41eeb08852b8aee3977cd07fd7e17f612f /vm_insnhelper.h
parenta580dd77377c87754b437efb1a02cccc1554dafd (diff)
downloadruby-9312f4bf62224cc0a11175cb6f9b7d0dd840a491.tar.gz
Allow method caching of protected FCALLs
Diffstat (limited to 'vm_insnhelper.h')
-rw-r--r--vm_insnhelper.h9
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 */