From a5b6598192c30187b19b892af3110a46f6a70d76 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Thu, 26 Aug 2021 10:06:32 -0400 Subject: [Feature #18239] Implement VWA for strings This commit adds support for embedded strings with variable capacity and uses Variable Width Allocation to allocate strings. --- gc.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gc.rb') 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 -- cgit v1.2.3