mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[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:
parent
6374be5a81
commit
a5b6598192
Notes:
git
2021-10-26 02:26:49 +09:00
16 changed files with 453 additions and 172 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue