diff options
author | Jeremy Evans <[email protected]> | 2023-10-26 17:03:17 -0700 |
---|---|---|
committer | Jeremy Evans <[email protected]> | 2023-12-07 10:29:33 -0800 |
commit | 3081c83169c55ef7eead6222e49248e09232c22c (patch) | |
tree | 6825cd4cd747f053b4d085801a888d9217ee1726 /vm_callinfo.h | |
parent | 1721bb9dc6dcc3ecec05e9d6f72654099460ef50 (diff) |
Support tracing of struct member accessor methods
This follows the same approach used for attr_reader/attr_writer in
2d98593bf54a37397c6e4886ccc7e3654c2eaf85, skipping the checking for
tracing after the first call using the call cache, and clearing the
call cache when tracing is turned on/off.
Fixes [Bug #18886]
Diffstat (limited to 'vm_callinfo.h')
-rw-r--r-- | vm_callinfo.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/vm_callinfo.h b/vm_callinfo.h index fb6998b8b3..8437f2176c 100644 --- a/vm_callinfo.h +++ b/vm_callinfo.h @@ -300,6 +300,7 @@ struct rb_callcache { #define VM_CALLCACHE_UNMARKABLE FL_FREEZE #define VM_CALLCACHE_ON_STACK FL_EXIVAR +/* VM_CALLCACHE_IVAR used for IVAR/ATTRSET/STRUCT_AREF/STRUCT_ASET methods */ #define VM_CALLCACHE_IVAR IMEMO_FL_USER0 #define VM_CALLCACHE_BF IMEMO_FL_USER1 #define VM_CALLCACHE_SUPER IMEMO_FL_USER2 @@ -488,6 +489,12 @@ vm_cc_call_set(const struct rb_callcache *cc, vm_call_handler call) } static inline void +set_vm_cc_ivar(const struct rb_callcache *cc) +{ + *(VALUE *)&cc->flags |= VM_CALLCACHE_IVAR; +} + +static inline void vm_cc_attr_index_set(const struct rb_callcache *cc, attr_index_t index, shape_id_t dest_shape_id) { uintptr_t *attr_value = (uintptr_t *)&cc->aux_.attr.value; @@ -498,7 +505,7 @@ vm_cc_attr_index_set(const struct rb_callcache *cc, attr_index_t index, shape_id VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache)); VM_ASSERT(cc != vm_cc_empty()); *attr_value = (attr_index_t)(index + 1) | ((uintptr_t)(dest_shape_id) << SHAPE_FLAG_SHIFT); - *(VALUE *)&cc->flags |= VM_CALLCACHE_IVAR; + set_vm_cc_ivar(cc); } static inline bool |