diff options
author | Peter Zhu <peter@peterzhu.ca> | 2023-04-04 17:30:06 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-04 17:30:06 -0400 |
commit | 1da2e7fca35dc697d85dd91d2572ab58d08cd3bc (patch) | |
tree | 1583d534518f36da8678b4f048ed0eb5a5c00fa0 /array.c | |
parent | 1190ec60cc3145c06cca6897b160b3e8ba2c7ecd (diff) |
[Feature #19579] Remove !USE_RVARGC code (#7655)
Remove !USE_RVARGC code
[Feature #19579]
The Variable Width Allocation feature was turned on by default in Ruby
3.2. Since then, we haven't received bug reports or backports to the
non-Variable Width Allocation code paths, so we assume that nobody is
using it. We also don't plan on maintaining the non-Variable Width
Allocation code, so we are going to remove it.
Notes
Notes:
Merged-By: maximecb <maximecb@ruby-lang.org>
Diffstat (limited to 'array.c')
-rw-r--r-- | array.c | 22 |
1 files changed, 0 insertions, 22 deletions
@@ -47,13 +47,8 @@ VALUE rb_cArray; * 2: RARRAY_SHARED_FLAG (equal to ELTS_SHARED) * The array is shared. The buffer this array points to is owned by * another array (the shared root). - * if USE_RVARGC * 3-9: RARRAY_EMBED_LEN * The length of the array when RARRAY_EMBED_FLAG is set. - * else - * 3-4: RARRAY_EMBED_LEN - * The length of the array when RARRAY_EMBED_FLAG is set. - * endif * 12: RARRAY_SHARED_ROOT_FLAG * The array is a shared root that does reference counting. The buffer * this array points to is owned by this array but may be pointed to @@ -188,13 +183,9 @@ ARY_SET(VALUE a, long i, VALUE v) static long ary_embed_capa(VALUE ary) { -#if USE_RVARGC size_t size = rb_gc_obj_slot_size(ary) - offsetof(struct RArray, as.ary); assert(size % sizeof(VALUE) == 0); return size / sizeof(VALUE); -#else - return RARRAY_EMBED_LEN_MAX; -#endif } static size_t @@ -206,11 +197,7 @@ ary_embed_size(long capa) static bool ary_embeddable_p(long capa) { -#if USE_RVARGC return rb_gc_size_allocatable_p(ary_embed_size(capa)); -#else - return capa <= RARRAY_EMBED_LEN_MAX; -#endif } bool @@ -791,9 +778,6 @@ ary_alloc_embed(VALUE klass, long capa) { size_t size = ary_embed_size(capa); assert(rb_gc_size_allocatable_p(size)); -#if !USE_RVARGC - assert(size <= sizeof(struct RArray)); -#endif RVARGC_NEWOBJ_OF(ary, struct RArray, klass, T_ARRAY | RARRAY_EMBED_FLAG | (RGENGC_WB_PROTECTED_ARRAY ? FL_WB_PROTECTED : 0), size); @@ -906,9 +890,6 @@ ec_ary_alloc_embed(rb_execution_context_t *ec, VALUE klass, long capa) { size_t size = ary_embed_size(capa); assert(rb_gc_size_allocatable_p(size)); -#if !USE_RVARGC - assert(size <= sizeof(struct RArray)); -#endif RB_RVARGC_EC_NEWOBJ_OF(ec, ary, struct RArray, klass, T_ARRAY | RARRAY_EMBED_FLAG | (RGENGC_WB_PROTECTED_ARRAY ? FL_WB_PROTECTED : 0), size); @@ -1033,7 +1014,6 @@ rb_ary_memsize(VALUE ary) static VALUE ary_make_shared(VALUE ary) { - assert(USE_RVARGC || !ARY_EMBED_P(ary)); ary_verify(ary); if (ARY_SHARED_P(ary)) { @@ -4741,7 +4721,6 @@ rb_ary_replace(VALUE copy, VALUE orig) ary_memcpy(copy, 0, RARRAY_LEN(orig), RARRAY_CONST_PTR_TRANSIENT(orig)); ARY_SET_EMBED_LEN(copy, RARRAY_LEN(orig)); } -#if USE_RVARGC /* orig is embedded but copy does not have enough space to embed the * contents of orig. */ else if (ARY_EMBED_P(orig)) { @@ -4757,7 +4736,6 @@ rb_ary_replace(VALUE copy, VALUE orig) // bad state from the edits above. ary_memcpy(copy, 0, len, RARRAY_CONST_PTR_TRANSIENT(orig)); } -#endif /* Otherwise, orig is on heap and copy does not have enough space to embed * the contents of orig. */ else { |