diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-10-12 19:38:29 +0900 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2022-10-12 09:14:55 -0700 |
commit | b55e3b842a8cf4349914b05cebf00ab53024ae69 (patch) | |
tree | 9c93b5338a892bdb927df4734d8a2fffb1d01c3b /vm_callinfo.h | |
parent | 80da7250c5d7c862e3c1e1431683a1f1211a4d9c (diff) |
Initialize shape attr index also in non-markable CC
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6532
Diffstat (limited to 'vm_callinfo.h')
-rw-r--r-- | vm_callinfo.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/vm_callinfo.h b/vm_callinfo.h index 3fb0fa8ca7..e59f25ca59 100644 --- a/vm_callinfo.h +++ b/vm_callinfo.h @@ -301,12 +301,12 @@ extern const struct rb_callcache *rb_vm_empty_cc_for_super(void); #define vm_cc_empty() rb_vm_empty_cc() +static inline void vm_cc_attr_index_set(const struct rb_callcache *cc, attr_index_t index, shape_id_t dest_shape_id); + static inline void vm_cc_attr_index_initialize(const struct rb_callcache *cc, shape_id_t shape_id) { - VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache)); - VM_ASSERT(cc != vm_cc_empty()); - *(uintptr_t *)&cc->aux_.attr.value = (uintptr_t)(shape_id) << SHAPE_FLAG_SHIFT; + vm_cc_attr_index_set(cc, (attr_index_t)-1, shape_id); } static inline const struct rb_callcache * @@ -385,7 +385,6 @@ vm_cc_attr_index_dest_shape_id(const struct rb_callcache *cc) static inline void vm_cc_atomic_shape_and_index(const struct rb_callcache *cc, shape_id_t * shape_id, attr_index_t * index) { - VM_ASSERT(vm_cc_markable(cc)); uintptr_t cache_value = cc->aux_.attr.value; // Atomically read 64 bits *shape_id = (shape_id_t)(cache_value >> SHAPE_FLAG_SHIFT); *index = (attr_index_t)(cache_value & SHAPE_FLAG_MASK) - 1; @@ -451,9 +450,14 @@ vm_cc_call_set(const struct rb_callcache *cc, vm_call_handler call) 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; + if (!vm_cc_markable(cc)) { + *attr_value = (uintptr_t)INVALID_SHAPE_ID << SHAPE_FLAG_SHIFT; + return; + } VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache)); VM_ASSERT(cc != vm_cc_empty()); - *(uintptr_t *)&cc->aux_.attr.value = (index + 1) | ((uintptr_t)(dest_shape_id) << SHAPE_FLAG_SHIFT); + *attr_value = (index + 1) | ((uintptr_t)(dest_shape_id) << SHAPE_FLAG_SHIFT); } static inline void |