From ba11a74745e10fac88a74c2da2e0032ccf254265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= Date: Mon, 16 Dec 2019 17:38:41 +0900 Subject: 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. --- vm_insnhelper.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'vm_insnhelper.h') 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]) /**********************************************************/ -- cgit v1.2.1