summaryrefslogtreecommitdiff
path: root/shape.c
diff options
context:
space:
mode:
Diffstat (limited to 'shape.c')
-rw-r--r--shape.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/shape.c b/shape.c
index 68c74034e7..00fc627b5e 100644
--- a/shape.c
+++ b/shape.c
@@ -118,6 +118,7 @@ redblack_value(redblack_node_t * node)
return (rb_shape_t *)((uintptr_t)node->value & (((uintptr_t)-1) - 1));
}
+#ifdef HAVE_MMAP
static redblack_id_t
redblack_id_for(redblack_node_t * node)
{
@@ -292,6 +293,7 @@ redblack_insert(redblack_node_t * tree, ID key, rb_shape_t * value)
return root;
}
}
+#endif
rb_shape_tree_t *rb_shape_tree_ptr = NULL;
@@ -694,8 +696,8 @@ rb_shape_get_next_iv_shape(rb_shape_t* shape, ID id)
return get_next_shape_internal(shape, id, SHAPE_IVAR, &dont_care, true);
}
-rb_shape_t *
-rb_shape_get_next(rb_shape_t *shape, VALUE obj, ID id)
+static inline rb_shape_t *
+shape_get_next(rb_shape_t *shape, VALUE obj, ID id, bool emit_warnings)
{
RUBY_ASSERT(!is_instance_id(id) || RTEST(rb_sym2str(ID2SYM(id))));
if (UNLIKELY(shape->type == SHAPE_OBJ_TOO_COMPLEX)) {
@@ -728,7 +730,7 @@ rb_shape_get_next(rb_shape_t *shape, VALUE obj, ID id)
if (variation_created) {
RCLASS_EXT(klass)->variation_count++;
- if (rb_warning_category_enabled_p(RB_WARN_CATEGORY_PERFORMANCE)) {
+ if (emit_warnings && rb_warning_category_enabled_p(RB_WARN_CATEGORY_PERFORMANCE)) {
if (RCLASS_EXT(klass)->variation_count >= SHAPE_MAX_VARIATIONS) {
rb_category_warn(
RB_WARN_CATEGORY_PERFORMANCE,
@@ -745,6 +747,18 @@ rb_shape_get_next(rb_shape_t *shape, VALUE obj, ID id)
return new_shape;
}
+rb_shape_t *
+rb_shape_get_next(rb_shape_t *shape, VALUE obj, ID id)
+{
+ return shape_get_next(shape, obj, id, true);
+}
+
+rb_shape_t *
+rb_shape_get_next_no_warnings(rb_shape_t *shape, VALUE obj, ID id)
+{
+ return shape_get_next(shape, obj, id, false);
+}
+
// Same as rb_shape_get_iv_index, but uses a provided valid shape id and index
// to return a result faster if branches of the shape tree are closely related.
bool