summaryrefslogtreecommitdiff
path: root/internal/array.h
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2022-07-22 11:04:43 -0400
committerPeter Zhu <peter@peterzhu.ca>2022-07-22 13:29:21 -0400
commite199ae3edcead0271c6da3410eb02acd927739b7 (patch)
tree6ba85447804f62b53a3c0ea983a464be6cce1610 /internal/array.h
parent203de45bd3635d262d301a3979e21238aa2c7909 (diff)
downloadruby-e199ae3edcead0271c6da3410eb02acd927739b7.tar.gz
Remove reference counting for all frozen arrays
The RARRAY_LITERAL_FLAG was added in commit 5871ecf956711fcacad7c03f2aef95115ed25bc4 to improve CoW performance for array literals by not keeping track of reference counts. This commit reverts that commit and has an alternate implementation that is more generic for all frozen arrays. Since frozen arrays cannot be modified, we don't need to set the RARRAY_SHARED_ROOT_FLAG and we don't need to do reference counting.
Diffstat (limited to 'internal/array.h')
-rw-r--r--internal/array.h9
1 files changed, 0 insertions, 9 deletions
diff --git a/internal/array.h b/internal/array.h
index d8a824423d..0de82d9f30 100644
--- a/internal/array.h
+++ b/internal/array.h
@@ -21,7 +21,6 @@
#define RARRAY_SHARED_FLAG ELTS_SHARED
#define RARRAY_SHARED_ROOT_FLAG FL_USER12
#define RARRAY_PTR_IN_USE_FLAG FL_USER14
-#define RARRAY_LITERAL_FLAG FL_USER15
/* array.c */
VALUE rb_ary_last(int, const VALUE *, VALUE);
@@ -36,7 +35,6 @@ void rb_ary_cancel_sharing(VALUE ary);
size_t rb_ary_size_as_embedded(VALUE ary);
void rb_ary_make_embedded(VALUE ary);
bool rb_ary_embeddable_p(VALUE ary);
-VALUE rb_ary_literal_new(long capa);
static inline VALUE rb_ary_entry_internal(VALUE ary, long offset);
static inline bool ARY_PTR_USING_P(VALUE ary);
@@ -120,13 +118,6 @@ ARY_SHARED_ROOT_REFCNT(VALUE ary)
return RARRAY(ary)->as.heap.aux.capa;
}
-static inline bool
-ARY_LITERAL_P(VALUE ary)
-{
- assert(RB_TYPE_P(ary, T_ARRAY));
- return FL_TEST_RAW(ary, RARRAY_LITERAL_FLAG);
-}
-
static inline void
RARY_TRANSIENT_SET(VALUE ary)
{