Skip to content

Commit

Permalink
Merge branch 'upstream-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Datadog Syncup Service committed Dec 21, 2024
2 parents e56a3ee + 43b7e9f commit 3fa988c
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 43 deletions.
33 changes: 18 additions & 15 deletions src/hotspot/share/gc/shenandoah/shenandoahGeneration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
25 changes: 19 additions & 6 deletions test/hotspot/jtreg/gc/TestPLABAdaptToMinTLABSize.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions test/jdk/tools/jpackage/share/RuntimeImageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions test/jdk/tools/jpackage/share/RuntimePackageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ private static PackageTest init(Set<PackageType> 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 {
Expand All @@ -112,6 +114,7 @@ private static PackageTest init(Set<PackageType> types) {
.addArguments(
"--output", runtimeImageDir.toString(),
"--add-modules", "ALL-MODULE-PATH",
"--module-path", jmods.toString(),
"--strip-debug",
"--no-header-files",
"--no-man-pages")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,18 @@ public Void scan(Element elem, Void ignore) {
*/
class TestTypeScanner extends TypeScanner<Void, Void> {
Element elem;
NavigableMap<Integer, AnnotationMirror> toBeFound;
NavigableMap<Integer, List<AnnotationMirror>> toBeFound;
int count = 0;
Set<TypeMirror> seen = new HashSet<>();

TestTypeScanner(Element elem, List<AnnotationMirror> tests, Types types) {
super(types);
this.elem = elem;

NavigableMap<Integer, AnnotationMirror> testByPos = new TreeMap<>();
NavigableMap<Integer, List<AnnotationMirror>> 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;
Expand All @@ -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()) {
Expand Down

0 comments on commit 3fa988c

Please sign in to comment.