diff options
-rw-r--r-- | vm_callinfo.h | 1 | ||||
-rw-r--r-- | vm_insnhelper.c | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/vm_callinfo.h b/vm_callinfo.h index f10cd9a000..3fb0fa8ca7 100644 --- a/vm_callinfo.h +++ b/vm_callinfo.h @@ -385,6 +385,7 @@ 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; diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 2b4eda775a..9b9220a4e3 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1160,7 +1160,13 @@ vm_getivar(VALUE obj, ID id, const rb_iseq_t *iseq, IVC ic, const struct rb_call attr_index_t index; if (is_attr) { - vm_cc_atomic_shape_and_index(cc, &cached_id, &index); + if (vm_cc_markable(cc)) { + vm_cc_atomic_shape_and_index(cc, &cached_id, &index); + } + else { + cached_id = INVALID_SHAPE_ID; + index = ATTR_INDEX_NOT_SET; + } } else { vm_ic_atomic_shape_and_index(ic, &cached_id, &index); |