diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_gc_compact.rb | 24 | ||||
-rw-r--r-- | test/ruby/test_mjit.rb | 5 |
2 files changed, 27 insertions, 2 deletions
diff --git a/test/ruby/test_gc_compact.rb b/test/ruby/test_gc_compact.rb index 7d72f3573b..92a2be1174 100644 --- a/test/ruby/test_gc_compact.rb +++ b/test/ruby/test_gc_compact.rb @@ -249,6 +249,30 @@ class TestGCCompact < Test::Unit::TestCase end; end + def test_moving_objects_between_size_pools + assert_separately([], "#{<<~"begin;"}\n#{<<~"end;"}", timeout: 10, signal: :SEGV) + begin; + class Foo + def add_ivars + 10.times do |i| + instance_variable_set("@foo" + i.to_s, 0) + end + end + end + + OBJ_COUNT = 500 + + GC.verify_compaction_references(expand_heap: true, toward: :empty) + + ary = OBJ_COUNT.times.map { Foo.new } + ary.each(&:add_ivars) + + stats = GC.verify_compaction_references(expand_heap: true, toward: :empty) + + assert_operator(stats[:moved_up][:T_OBJECT], :>=, OBJ_COUNT) + end; + end + def test_moving_strings_up_size_pools omit if !GC.using_rvargc? assert_separately([], "#{<<~"begin;"}\n#{<<~"end;"}", timeout: 10, signal: :SEGV) diff --git a/test/ruby/test_mjit.rb b/test/ruby/test_mjit.rb index fd7a4e270a..02be88aa32 100644 --- a/test/ruby/test_mjit.rb +++ b/test/ruby/test_mjit.rb @@ -969,23 +969,24 @@ class TestMJIT < Test::Unit::TestCase end def test_heap_promotion_of_ivar_in_the_middle_of_jit + omit if GC.using_rvargc? + assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: "true\ntrue\n", success_count: 2, min_calls: 2) begin; class A def initialize @iv0 = nil @iv1 = [] - @iv2 = nil end def test(add) @iv0.nil? - @iv2.nil? add_ivar if add @iv1.empty? end def add_ivar + @iv2 = nil @iv3 = nil end end |