diff options
-rw-r--r-- | benchmark/vm_ivar_memoize.yml | 85 | ||||
-rw-r--r-- | shape.c | 57 | ||||
-rw-r--r-- | shape.h | 1 | ||||
-rw-r--r-- | vm_insnhelper.c | 20 |
4 files changed, 156 insertions, 7 deletions
@@ -0,0 +1,85 @@ @@ -38,6 +38,7 @@ #define SINGLE_CHILD(x) (rb_shape_t *)((uintptr_t)x & SINGLE_CHILD_MASK) #define ANCESTOR_CACHE_THRESHOLD 10 #define MAX_SHAPE_ID (SHAPE_BUFFER_SIZE - 1) static ID id_frozen; static ID id_t_object; @@ -723,6 +724,62 @@ rb_shape_transition_shape_capa(rb_shape_t* shape) return rb_shape_transition_shape_capa_create(shape, rb_malloc_grow_capa(shape->capacity, sizeof(VALUE))); } bool rb_shape_get_iv_index(rb_shape_t * shape, ID id, attr_index_t *value) { @@ -155,6 +155,7 @@ rb_shape_t* rb_shape_get_shape_by_id(shape_id_t shape_id); shape_id_t rb_shape_get_shape_id(VALUE obj); rb_shape_t * rb_shape_get_next_iv_shape(rb_shape_t * shape, ID id); bool rb_shape_get_iv_index(rb_shape_t * shape, ID id, attr_index_t * value); bool rb_shape_obj_too_complex(VALUE obj); void rb_shape_set_shape(VALUE obj, rb_shape_t* shape); @@ -1286,8 +1286,6 @@ vm_getivar(VALUE obj, ID id, const rb_iseq_t *iseq, IVC ic, const struct rb_call } #endif - rb_shape_t *shape = rb_shape_get_shape_by_id(shape_id); - if (shape_id == OBJ_TOO_COMPLEX_SHAPE_ID) { st_table *table = NULL; switch (BUILTIN_TYPE(obj)) { @@ -1314,14 +1312,22 @@ vm_getivar(VALUE obj, ID id, const rb_iseq_t *iseq, IVC ic, const struct rb_call } } else { - if (rb_shape_get_iv_index(shape, id, &index)) { // This fills in the cache with the shared cache object. // "ent" is the shared cache object - fill_ivar_cache(iseq, ic, cc, is_attr, index, shape_id); - // We fetched the ivar list above - val = ivar_list[index]; - RUBY_ASSERT(!UNDEF_P(val)); } else { if (is_attr) { |