summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorAaron Patterson <[email protected]>2025-05-20 10:15:22 -0700
committerAaron Patterson <[email protected]>2025-05-21 09:51:32 -0700
commit6ea893f37688bafaa8145474ce754a74af5a850a (patch)
treeaa19eb580443af05ac31f1dbd0fa2099ccc3f1a6 /gc.c
parent511b6bcb53aec8c429d00628e7d2ba286671a4fc (diff)
Add assertion for RCLASS_SET_PRIME_CLASSEXT_WRITABLE
When classes are booted, they should all be writeable unless namespaces are enabled. This commit adds an assertion to ensure that classes are writable.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13385
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gc.c b/gc.c
index 8cba7fbac8..c3f0a71df1 100644
--- a/gc.c
+++ b/gc.c
@@ -3279,12 +3279,14 @@ rb_gc_mark_children(void *objspace, VALUE obj)
// Skip updating max_iv_count if the prime classext is not writable
// because GC context doesn't provide information about namespaces.
if (RCLASS_PRIME_CLASSEXT_WRITABLE_P(klass)) {
- VM_ASSERT(rb_shape_obj_too_complex_p(klass));
// Increment max_iv_count if applicable, used to determine size pool allocation
if (RCLASS_MAX_IV_COUNT(klass) < fields_count) {
RCLASS_SET_MAX_IV_COUNT(klass, fields_count);
}
}
+ else {
+ VM_ASSERT(rb_shape_obj_too_complex_p(klass));
+ }
}
break;