summaryrefslogtreecommitdiff
path: root/shape.h
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2025-06-24 11:46:40 +0200
committerJean Boussier <jean.boussier@gmail.com>2025-06-24 11:29:39 +0100
commit45a2c95d0f7184c9cd64ddd26699af31bea8675d (patch)
treee652215c1555beb00a9b1857079bc340001897e0 /shape.h
parentda10b956e0acde0abcbf3ea74c9a2a68ec05f874 (diff)
Reduce exposure of FL_FREEZE
The `FL_FREEZE` flag is redundant with `SHAPE_ID_FL_FROZEN`, so ideally it should be eliminated in favor of the later. Doing so would eliminate the risk of desync between the two, but also solve the problem of the frozen status being global in namespace context (See Bug #21330).
Diffstat (limited to 'shape.h')
-rw-r--r--shape.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/shape.h b/shape.h
index c6eb1981d0..d7c80be9bc 100644
--- a/shape.h
+++ b/shape.h
@@ -146,6 +146,22 @@ RBASIC_SET_SHAPE_ID(VALUE obj, shape_id_t shape_id)
RUBY_ASSERT(rb_shape_verify_consistency(obj, shape_id));
}
+void rb_set_namespaced_class_shape_id(VALUE obj, shape_id_t shape_id);
+
+static inline void
+RB_SET_SHAPE_ID(VALUE obj, shape_id_t shape_id)
+{
+ switch (BUILTIN_TYPE(obj)) {
+ case T_CLASS:
+ case T_MODULE:
+ rb_set_namespaced_class_shape_id(obj, shape_id);
+ break;
+ default:
+ RBASIC_SET_SHAPE_ID(obj, shape_id);
+ break;
+ }
+}
+
static inline rb_shape_t *
RSHAPE(shape_id_t shape_id)
{