diff options
author | John Hawthorn <john@hawthorn.email> | 2022-10-31 14:05:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-31 14:05:37 -0700 |
commit | 02f15542245222ee392e68fb244b3b8c4a12ad82 (patch) | |
tree | ebf3180364aaba5893a17b932605911072189e3d /shape.c | |
parent | 2b39640b0bbf7459b305d8a98bb01f197975b8d9 (diff) | |
download | ruby-02f15542245222ee392e68fb244b3b8c4a12ad82.tar.gz |
Implement object shapes for T_CLASS and T_MODULE (#6637)
* Avoid RCLASS_IV_TBL in marshal.c
* Avoid RCLASS_IV_TBL for class names
* Avoid RCLASS_IV_TBL for autoload
* Avoid RCLASS_IV_TBL for class variables
* Avoid copying RCLASS_IV_TBL onto ICLASSes
* Use object shapes for Class and Module IVs
Diffstat (limited to 'shape.c')
-rw-r--r-- | shape.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -54,9 +54,10 @@ rb_shape_get_shape_by_id_without_assertion(shape_id_t shape_id) } #if !SHAPE_IN_BASIC_FLAGS -static inline shape_id_t -RCLASS_SHAPE_ID(VALUE obj) +shape_id_t +rb_rclass_shape_id(VALUE obj) { + RUBY_ASSERT(RB_TYPE_P(obj, T_CLASS) || RB_TYPE_P(obj, T_MODULE)); return RCLASS_EXT(obj)->shape_id; } @@ -115,7 +116,9 @@ static rb_shape_t* get_next_shape_internal(rb_shape_t* shape, ID id, VALUE obj, enum shape_type shape_type) { rb_shape_t *res = NULL; - RUBY_ASSERT(SHAPE_FROZEN != (enum shape_type)shape->type); + + RUBY_ASSERT(SHAPE_FROZEN != (enum shape_type)shape->type || RB_TYPE_P(obj, T_MODULE) || RB_TYPE_P(obj, T_CLASS)); + RB_VM_LOCK_ENTER(); { if (rb_shape_lookup_id(shape, id, shape_type)) { |