aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.h
diff options
context:
space:
mode:
Diffstat (limited to 'vm_insnhelper.h')
-rw-r--r--vm_insnhelper.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/vm_insnhelper.h b/vm_insnhelper.h
index 7e111d1b1e..b87d8a68ae 100644
--- a/vm_insnhelper.h
+++ b/vm_insnhelper.h
@@ -203,9 +203,18 @@ enum vm_regan_acttype {
/* set fastpath when cached method is *NOT* protected
* because inline method cache does not care about receiver.
*/
-#define CI_SET_FASTPATH(ci, func) do { \
- if (!(((ci)->me->flag & NOEX_MASK) & NOEX_PROTECTED)) ((ci)->call = (func)); \
+
+#ifndef OPT_CALL_FASTPATH
+#define OPT_CALL_FASTPATH 1
+#endif
+
+#if OPT_CALL_FASTPATH
+#define CI_SET_FASTPATH(ci, func, enabled) do { \
+ if (LIKELY(enabled)) ((ci)->call = (func)); \
} while (0)
+#else
+#define CI_SET_FASTPATH(ci, func, enabled) /* do nothing */
+#endif
#define GET_BLOCK_PTR() ((rb_block_t *)(GC_GUARDED_PTR_REF(GET_LEP()[0])))