summaryrefslogtreecommitdiff
path: root/shape.h
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2025-06-12 15:18:22 +0200
committerJean Boussier <[email protected]>2025-06-12 17:08:22 +0200
commit7c22330cd2b5430aa4c284aca2a5db9478d971e0 ()
treedb6af973ce7bcc0376aa9830033cad5cef12c80a /shape.h
parentde4b9103815926bb43d5af3f0cb5dbea3749fe2f (diff)
Allocate `rb_shape_tree` statically
There is no point allocating it during init, it adds a useless indirection.
Notes: Merged: https://.com/ruby/ruby/pull/13596
-rw-r--r--shape.h6
1 files changed, 3 insertions, 3 deletions
@@ -94,7 +94,7 @@ typedef struct {
} rb_shape_tree_t;
RUBY_SYMBOL_EXPORT_BEGIN
-RUBY_EXTERN rb_shape_tree_t *rb_shape_tree;
RUBY_SYMBOL_EXPORT_END
union rb_attr_index_cache {
@@ -151,7 +151,7 @@ RSHAPE(shape_id_t shape_id)
uint32_t offset = (shape_id & SHAPE_ID_OFFSET_MASK);
RUBY_ASSERT(offset != INVALID_SHAPE_ID);
- return &rb_shape_tree->shape_list[offset];
}
int32_t rb_shape_id_offset(void);
@@ -240,7 +240,7 @@ RSHAPE_EMBEDDED_CAPACITY(shape_id_t shape_id)
{
uint8_t heap_index = rb_shape_heap_index(shape_id);
if (heap_index) {
- return rb_shape_tree->capacities[heap_index - 1];
}
return 0;
}