shape.h: make RSHAPE static inline
Since the shape_tree_ptr is `extern` it should be possible to fully inline `RSHAPE`.
This commit is contained in:
parent
d55c463d56
commit
0292b702c4
Notes:
git
2025-06-12 15:08:40 +00:00
5
shape.c
5
shape.c
@ -383,10 +383,7 @@ rb_shape_each_shape_id(each_shape_callback callback, void *data)
|
|||||||
RUBY_FUNC_EXPORTED rb_shape_t *
|
RUBY_FUNC_EXPORTED rb_shape_t *
|
||||||
rb_shape_lookup(shape_id_t shape_id)
|
rb_shape_lookup(shape_id_t shape_id)
|
||||||
{
|
{
|
||||||
uint32_t offset = (shape_id & SHAPE_ID_OFFSET_MASK);
|
return RSHAPE(shape_id);
|
||||||
RUBY_ASSERT(offset != INVALID_SHAPE_ID);
|
|
||||||
|
|
||||||
return &GET_SHAPE_TREE()->shape_list[offset];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RUBY_FUNC_EXPORTED shape_id_t
|
RUBY_FUNC_EXPORTED shape_id_t
|
||||||
|
12
shape.h
12
shape.h
@ -92,7 +92,10 @@ typedef struct {
|
|||||||
redblack_node_t *shape_cache;
|
redblack_node_t *shape_cache;
|
||||||
unsigned int cache_size;
|
unsigned int cache_size;
|
||||||
} rb_shape_tree_t;
|
} rb_shape_tree_t;
|
||||||
|
|
||||||
|
RUBY_SYMBOL_EXPORT_BEGIN
|
||||||
RUBY_EXTERN rb_shape_tree_t *rb_shape_tree_ptr;
|
RUBY_EXTERN rb_shape_tree_t *rb_shape_tree_ptr;
|
||||||
|
RUBY_SYMBOL_EXPORT_END
|
||||||
|
|
||||||
union rb_attr_index_cache {
|
union rb_attr_index_cache {
|
||||||
uint64_t pack;
|
uint64_t pack;
|
||||||
@ -149,7 +152,14 @@ RBASIC_SET_SHAPE_ID(VALUE obj, shape_id_t shape_id)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RSHAPE rb_shape_lookup
|
static inline rb_shape_t *
|
||||||
|
RSHAPE(shape_id_t shape_id)
|
||||||
|
{
|
||||||
|
uint32_t offset = (shape_id & SHAPE_ID_OFFSET_MASK);
|
||||||
|
RUBY_ASSERT(offset != INVALID_SHAPE_ID);
|
||||||
|
|
||||||
|
return &GET_SHAPE_TREE()->shape_list[offset];
|
||||||
|
}
|
||||||
|
|
||||||
int32_t rb_shape_id_offset(void);
|
int32_t rb_shape_id_offset(void);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user