OSDN Git Service

Fix stale remembered sets error.
authorMathieu Chartier <mathieuc@google.com>
Thu, 24 Jul 2014 01:45:17 +0000 (18:45 -0700)
committerMathieu Chartier <mathieuc@google.com>
Thu, 24 Jul 2014 17:19:38 +0000 (10:19 -0700)
We were forgetting to remove the remembered set in transition to
background. This resulted in remembered sets being added for
spaces which no longer existed. This finally caused an error when
a new space happened to have the same address as the old space,
resulting in a CHECK failure.

Also tuned the number of ParallelGC to prevent spurrious failures
and removed the ParallelGC from broken tests in the make file.

Bug: 16532086
Bug: 16406852

Change-Id: I00bbcbd7daa03c867732d165be62b72e6c43bce1

runtime/gc/heap.cc
test/114-ParallelGC/src/Main.java
test/Android.run-test.mk

index 48ae84d..1b9b077 100644 (file)
@@ -1605,6 +1605,10 @@ void Heap::TransitionCollector(CollectorType collector_type) {
         // Remove the main space so that we don't try to trim it, this doens't work for debug
         // builds since RosAlloc attempts to read the magic number from a protected page.
         RemoveSpace(main_space_);
+        RemoveRememberedSet(main_space_);
+        RemoveRememberedSet(main_space_backup_.get());
+        main_space_backup_.reset(nullptr);
+        main_space_ = nullptr;
         temp_space_ = space::BumpPointerSpace::CreateFromMemMap("Bump pointer space 2",
                                                                 mem_map.release());
         AddSpace(temp_space_);
index fb110bd..2285872 100644 (file)
@@ -39,7 +39,7 @@ public class Main implements Runnable {
 
     public void run() {
         List l = new ArrayList();
-        for (int i = 0; i < 500; i++) {
+        for (int i = 0; i < 400; i++) {
             l.add(new ArrayList(i));
         }
     }
index ac47da6..78493dc 100644 (file)
@@ -112,8 +112,7 @@ ART_TEST_KNOWN_BROKEN += $(foreach test, $(TEST_ART_BROKEN_TRACE_RUN_TESTS), $(c
 
 # Tests that need more than 2MB of RAM or are running into other corner cases in GC stress related
 # to OOMEs.
-TEST_ART_BROKEN_GCSTRESS_RUN_TESTS := \
-  114-ParallelGC
+TEST_ART_BROKEN_GCSTRESS_RUN_TESTS :=
 
 ART_TEST_KNOWN_BROKEN += $(foreach test, $(TEST_ART_BROKEN_GCSTRESS_RUN_TESTS), $(call all-run-test-names,$(test),-gcstress,-relocate))
 ART_TEST_KNOWN_BROKEN += $(foreach test, $(TEST_ART_BROKEN_GCSTRESS_RUN_TESTS), $(call all-run-test-names,$(test),-gcstress,-no-prebuild))