aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.h
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2019-12-16 17:38:41 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2019-12-16 17:52:18 +0900
commitba11a74745e10fac88a74c2da2e0032ccf254265 (patch)
tree90645559ab20180ea9eb0868a091e334b82b6fc8 /vm_insnhelper.h
parent6545d5bbb9517a9364bd59a12a98d3e00516e07e (diff)
downloadruby-ba11a74745e10fac88a74c2da2e0032ccf254265.tar.gz
ensure cc->def == cc->me->def
The equation shall hold for every call cache. However prior to this changeset cc->me could be updated without also updating cc->def. Let's make it sure by introducing new macro named CC_SET_ME which sets cc->me and cc->def at once.
Diffstat (limited to 'vm_insnhelper.h')
-rw-r--r--vm_insnhelper.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/vm_insnhelper.h b/vm_insnhelper.h
index 99555fd4ed..c96522fc98 100644
--- a/vm_insnhelper.h
+++ b/vm_insnhelper.h
@@ -124,6 +124,14 @@ enum vm_regan_acttype {
if (LIKELY(enabled)) ((cc)->call = (func)); \
} while (0)
+#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)
+
#define GET_BLOCK_HANDLER() (GET_LEP()[VM_ENV_DATA_INDEX_SPECVAL])
/**********************************************************/