summaryrefslogtreecommitdiff
path: root/gc.rb
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2021-08-26 10:06:32 -0400
committerPeter Zhu <peter@peterzhu.ca>2021-10-25 13:26:23 -0400
commita5b6598192c30187b19b892af3110a46f6a70d76 (patch)
tree4620f69a10659deb6f278b36c10ec7915194573e /gc.rb
parent6374be5a8188ff5ed2c70b9f1d76672c87a0eda7 (diff)
[Feature #18239] Implement VWA for strings
This commit adds support for embedded strings with variable capacity and uses Variable Width Allocation to allocate strings.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4933
Diffstat (limited to 'gc.rb')
-rw-r--r--gc.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/gc.rb b/gc.rb
index c0459b0beb..e80d6635a7 100644
--- a/gc.rb
+++ b/gc.rb
@@ -256,6 +256,16 @@ module GC
def self.verify_compaction_references(toward: nil, double_heap: false)
Primitive.gc_verify_compaction_references(double_heap, toward == :empty)
end
+
+ # :nodoc:
+ # call-seq:
+ # GC.using_rvargc? -> true or false
+ #
+ # Returns true if using experimental feature Variable Width Allocation, false
+ # otherwise.
+ def self.using_rvargc?
+ GC::INTERNAL_CONSTANTS[:SIZE_POOL_COUNT] > 1
+ end
end
module ObjectSpace