summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorMatt Valentine-House <[email protected]>2024-10-03 13:53:49 +0100
committerMatt Valentine-House <[email protected]>2024-10-03 21:20:09 +0100
commit8e7df4b7c674cf408fa570b9593811167bbff04a (patch)
treefe143affd6601f6fc1a94d5a25084696ea8f660e /test/ruby
parentb58a3645229b6c82c1f199fd948ec1fa97c0cc10 (diff)
Rename size_pool -> heap
Now that we've inlined the eden_heap into the size_pool, we should rename the size_pool to heap. So that Ruby contains multiple heaps, with different sized objects. The term heap as a collection of memory pages is more in memory management nomenclature, whereas size_pool was a name chosen out of necessity during the development of the Variable Width Allocation features of Ruby. The concept of size pools was introduced in order to facilitate different sized objects (other than the default 40 bytes). They wrapped the eden heap and the tomb heap, and some related state, and provided a reasonably simple way of duplicating all related concerns, to provide multiple pools that all shared the same structure but held different objects. Since then various changes have happend in Ruby's memory layout: * The concept of tomb heaps has been replaced by a global free pages list, with each page having it's slot size reconfigured at the point when it is resurrected * the eden heap has been inlined into the size pool itself, so that now the size pool directly controls the free_pages list, the sweeping page, the compaction cursor and the other state that was previously being managed by the eden heap. Now that there is no need for a heap wrapper, we should refer to the collection of pages containing Ruby objects as a heap again rather than a size pool
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11771
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_gc.rb10
-rw-r--r--test/ruby/test_gc_compact.rb14
-rw-r--r--test/ruby/test_string.rb4
3 files changed, 14 insertions, 14 deletions
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb
index 9a9796dc55..31ad71a1a1 100644
--- a/test/ruby/test_gc.rb
+++ b/test/ruby/test_gc.rb
@@ -226,7 +226,7 @@ class TestGc < Test::Unit::TestCase
GC.stat_heap(0, stat_heap)
GC.stat(stat)
- GC::INTERNAL_CONSTANTS[:SIZE_POOL_COUNT].times do |i|
+ GC::INTERNAL_CONSTANTS[:HEAP_COUNT].times do |i|
EnvUtil.without_gc do
GC.stat_heap(i, stat_heap)
GC.stat(stat)
@@ -248,7 +248,7 @@ class TestGc < Test::Unit::TestCase
assert_equal stat_heap[:slot_size], GC.stat_heap(0)[:slot_size]
assert_raise(ArgumentError) { GC.stat_heap(-1) }
- assert_raise(ArgumentError) { GC.stat_heap(GC::INTERNAL_CONSTANTS[:SIZE_POOL_COUNT]) }
+ assert_raise(ArgumentError) { GC.stat_heap(GC::INTERNAL_CONSTANTS[:HEAP_COUNT]) }
end
def test_stat_heap_all
@@ -259,7 +259,7 @@ class TestGc < Test::Unit::TestCase
GC.stat_heap(0, stat_heap)
GC.stat_heap(nil, stat_heap_all)
- GC::INTERNAL_CONSTANTS[:SIZE_POOL_COUNT].times do |i|
+ GC::INTERNAL_CONSTANTS[:HEAP_COUNT].times do |i|
GC.stat_heap(nil, stat_heap_all)
GC.stat_heap(i, stat_heap)
@@ -538,7 +538,7 @@ class TestGc < Test::Unit::TestCase
gc_count = GC.stat(:count)
# Fill up all of the size pools to the init slots
- GC::INTERNAL_CONSTANTS[:SIZE_POOL_COUNT].times do |i|
+ GC::INTERNAL_CONSTANTS[:HEAP_COUNT].times do |i|
capa = (GC.stat_heap(i, :slot_size) - GC::INTERNAL_CONSTANTS[:RVALUE_OVERHEAD] - (2 * RbConfig::SIZEOF["void*"])) / RbConfig::SIZEOF["void*"]
while GC.stat_heap(i, :heap_eden_slots) < GC_HEAP_INIT_SLOTS
Array.new(capa)
@@ -558,7 +558,7 @@ class TestGc < Test::Unit::TestCase
gc_count = GC.stat(:count)
# Fill up all of the size pools to the init slots
- GC::INTERNAL_CONSTANTS[:SIZE_POOL_COUNT].times do |i|
+ GC::INTERNAL_CONSTANTS[:HEAP_COUNT].times do |i|
capa = (GC.stat_heap(i, :slot_size) - GC::INTERNAL_CONSTANTS[:RVALUE_OVERHEAD] - (2 * RbConfig::SIZEOF["void*"])) / RbConfig::SIZEOF["void*"]
while GC.stat_heap(i, :heap_eden_slots) < SIZES[i]
Array.new(capa)
diff --git a/test/ruby/test_gc_compact.rb b/test/ruby/test_gc_compact.rb
index c331968b3d..26d7c71687 100644
--- a/test/ruby/test_gc_compact.rb
+++ b/test/ruby/test_gc_compact.rb
@@ -283,7 +283,7 @@ class TestGCCompact < Test::Unit::TestCase
end;
end
- def test_moving_arrays_down_size_pools
+ def test_moving_arrays_down_heaps
omit if GC::INTERNAL_CONSTANTS[:SIZE_POOL_COUNT] == 1
assert_separately(%w[-robjspace], "#{<<~"begin;"}\n#{<<~"end;"}", timeout: 10)
@@ -305,7 +305,7 @@ class TestGCCompact < Test::Unit::TestCase
end;
end
- def test_moving_arrays_up_size_pools
+ def test_moving_arrays_up_heaps
omit if GC::INTERNAL_CONSTANTS[:SIZE_POOL_COUNT] == 1
assert_separately(%w[-robjspace], "#{<<~"begin;"}\n#{<<~"end;"}", timeout: 10)
@@ -329,7 +329,7 @@ class TestGCCompact < Test::Unit::TestCase
end;
end
- def test_moving_objects_between_size_pools
+ def test_moving_objects_between_heaps
omit if GC::INTERNAL_CONSTANTS[:SIZE_POOL_COUNT] == 1
assert_separately(%w[-robjspace], "#{<<~"begin;"}\n#{<<~"end;"}", timeout: 60)
@@ -361,7 +361,7 @@ class TestGCCompact < Test::Unit::TestCase
end;
end
- def test_moving_strings_up_size_pools
+ def test_moving_strings_up_heaps
omit if GC::INTERNAL_CONSTANTS[:SIZE_POOL_COUNT] == 1
assert_separately(%w[-robjspace], "#{<<~"begin;"}\n#{<<~"end;"}", timeout: 30)
@@ -382,7 +382,7 @@ class TestGCCompact < Test::Unit::TestCase
end;
end
- def test_moving_strings_down_size_pools
+ def test_moving_strings_down_heaps
omit if GC::INTERNAL_CONSTANTS[:SIZE_POOL_COUNT] == 1
assert_separately(%w[-robjspace], "#{<<~"begin;"}\n#{<<~"end;"}", timeout: 30)
@@ -402,7 +402,7 @@ class TestGCCompact < Test::Unit::TestCase
end;
end
- def test_moving_hashes_down_size_pools
+ def test_moving_hashes_down_heaps
omit if GC::INTERNAL_CONSTANTS[:SIZE_POOL_COUNT] == 1
# AR and ST hashes are in the same size pool on 32 bit
omit unless RbConfig::SIZEOF["uint64_t"] <= RbConfig::SIZEOF["void*"]
@@ -425,7 +425,7 @@ class TestGCCompact < Test::Unit::TestCase
end;
end
- def test_moving_objects_between_size_pools_keeps_shape_frozen_status
+ def test_moving_objects_between_heaps_keeps_shape_frozen_status
# [Bug #19536]
assert_separately([], "#{<<~"begin;"}\n#{<<~"end;"}")
begin;
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index 8658097ae4..ba8d86d442 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -662,8 +662,8 @@ CODE
assert_equal(Encoding::UTF_8, "#{s}x".encoding)
end
- def test_string_interpolations_across_size_pools_get_embedded
- omit if GC::INTERNAL_CONSTANTS[:SIZE_POOL_COUNT] == 1
+ def test_string_interpolations_across_heaps_get_embedded
+ omit if GC::INTERNAL_CONSTANTS[:HEAP_COUNT] == 1
require 'objspace'
base_slot_size = GC::INTERNAL_CONSTANTS[:BASE_SLOT_SIZE]