summaryrefslogtreecommitdiff
path: root/shape.h
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2025-05-27 09:36:33 +0200
committerJean Boussier <jean.boussier@gmail.com>2025-05-27 12:45:24 +0200
commit8b0868cbb106c49d8761536abc408dae0b2e1c1c (patch)
treebc93847d19f3920dbac8103882db461dcab18bcd /shape.h
parentcd355ac8aabbfd671f4cf6fe17f4ac1e500e49cf (diff)
Refactor `rb_shape_rebuild_shape` to stop exposing `rb_shape_t`
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13448
Diffstat (limited to 'shape.h')
-rw-r--r--shape.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/shape.h b/shape.h
index 0acb4a5f70..9a84835e65 100644
--- a/shape.h
+++ b/shape.h
@@ -127,6 +127,8 @@ bool rb_shape_get_iv_index_with_hint(shape_id_t shape_id, ID id, attr_index_t *v
RUBY_FUNC_EXPORTED bool rb_shape_obj_too_complex_p(VALUE obj);
bool rb_shape_too_complex_p(rb_shape_t *shape);
bool rb_shape_id_too_complex_p(shape_id_t shape_id);
+bool rb_shape_has_object_id(rb_shape_t *shape);
+bool rb_shape_id_has_object_id(shape_id_t shape_id);
void rb_shape_set_shape(VALUE obj, rb_shape_t *shape);
shape_id_t rb_shape_transition_frozen(VALUE obj);
@@ -136,10 +138,11 @@ shape_id_t rb_shape_transition_add_ivar(VALUE obj, ID id);
shape_id_t rb_shape_transition_add_ivar_no_warnings(VALUE obj, ID id);
shape_id_t rb_shape_transition_object_id(VALUE obj);
-bool rb_shape_has_object_id(rb_shape_t *shape);
void rb_shape_free_all(void);
-rb_shape_t *rb_shape_rebuild_shape(rb_shape_t *initial_shape, rb_shape_t *dest_shape);
+shape_id_t rb_shape_rebuild(shape_id_t initial_shape_id, shape_id_t dest_shape_id);
+void rb_shape_copy_fields(VALUE dest, VALUE *dest_buf, shape_id_t dest_shape_id, VALUE src, VALUE *src_buf, shape_id_t src_shape_id);
+void rb_shape_copy_complex_ivars(VALUE dest, VALUE obj, shape_id_t src_shape_id, st_table *fields_table);
static inline rb_shape_t *
rb_obj_shape(VALUE obj)
@@ -153,6 +156,12 @@ rb_shape_canonical_p(rb_shape_t *shape)
return !shape->flags;
}
+static inline bool
+rb_shape_id_canonical_p(shape_id_t shape_id)
+{
+ return rb_shape_canonical_p(RSHAPE(shape_id));
+}
+
static inline shape_id_t
rb_shape_root(size_t heap_id)
{