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 /include/ruby | |
parent | 1190ec60cc3145c06cca6897b160b3e8ba2c7ecd (diff) | |
download | ruby-1da2e7fca35dc697d85dd91d2572ab58d08cd3bc.tar.gz |
[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.
Diffstat (limited to 'include/ruby')
-rw-r--r-- | include/ruby/internal/config.h | 4 | ||||
-rw-r--r-- | include/ruby/internal/core/rarray.h | 15 | ||||
-rw-r--r-- | include/ruby/internal/core/robject.h | 19 | ||||
-rw-r--r-- | include/ruby/internal/core/rstring.h | 52 |
4 files changed, 0 insertions, 90 deletions
diff --git a/include/ruby/internal/config.h b/include/ruby/internal/config.h index aa63376d7c..da070f0979 100644 --- a/include/ruby/internal/config.h +++ b/include/ruby/internal/config.h @@ -148,8 +148,4 @@ # undef RBIMPL_TEST3 #endif /* HAVE_VA_ARGS_MACRO */ -#ifndef USE_RVARGC -# define USE_RVARGC 1 -#endif - #endif /* RBIMPL_CONFIG_H */ diff --git a/include/ruby/internal/core/rarray.h b/include/ruby/internal/core/rarray.h index 8fc3062f1b..9670f93d0c 100644 --- a/include/ruby/internal/core/rarray.h +++ b/include/ruby/internal/core/rarray.h @@ -130,12 +130,8 @@ enum ruby_rarray_flags { * 3rd parties must not be aware that there even is more than one way to * store array elements. It was a bad idea to expose this to them. */ -#if USE_RVARGC RARRAY_EMBED_LEN_MASK = RUBY_FL_USER9 | RUBY_FL_USER8 | RUBY_FL_USER7 | RUBY_FL_USER6 | RUBY_FL_USER5 | RUBY_FL_USER4 | RUBY_FL_USER3 -#else - RARRAY_EMBED_LEN_MASK = RUBY_FL_USER4 | RUBY_FL_USER3 -#endif #if USE_TRANSIENT_HEAP , @@ -163,13 +159,6 @@ enum ruby_rarray_flags { enum ruby_rarray_consts { /** Where ::RARRAY_EMBED_LEN_MASK resides. */ RARRAY_EMBED_LEN_SHIFT = RUBY_FL_USHIFT + 3 - -#if !USE_RVARGC - , - - /** Max possible number elements that can be embedded. */ - RARRAY_EMBED_LEN_MAX = RBIMPL_EMBED_LEN_MAX_OF(VALUE) -#endif }; /** Ruby's array. */ @@ -228,16 +217,12 @@ struct RArray { * to store its elements. In this case the length is encoded into the * flags. */ -#if USE_RVARGC /* This is a length 1 array because: * 1. GCC has a bug that does not optimize C flexible array members * (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102452) * 2. Zero length arrays are not supported by all compilers */ const VALUE ary[1]; -#else - const VALUE ary[RARRAY_EMBED_LEN_MAX]; -#endif } as; }; diff --git a/include/ruby/internal/core/robject.h b/include/ruby/internal/core/robject.h index b1c2e1b0a9..dc1faad89f 100644 --- a/include/ruby/internal/core/robject.h +++ b/include/ruby/internal/core/robject.h @@ -74,17 +74,6 @@ enum ruby_robject_flags { ROBJECT_EMBED = RUBY_FL_USER1 }; -#if !USE_RVARGC -/** - * This is an enum because GDB wants it (rather than a macro). People need not - * bother. - */ -enum ruby_robject_consts { - /** Max possible number of instance variables that can be embedded. */ - ROBJECT_EMBED_LEN_MAX = RBIMPL_EMBED_LEN_MAX_OF(VALUE) -}; -#endif - struct st_table; /** @@ -118,7 +107,6 @@ struct RObject { struct rb_id_table *iv_index_tbl; } heap; -#if USE_RVARGC /* Embedded instance variables. When an object is small enough, it * uses this area to store the instance variables. * @@ -128,13 +116,6 @@ struct RObject { * 2. Zero length arrays are not supported by all compilers */ VALUE ary[1]; -#else - /** - * Embedded instance variables. When an object is small enough, it - * uses this area to store the instance variables. - */ - VALUE ary[ROBJECT_EMBED_LEN_MAX]; -#endif } as; }; diff --git a/include/ruby/internal/core/rstring.h b/include/ruby/internal/core/rstring.h index e394ab7dca..777fe6dab1 100644 --- a/include/ruby/internal/core/rstring.h +++ b/include/ruby/internal/core/rstring.h @@ -42,11 +42,6 @@ /** @cond INTERNAL_MACRO */ #define RSTRING_NOEMBED RSTRING_NOEMBED -#if !USE_RVARGC -#define RSTRING_EMBED_LEN_MASK RSTRING_EMBED_LEN_MASK -#define RSTRING_EMBED_LEN_SHIFT RSTRING_EMBED_LEN_SHIFT -#define RSTRING_EMBED_LEN_MAX RSTRING_EMBED_LEN_MAX -#endif #define RSTRING_FSTR RSTRING_FSTR #define RSTRING_EMBED_LEN RSTRING_EMBED_LEN #define RSTRING_LEN RSTRING_LEN @@ -162,21 +157,6 @@ enum ruby_rstring_flags { */ RSTRING_NOEMBED = RUBY_FL_USER1, -#if !USE_RVARGC - /** - * When a string employs embedded strategy (see ::RSTRING_NOEMBED), these - * bits are used to store the number of bytes actually filled into - * ::RString::ary. - * - * @internal - * - * 3rd parties must not be aware that there even is more than one way to - * store a string. Might better be hidden. - */ - RSTRING_EMBED_LEN_MASK = RUBY_FL_USER2 | RUBY_FL_USER3 | RUBY_FL_USER4 | - RUBY_FL_USER5 | RUBY_FL_USER6, -#endif - /* Actually, string encodings are also encoded into the flags, using * remaining bits.*/ @@ -202,20 +182,6 @@ enum ruby_rstring_flags { RSTRING_FSTR = RUBY_FL_USER17 }; -#if !USE_RVARGC -/** - * This is an enum because GDB wants it (rather than a macro). People need not - * bother. - */ -enum ruby_rstring_consts { - /** Where ::RSTRING_EMBED_LEN_MASK resides. */ - RSTRING_EMBED_LEN_SHIFT = RUBY_FL_USHIFT + 2, - - /** Max possible number of characters that can be embedded. */ - RSTRING_EMBED_LEN_MAX = RBIMPL_EMBED_LEN_MAX_OF(char) - 1 -}; -#endif - /** * Ruby's String. A string in ruby conceptually has these information: * @@ -279,7 +245,6 @@ struct RString { /** Embedded contents. */ struct { -#if USE_RVARGC long len; /* This is a length 1 array because: * 1. GCC has a bug that does not optimize C flexible array members @@ -287,16 +252,6 @@ struct RString { * 2. Zero length arrays are not supported by all compilers */ char ary[1]; -#else - /** - * When a string is short enough, it uses this area to store the - * contents themselves. This was impractical in the 20th century, - * but these days 64 bit machines can typically hold 24 bytes here. - * Could be sufficiently large. In this case the length is encoded - * into the flags. - */ - char ary[RSTRING_EMBED_LEN_MAX + 1]; -#endif } embed; } as; }; @@ -425,15 +380,8 @@ RSTRING_EMBED_LEN(VALUE str) RBIMPL_ASSERT_TYPE(str, RUBY_T_STRING); RBIMPL_ASSERT_OR_ASSUME(! RB_FL_ANY_RAW(str, RSTRING_NOEMBED)); -#if USE_RVARGC long f = RSTRING(str)->as.embed.len; return f; -#else - VALUE f = RBASIC(str)->flags; - f &= RSTRING_EMBED_LEN_MASK; - f >>= RSTRING_EMBED_LEN_SHIFT; - return RBIMPL_CAST((long)f); -#endif } RBIMPL_WARNING_PUSH() |