[Feature #18239] Implement VWA for strings

This commit adds support for embedded strings with variable capacity and
uses Variable Width Allocation to allocate strings.
This commit is contained in:
Peter Zhu 2021-08-26 10:06:32 -04:00
parent 6374be5a81
commit a5b6598192
Notes: git 2021-10-26 02:26:49 +09:00
16 changed files with 453 additions and 172 deletions

View file

@ -3769,7 +3769,11 @@ econv_primitive_convert(int argc, VALUE *argv, VALUE self)
rb_str_modify(output);
if (NIL_P(output_bytesize_v)) {
#if USE_RVARGC
output_bytesize = rb_str_capacity(output);
#else
output_bytesize = RSTRING_EMBED_LEN_MAX;
#endif
if (!NIL_P(input) && output_bytesize < RSTRING_LEN(input))
output_bytesize = RSTRING_LEN(input);
}