diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGeneration.cpp b/src/hotspot/share/gc/shenandoah/shenandoahGeneration.cpp index 2bebac05f158f..c72940c3c3a75 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGeneration.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGeneration.cpp @@ -205,21 +205,24 @@ void ShenandoahGeneration::log_status(const char *msg) const { // Not under a lock here, so read each of these once to make sure // byte size in proper unit and proper unit for byte size are consistent. - size_t v_used = used(); - size_t v_used_regions = used_regions_size(); - size_t v_soft_max_capacity = soft_max_capacity(); - size_t v_max_capacity = max_capacity(); - size_t v_available = available(); - size_t v_humongous_waste = get_humongous_waste(); - LogGcInfo::print("%s: %s generation used: " SIZE_FORMAT "%s, used regions: " SIZE_FORMAT "%s, " - "humongous waste: " SIZE_FORMAT "%s, soft capacity: " SIZE_FORMAT "%s, max capacity: " SIZE_FORMAT "%s, " - "available: " SIZE_FORMAT "%s", msg, name(), - byte_size_in_proper_unit(v_used), proper_unit_for_byte_size(v_used), - byte_size_in_proper_unit(v_used_regions), proper_unit_for_byte_size(v_used_regions), - byte_size_in_proper_unit(v_humongous_waste), proper_unit_for_byte_size(v_humongous_waste), - byte_size_in_proper_unit(v_soft_max_capacity), proper_unit_for_byte_size(v_soft_max_capacity), - byte_size_in_proper_unit(v_max_capacity), proper_unit_for_byte_size(v_max_capacity), - byte_size_in_proper_unit(v_available), proper_unit_for_byte_size(v_available)); + const size_t v_used = used(); + const size_t v_used_regions = used_regions_size(); + const size_t v_soft_max_capacity = soft_max_capacity(); + const size_t v_max_capacity = max_capacity(); + const size_t v_available = available(); + const size_t v_humongous_waste = get_humongous_waste(); + + const LogGcInfo target; + LogStream ls(target); + ls.print("%s: ", msg); + if (_type != NON_GEN) { + ls.print("%s generation ", name()); + } + + ls.print_cr("used: " PROPERFMT ", used regions: " PROPERFMT ", humongous waste: " PROPERFMT + ", soft capacity: " PROPERFMT ", max capacity: " PROPERFMT ", available: " PROPERFMT, + PROPERFMTARGS(v_used), PROPERFMTARGS(v_used_regions), PROPERFMTARGS(v_humongous_waste), + PROPERFMTARGS(v_soft_max_capacity), PROPERFMTARGS(v_max_capacity), PROPERFMTARGS(v_available)); } void ShenandoahGeneration::reset_mark_bitmap() { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.cpp b/src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.cpp index 6cbb5454ac173..9350f44585fcf 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.cpp @@ -93,11 +93,6 @@ size_t ShenandoahGenerationalMemoryPool::used_in_bytes() { return _generation->used(); } -size_t ShenandoahGenerationalMemoryPool::max_size() const { - return _generation->max_capacity(); -} - - ShenandoahYoungGenMemoryPool::ShenandoahYoungGenMemoryPool(ShenandoahHeap* heap) : ShenandoahGenerationalMemoryPool(heap, "Shenandoah Young Gen", diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.hpp b/src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.hpp index e26d61a3a6c56..ccdfdddede950 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.hpp @@ -55,7 +55,6 @@ class ShenandoahGenerationalMemoryPool: public ShenandoahMemoryPool { explicit ShenandoahGenerationalMemoryPool(ShenandoahHeap* heap, const char* name, ShenandoahGeneration* generation); MemoryUsage get_memory_usage() override; size_t used_in_bytes() override; - size_t max_size() const override; }; class ShenandoahYoungGenMemoryPool : public ShenandoahGenerationalMemoryPool { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahRegulatorThread.cpp b/src/hotspot/share/gc/shenandoah/shenandoahRegulatorThread.cpp index 696e0a9b6956a..f8e0e7125acdb 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahRegulatorThread.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahRegulatorThread.cpp @@ -64,7 +64,8 @@ void ShenandoahRegulatorThread::regulate_young_and_old_cycles() { if (mode == ShenandoahGenerationalControlThread::none) { if (should_start_metaspace_gc()) { if (request_concurrent_gc(GLOBAL)) { - log_debug(gc)("Heuristics request for global (unload classes) accepted."); + // Some of vmTestbase/metaspace tests depend on following line to count GC cycles + _global_heuristics->log_trigger("%s", GCCause::to_string(GCCause::_metadata_GC_threshold)); } } else { if (_young_heuristics->should_start_gc()) { diff --git a/test/hotspot/jtreg/gc/TestPLABAdaptToMinTLABSize.java b/test/hotspot/jtreg/gc/TestPLABAdaptToMinTLABSize.java index 73d3c47533517..e1e29432f539c 100644 --- a/test/hotspot/jtreg/gc/TestPLABAdaptToMinTLABSize.java +++ b/test/hotspot/jtreg/gc/TestPLABAdaptToMinTLABSize.java @@ -24,17 +24,29 @@ package gc; /* - * @test TestPLABAdaptToMinTLABSize + * @test TestPLABAdaptToMinTLABSizeG1 * @bug 8289137 * @summary Make sure that Young/OldPLABSize adapt to MinTLABSize setting. - * @requires vm.gc.Parallel | vm.gc.G1 + * @requires vm.gc.G1 * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @run driver gc.TestPLABAdaptToMinTLABSize + * @run driver gc.TestPLABAdaptToMinTLABSize -XX:+UseG1GC + */ + +/* + * @test TestPLABAdaptToMinTLABSizeParallel + * @bug 8289137 + * @summary Make sure that Young/OldPLABSize adapt to MinTLABSize setting. + * @requires vm.gc.Parallel + * @library /test/lib + * @modules java.base/jdk.internal.misc + * java.management + * @run driver gc.TestPLABAdaptToMinTLABSize -XX:+UseParallelGC */ import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import jdk.test.lib.process.OutputAnalyzer; @@ -68,9 +80,10 @@ private static void runTest(boolean shouldSucceed, String... extraArgs) throws E } public static void main(String[] args) throws Exception { - runTest(true, "-XX:MinTLABSize=100k"); + String gc = args[0]; + runTest(true, gc, "-XX:MinTLABSize=100k"); // Should not succeed when explicitly specifying invalid combination. - runTest(false, "-XX:MinTLABSize=100k", "-XX:OldPLABSize=5k"); - runTest(false, "-XX:MinTLABSize=100k", "-XX:YoungPLABSize=5k"); + runTest(false, gc, "-XX:MinTLABSize=100k", "-XX:OldPLABSize=5k"); + runTest(false, gc, "-XX:MinTLABSize=100k", "-XX:YoungPLABSize=5k"); } } diff --git a/test/hotspot/jtreg/gc/g1/pinnedobjs/TestPinnedHumongousFragmentation.java b/test/hotspot/jtreg/gc/g1/pinnedobjs/TestPinnedHumongousFragmentation.java index fad01ab002206..f147dcbe62e0a 100644 --- a/test/hotspot/jtreg/gc/g1/pinnedobjs/TestPinnedHumongousFragmentation.java +++ b/test/hotspot/jtreg/gc/g1/pinnedobjs/TestPinnedHumongousFragmentation.java @@ -36,7 +36,7 @@ * @build jdk.test.whitebox.WhiteBox * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox * @run main/othervm -Xlog:gc+region=trace -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g - * -XX:VerifyGCType=full -XX:+VerifyDuringGC -XX:+VerifyAfterGC -XX:+WhiteBoxAPI -Xbootclasspath/a:. + * -XX:VerifyGCType=full -XX:+VerifyDuringGC -XX:+VerifyAfterGC -XX:+WhiteBoxAPI -XX:+UseG1GC -Xbootclasspath/a:. * gc.g1.pinnedobjs.TestPinnedHumongousFragmentation */ diff --git a/test/hotspot/jtreg/gc/g1/pinnedobjs/TestPinnedObjectContents.java b/test/hotspot/jtreg/gc/g1/pinnedobjs/TestPinnedObjectContents.java index e0fdc88e2a1ca..dcc87f811b381 100644 --- a/test/hotspot/jtreg/gc/g1/pinnedobjs/TestPinnedObjectContents.java +++ b/test/hotspot/jtreg/gc/g1/pinnedobjs/TestPinnedObjectContents.java @@ -33,7 +33,8 @@ * java.management * @build jdk.test.whitebox.WhiteBox * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. -XX:+ZapUnusedHeapArea -Xlog:gc,gc+ergo+cset=trace gc.g1.pinnedobjs.TestPinnedObjectContents + * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+UseG1GC + * -Xbootclasspath/a:. -XX:+ZapUnusedHeapArea -Xlog:gc,gc+ergo+cset=trace gc.g1.pinnedobjs.TestPinnedObjectContents */ package gc.g1.pinnedobjs; diff --git a/test/jdk/tools/jpackage/share/RuntimeImageSymbolicLinksTest.java b/test/jdk/tools/jpackage/share/RuntimeImageSymbolicLinksTest.java index 404cd3b6d3a47..db74e3456c4ee 100644 --- a/test/jdk/tools/jpackage/share/RuntimeImageSymbolicLinksTest.java +++ b/test/jdk/tools/jpackage/share/RuntimeImageSymbolicLinksTest.java @@ -51,6 +51,7 @@ public class RuntimeImageSymbolicLinksTest { @Test public static void test() throws Exception { + final Path jmods = Path.of(System.getProperty("java.home"), "jmods"); final Path workDir = TKit.createTempDirectory("runtime").resolve("data"); final Path jlinkOutputDir = workDir.resolve("temp.runtime"); Files.createDirectories(jlinkOutputDir.getParent()); @@ -61,6 +62,7 @@ public static void test() throws Exception { .addArguments( "--output", jlinkOutputDir.toString(), "--add-modules", "ALL-MODULE-PATH", + "--module-path", jmods.toString(), "--strip-debug", "--no-header-files", "--no-man-pages", diff --git a/test/jdk/tools/jpackage/share/RuntimeImageTest.java b/test/jdk/tools/jpackage/share/RuntimeImageTest.java index f3751c9ee472a..65e8c448d39a6 100644 --- a/test/jdk/tools/jpackage/share/RuntimeImageTest.java +++ b/test/jdk/tools/jpackage/share/RuntimeImageTest.java @@ -44,6 +44,7 @@ public class RuntimeImageTest { @Test public static void test() throws Exception { + final Path jmods = Path.of(System.getProperty("java.home"), "jmods"); final Path workDir = TKit.createTempDirectory("runtime").resolve("data"); final Path jlinkOutputDir = workDir.resolve("temp.runtime"); Files.createDirectories(jlinkOutputDir.getParent()); @@ -54,6 +55,7 @@ public static void test() throws Exception { .addArguments( "--output", jlinkOutputDir.toString(), "--add-modules", "ALL-MODULE-PATH", + "--module-path", jmods.toString(), "--strip-debug", "--no-header-files", "--no-man-pages", diff --git a/test/jdk/tools/jpackage/share/RuntimePackageTest.java b/test/jdk/tools/jpackage/share/RuntimePackageTest.java index 0b505babcc561..73f1c5256543d 100644 --- a/test/jdk/tools/jpackage/share/RuntimePackageTest.java +++ b/test/jdk/tools/jpackage/share/RuntimePackageTest.java @@ -101,6 +101,8 @@ private static PackageTest init(Set types) { .forTypes(types) .addInitializer(cmd -> { final Path runtimeImageDir; + final Path jmods = Path.of(System.getProperty("java.home"), "jmods"); + if (JPackageCommand.DEFAULT_RUNTIME_IMAGE != null) { runtimeImageDir = JPackageCommand.DEFAULT_RUNTIME_IMAGE; } else { @@ -112,6 +114,7 @@ private static PackageTest init(Set types) { .addArguments( "--output", runtimeImageDir.toString(), "--add-modules", "ALL-MODULE-PATH", + "--module-path", jmods.toString(), "--strip-debug", "--no-header-files", "--no-man-pages") diff --git a/test/langtools/tools/javac/processing/model/type/BasicAnnoTests.java b/test/langtools/tools/javac/processing/model/type/BasicAnnoTests.java index 904e4e78cad1f..f94ba461a4500 100644 --- a/test/langtools/tools/javac/processing/model/type/BasicAnnoTests.java +++ b/test/langtools/tools/javac/processing/model/type/BasicAnnoTests.java @@ -163,7 +163,7 @@ public Void scan(Element elem, Void ignore) { */ class TestTypeScanner extends TypeScanner { Element elem; - NavigableMap toBeFound; + NavigableMap> toBeFound; int count = 0; Set seen = new HashSet<>(); @@ -171,10 +171,10 @@ class TestTypeScanner extends TypeScanner { super(types); this.elem = elem; - NavigableMap testByPos = new TreeMap<>(); + NavigableMap> testByPos = new TreeMap<>(); for (AnnotationMirror test : tests) { for (int pos : getPosn(test)) { - testByPos.put(pos, test); + testByPos.computeIfAbsent(pos, ArrayList::new).add(test); } } this.toBeFound = testByPos; @@ -196,17 +196,18 @@ Void scan(TypeMirror t, Void ignore) { out.println("scan " + count + ": " + t); if (toBeFound.size() > 0) { if (toBeFound.firstKey().equals(count)) { - AnnotationMirror test = toBeFound.pollFirstEntry().getValue(); - String annoType = getAnnoType(test); - AnnotationMirror anno = getAnnotation(t, annoType); - if (anno == null) { - error(elem, "annotation not found on " + count + ": " + t); - } else { - String v = getValue(anno, "value").toString(); - if (v.equals(getExpect(test))) { - out.println("found " + anno + " as expected"); + for (AnnotationMirror test : toBeFound.pollFirstEntry().getValue()) { + String annoType = getAnnoType(test); + AnnotationMirror anno = getAnnotation(t, annoType); + if (anno == null) { + error(elem, "annotation not found on " + count + ": " + t); } else { - error(elem, "Unexpected value: " + v + ", expected: " + getExpect(test)); + String v = getValue(anno, "value").toString(); + if (v.equals(getExpect(test))) { + out.println("found " + anno + " as expected"); + } else { + error(elem, "Unexpected value: " + v + ", expected: " + getExpect(test)); + } } } } else if (count > toBeFound.firstKey()) {