From 7e9c5eee2a94624f660711c676031da1e00116af Mon Sep 17 00:00:00 2001 From: Florian Grabmeier Date: Tue, 24 Oct 2023 19:19:28 +0200 Subject: [PATCH 1/6] Removed duplicate System.gc() in test --- .../org/openj9/test/lworld/ValueTypeTests.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/test/functional/Valhalla/src_qtypes/org/openj9/test/lworld/ValueTypeTests.java b/test/functional/Valhalla/src_qtypes/org/openj9/test/lworld/ValueTypeTests.java index a5879943243..8cc468ffb60 100644 --- a/test/functional/Valhalla/src_qtypes/org/openj9/test/lworld/ValueTypeTests.java +++ b/test/functional/Valhalla/src_qtypes/org/openj9/test/lworld/ValueTypeTests.java @@ -339,7 +339,6 @@ static public void testGCFlattenedPoint2DArray() throws Throwable { Array.set(arrayObject, i, point2D); } - System.gc(); System.gc(); Object value = Array.get(arrayObject, 0); @@ -354,7 +353,6 @@ static public void testGCFlattenedValueArrayWithSingleAlignment() throws Throwab Array.set(array, i, object); } - System.gc(); System.gc(); for (int i = 0; i < 4; i++) { @@ -371,7 +369,6 @@ static public void testGCFlattenedValueArrayWithObjectAlignment() throws Throwab Array.set(array, i, object); } - System.gc(); System.gc(); for (int i = 0; i < 4; i++) { @@ -388,7 +385,6 @@ static public void testGCFlattenedValueArrayWithLongAlignment() throws Throwable Array.set(array, i, object); } - System.gc(); System.gc(); for (int i = 0; i < genericArraySize; i++) { @@ -405,7 +401,6 @@ static public void testGCFlattenedLargeObjectArray() throws Throwable { Array.set(arrayObject, i, largeObjectRef); } - System.gc(); System.gc(); Object value = Array.get(arrayObject, 0); @@ -416,14 +411,12 @@ static public void testGCFlattenedMegaObjectArray() throws Throwable { Object arrayObject = Array.newInstance(megaObjectValueClass, 4); Object megaObjectRef = createMegaObject(new Object()); - System.gc(); System.gc(); for (int i = 0; i < 4; i++) { Array.set(arrayObject, i, megaObjectRef); } System.gc(); - System.gc(); Object value = Array.get(arrayObject, 0); } @@ -2188,7 +2181,6 @@ static public void testCreateLargeNumberOfPoint2D() throws Throwable { MethodHandle makePoint2DX = lookup.findStatic(point2DXClass, "makeValueGeneric", MethodType.methodType(Object.class, Object.class, Object.class)); if (0 == (valueIndex % 100)) { System.gc(); - System.gc(); } } } @@ -2556,7 +2548,6 @@ static public void testValueWithLongAlignmentGCScanning() throws Throwable { longAlignmentArrayList.add(newLongAlignmentArray); } - System.gc(); System.gc(); for (int i = 0; i < objectGCScanningIterationCount; i++) { @@ -2582,7 +2573,6 @@ static public void testValueWithObjectAlignmentGCScanning() throws Throwable { objectAlignmentArrayList.add(newObjectAlignmentArray); } - System.gc(); System.gc(); for (int i = 0; i < objectGCScanningIterationCount; i++) { @@ -2608,7 +2598,6 @@ static public void testValueWithSingleAlignmentGCScanning() throws Throwable { singleAlignmentArrayList.add(newSingleAlignmentArray); } - System.gc(); System.gc(); for (int i = 0; i < objectGCScanningIterationCount; i++) { From 20c51532f9609041ed2b09542118f6b3fb2f623e Mon Sep 17 00:00:00 2001 From: Florian Grabmeier Date: Tue, 24 Oct 2023 22:04:20 +0200 Subject: [PATCH 2/6] Removed all duplicate System.gc() --- .../JIT_Test/src/jit/test/finalizer/TestObject.java | 2 -- .../test/java/lang/management/TestGarbageCollectorMXBean.java | 1 - .../src/org/openj9/test/condy/GarbageCollectionCondyTest.java | 1 - .../src/com/ibm/dump/tests/jdmpview_heapdump/CreateDumps.java | 1 - .../VM_Test/src/com/ibm/j9/monitor/tests/LockNurseryTest.java | 2 -- .../j9vm/test/classunloading/ClassUnloadingTestParent.java | 2 -- .../VM_Test/src/j9vm/test/hash/HashCodeTestParent.java | 1 - .../com/ibm/tests/garbagecollector/TestContractionMain.java | 4 ---- 8 files changed, 14 deletions(-) diff --git a/test/functional/JIT_Test/src/jit/test/finalizer/TestObject.java b/test/functional/JIT_Test/src/jit/test/finalizer/TestObject.java index 926ea149b59..bd56f293a03 100644 --- a/test/functional/JIT_Test/src/jit/test/finalizer/TestObject.java +++ b/test/functional/JIT_Test/src/jit/test/finalizer/TestObject.java @@ -66,12 +66,10 @@ public static boolean isFinalized(String name) { } protected static void thoroughGCandFinalization() { - System.gc(); System.gc(); System.runFinalization(); System.runFinalization(); System.gc(); - System.gc(); System.runFinalization(); System.runFinalization(); } diff --git a/test/functional/JLM_Tests/src/org/openj9/test/java/lang/management/TestGarbageCollectorMXBean.java b/test/functional/JLM_Tests/src/org/openj9/test/java/lang/management/TestGarbageCollectorMXBean.java index 8a7a87738ea..41cb856adbd 100644 --- a/test/functional/JLM_Tests/src/org/openj9/test/java/lang/management/TestGarbageCollectorMXBean.java +++ b/test/functional/JLM_Tests/src/org/openj9/test/java/lang/management/TestGarbageCollectorMXBean.java @@ -114,7 +114,6 @@ protected void setUp() throws Exception { public final void testGetLastGcInfo() { AssertJUnit.assertTrue(gcb instanceof com.sun.management.GarbageCollectorMXBean); System.gc(); - System.gc(); AssertJUnit.assertTrue(((com.sun.management.GarbageCollectorMXBean)gcb).getLastGcInfo() != null); } diff --git a/test/functional/Java11andUp/src/org/openj9/test/condy/GarbageCollectionCondyTest.java b/test/functional/Java11andUp/src/org/openj9/test/condy/GarbageCollectionCondyTest.java index 67237ebfabc..9c64f70eb95 100644 --- a/test/functional/Java11andUp/src/org/openj9/test/condy/GarbageCollectionCondyTest.java +++ b/test/functional/Java11andUp/src/org/openj9/test/condy/GarbageCollectionCondyTest.java @@ -65,7 +65,6 @@ private void runTest(byte[] classBytes, String className) { new RuntimeException("Error calling method: getCondy()" + e); } System.gc(); - System.gc(); try { Method condyMethod = condyClass.getDeclaredMethod("getCondy"); Object result2 = "Result2 initial value"; diff --git a/test/functional/RasapiTest/src/com/ibm/dump/tests/jdmpview_heapdump/CreateDumps.java b/test/functional/RasapiTest/src/com/ibm/dump/tests/jdmpview_heapdump/CreateDumps.java index bdb24dc6f1c..6e70be8ab86 100644 --- a/test/functional/RasapiTest/src/com/ibm/dump/tests/jdmpview_heapdump/CreateDumps.java +++ b/test/functional/RasapiTest/src/com/ibm/dump/tests/jdmpview_heapdump/CreateDumps.java @@ -24,7 +24,6 @@ public class CreateDumps { public static void main(String[] args) { - System.gc(); System.gc(); com.ibm.jvm.Dump.HeapDump(); com.ibm.jvm.Dump.SystemDump(); diff --git a/test/functional/VM_Test/src/com/ibm/j9/monitor/tests/LockNurseryTest.java b/test/functional/VM_Test/src/com/ibm/j9/monitor/tests/LockNurseryTest.java index 8f8793ba266..59fba854a61 100644 --- a/test/functional/VM_Test/src/com/ibm/j9/monitor/tests/LockNurseryTest.java +++ b/test/functional/VM_Test/src/com/ibm/j9/monitor/tests/LockNurseryTest.java @@ -72,8 +72,6 @@ public static void generateGarbageAndCollect(){ } System.out.println("Finished generating garbage, requesting gc"); System.gc(); - System.gc(); - System.gc(); System.out.println("GC complete ?");*/ } diff --git a/test/functional/VM_Test/src/j9vm/test/classunloading/ClassUnloadingTestParent.java b/test/functional/VM_Test/src/j9vm/test/classunloading/ClassUnloadingTestParent.java index 89b71b02609..f227af8f704 100644 --- a/test/functional/VM_Test/src/j9vm/test/classunloading/ClassUnloadingTestParent.java +++ b/test/functional/VM_Test/src/j9vm/test/classunloading/ClassUnloadingTestParent.java @@ -61,12 +61,10 @@ public void runTest() throws Exception { } protected static void thoroughGCandFinalization() { - System.gc(); System.gc(); System.runFinalization(); System.runFinalization(); System.gc(); - System.gc(); System.runFinalization(); System.runFinalization(); } diff --git a/test/functional/VM_Test/src/j9vm/test/hash/HashCodeTestParent.java b/test/functional/VM_Test/src/j9vm/test/hash/HashCodeTestParent.java index 0c6ddaf0007..320e21f2c46 100644 --- a/test/functional/VM_Test/src/j9vm/test/hash/HashCodeTestParent.java +++ b/test/functional/VM_Test/src/j9vm/test/hash/HashCodeTestParent.java @@ -51,7 +51,6 @@ public HashCodeTestParent(int mode) { public void gc() { switch (mode) { case MODE_SYSTEM_GC: - System.gc(); System.gc(); break; case MODE_SCAVENGE: diff --git a/test/functional/cmdLineTests/gcRegressionTests/src/com/ibm/tests/garbagecollector/TestContractionMain.java b/test/functional/cmdLineTests/gcRegressionTests/src/com/ibm/tests/garbagecollector/TestContractionMain.java index efe203bd88a..c5adf57a759 100644 --- a/test/functional/cmdLineTests/gcRegressionTests/src/com/ibm/tests/garbagecollector/TestContractionMain.java +++ b/test/functional/cmdLineTests/gcRegressionTests/src/com/ibm/tests/garbagecollector/TestContractionMain.java @@ -67,12 +67,8 @@ public static void main(String[] args) long highWaterMem = runtime.totalMemory(); _array = null; System.gc(); - System.gc(); - System.gc(); long tempMem = runtime.totalMemory(); System.gc(); - System.gc(); - System.gc(); long tempMem2 = runtime.totalMemory(); if (verbose) From 21b7d02f15bc3d74e3523920b1b79a36d452c934 Mon Sep 17 00:00:00 2001 From: Florian Grabmeier Date: Wed, 25 Oct 2023 21:30:03 +0200 Subject: [PATCH 3/6] Revert change calling GC three times --- .../com/ibm/tests/garbagecollector/TestContractionMain.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/functional/cmdLineTests/gcRegressionTests/src/com/ibm/tests/garbagecollector/TestContractionMain.java b/test/functional/cmdLineTests/gcRegressionTests/src/com/ibm/tests/garbagecollector/TestContractionMain.java index c5adf57a759..efe203bd88a 100644 --- a/test/functional/cmdLineTests/gcRegressionTests/src/com/ibm/tests/garbagecollector/TestContractionMain.java +++ b/test/functional/cmdLineTests/gcRegressionTests/src/com/ibm/tests/garbagecollector/TestContractionMain.java @@ -67,8 +67,12 @@ public static void main(String[] args) long highWaterMem = runtime.totalMemory(); _array = null; System.gc(); + System.gc(); + System.gc(); long tempMem = runtime.totalMemory(); System.gc(); + System.gc(); + System.gc(); long tempMem2 = runtime.totalMemory(); if (verbose) From 571d8d4cb7856a04da4f6f1f9c4ed0ac38546a61 Mon Sep 17 00:00:00 2001 From: Florian Grabmeier Date: Wed, 1 Nov 2023 09:17:55 +0100 Subject: [PATCH 4/6] Replace triple call of SystemGC() to double Signed-off-by: Florian Grabmeier --- .../src/com/ibm/tests/garbagecollector/TestContractionMain.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/functional/cmdLineTests/gcRegressionTests/src/com/ibm/tests/garbagecollector/TestContractionMain.java b/test/functional/cmdLineTests/gcRegressionTests/src/com/ibm/tests/garbagecollector/TestContractionMain.java index efe203bd88a..dedc8ec3687 100644 --- a/test/functional/cmdLineTests/gcRegressionTests/src/com/ibm/tests/garbagecollector/TestContractionMain.java +++ b/test/functional/cmdLineTests/gcRegressionTests/src/com/ibm/tests/garbagecollector/TestContractionMain.java @@ -68,11 +68,9 @@ public static void main(String[] args) _array = null; System.gc(); System.gc(); - System.gc(); long tempMem = runtime.totalMemory(); System.gc(); System.gc(); - System.gc(); long tempMem2 = runtime.totalMemory(); if (verbose) From b39dd8d11ba07e013b12c3cb8d0f12e11673d266 Mon Sep 17 00:00:00 2001 From: Florian Grabmeier Date: Wed, 1 Nov 2023 09:23:56 +0100 Subject: [PATCH 5/6] Reduce calls of SystemRunFinaliziation() Signed-off-by: Florian Grabmeier --- test/functional/JIT_Test/src/jit/test/finalizer/TestObject.java | 2 -- .../src/j9vm/test/classunloading/ClassUnloadingTestParent.java | 2 -- 2 files changed, 4 deletions(-) diff --git a/test/functional/JIT_Test/src/jit/test/finalizer/TestObject.java b/test/functional/JIT_Test/src/jit/test/finalizer/TestObject.java index bd56f293a03..9a3688515ff 100644 --- a/test/functional/JIT_Test/src/jit/test/finalizer/TestObject.java +++ b/test/functional/JIT_Test/src/jit/test/finalizer/TestObject.java @@ -68,10 +68,8 @@ public static boolean isFinalized(String name) { protected static void thoroughGCandFinalization() { System.gc(); System.runFinalization(); - System.runFinalization(); System.gc(); System.runFinalization(); - System.runFinalization(); } @Test(groups = { "level.sanity","component.jit" }) diff --git a/test/functional/VM_Test/src/j9vm/test/classunloading/ClassUnloadingTestParent.java b/test/functional/VM_Test/src/j9vm/test/classunloading/ClassUnloadingTestParent.java index f227af8f704..717faaa0c11 100644 --- a/test/functional/VM_Test/src/j9vm/test/classunloading/ClassUnloadingTestParent.java +++ b/test/functional/VM_Test/src/j9vm/test/classunloading/ClassUnloadingTestParent.java @@ -63,10 +63,8 @@ public void runTest() throws Exception { protected static void thoroughGCandFinalization() { System.gc(); System.runFinalization(); - System.runFinalization(); System.gc(); System.runFinalization(); - System.runFinalization(); } protected void verifyUnloads() { From 1b76dbdf203a64104fae6c579ebfaa6b77f69a66 Mon Sep 17 00:00:00 2001 From: Florian Grabmeier Date: Wed, 1 Nov 2023 17:09:41 +0100 Subject: [PATCH 6/6] Revert GC for generateGarbageAndCollect Signed-off-by: Florian Grabmeier --- .../VM_Test/src/com/ibm/j9/monitor/tests/LockNurseryTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/functional/VM_Test/src/com/ibm/j9/monitor/tests/LockNurseryTest.java b/test/functional/VM_Test/src/com/ibm/j9/monitor/tests/LockNurseryTest.java index 59fba854a61..8f8793ba266 100644 --- a/test/functional/VM_Test/src/com/ibm/j9/monitor/tests/LockNurseryTest.java +++ b/test/functional/VM_Test/src/com/ibm/j9/monitor/tests/LockNurseryTest.java @@ -72,6 +72,8 @@ public static void generateGarbageAndCollect(){ } System.out.println("Finished generating garbage, requesting gc"); System.gc(); + System.gc(); + System.gc(); System.out.println("GC complete ?");*/ }