8132711: Add tests which check that Humongous objects behave as expected after Mixed GC
authorkzhaldyb
Wed, 29 Jun 2016 18:40:28 +0300
changeset 39618 ced8c3f59678
parent 39617 b8df29d17f9c
child 39620 aa37f6f84ef5
8132711: Add tests which check that Humongous objects behave as expected after Mixed GC Reviewed-by: tschatzl, dfazunen
hotspot/test/gc/g1/humongousObjects/objectGraphTest/GC.java
hotspot/test/gc/g1/humongousObjects/objectGraphTest/README
hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java
--- a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/GC.java	Wed Jun 29 17:01:55 2016 +0300
+++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/GC.java	Wed Jun 29 18:40:28 2016 +0300
@@ -138,6 +138,41 @@
         }
     },
 
+    MIXED_GC {
+        @Override
+        public Runnable get() {
+            return () -> {
+                WHITE_BOX.youngGC();
+                Helpers.waitTillCMCFinished(WHITE_BOX, 0);
+                WHITE_BOX.youngGC();
+                Helpers.waitTillCMCFinished(WHITE_BOX, 0);
+
+                WHITE_BOX.g1StartConcMarkCycle();
+                Helpers.waitTillCMCFinished(WHITE_BOX, 0);
+
+                WHITE_BOX.youngGC();
+                Helpers.waitTillCMCFinished(WHITE_BOX, 0);
+                // Provoking Mixed GC
+                WHITE_BOX.youngGC();// second evacuation pause will be mixed
+                Helpers.waitTillCMCFinished(WHITE_BOX, 0);
+            };
+        }
+
+        public Consumer<ReferenceInfo<Object[]>> getChecker() {
+            return getCheckerImpl(true, false, true, false);
+        }
+
+        @Override
+        public List<String> shouldContain() {
+            return Arrays.asList(GCTokens.WB_INITIATED_CMC);
+        }
+
+        @Override
+        public List<String> shouldNotContain() {
+            return Arrays.asList(GCTokens.YOUNG_GC);
+        }
+    },
+
     FULL_GC_MEMORY_PRESSURE {
         @Override
         public Runnable get() {
--- a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/README	Wed Jun 29 17:01:55 2016 +0300
+++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/README	Wed Jun 29 18:40:28 2016 +0300
@@ -38,6 +38,9 @@
                         non-humongous and humongous objects are not collected since we make 2 Young GC to promote all
                         weak references to Old Gen.
 
+6. Mixed GC - weakly referenced non-humongous and humongous objects are collected, softly referenced non-humongous and
+              humongous objects are not collected.
+
 The test gets gc type as a command line argument.
 Then the test allocates object graph in heap (currently testing scenarios are pre-generated and stored in
 TestcaseData.getPregeneratedTestcases()) with TestObjectGraphAfterGC::allocateObjectGraph.
--- a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java	Wed Jun 29 17:01:55 2016 +0300
+++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java	Wed Jun 29 18:40:28 2016 +0300
@@ -66,6 +66,12 @@
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  *
  * @run main/othervm -Xms200M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
+ * -XX:+UnlockExperimentalVMOptions -XX:MaxGCPauseMillis=30000 -XX:G1MixedGCLiveThresholdPercent=100 -XX:G1HeapWastePercent=0
+ * -XX:G1HeapRegionSize=1M -Xlog:gc=info:file=TestObjectGraphAfterGC_MIXED_GC.gc.log -XX:MaxTenuringThreshold=1
+ * -XX:G1MixedGCCountTarget=1  -XX:G1OldCSetRegionThresholdPercent=100 -XX:SurvivorRatio=1 -XX:InitiatingHeapOccupancyPercent=0
+ * gc.g1.humongousObjects.objectGraphTest.TestObjectGraphAfterGC MIXED_GC
+ *
+ * @run main/othervm -Xms200M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  * -XX:G1HeapRegionSize=1M -Xlog:gc*=debug:file=TestObjectGraphAfterGC_YOUNG_GC.gc.log
  * gc.g1.humongousObjects.objectGraphTest.TestObjectGraphAfterGC YOUNG_GC
  *