summaryrefslogtreecommitdiff
path: root/vm_insnhelper.h
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-15 17:40:50 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-15 17:40:50 +0000
commit747487cda7b5a8c893ed8f6b0d7f7498aa434a02 (patch)
tree97aaecf748b76f7b233e2d39cb296d69d361d5b6 /vm_insnhelper.h
parenta91e91c537bf77afc49c2aef4b65d91237cbd786 (diff)
* vm_insnhelper.h (CI_SET_FASTPATH): add new parameter `enabled'.
If `enable' is 0 then CI_SET_FASTPATH() doesn't work. And add new configuration option OPT_CALL_FASTPATH. If this macro was defined by 0, then CI_SET_FASTPATH() doesn't work any more. * vm_insnhelper.c (vm_call_method): Pass `0' for `enabled' parameter of CI_SET_FASTPATH if this method is protected. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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])))