Skip to content

Commit

Permalink
[GR-44862] [GR-44252] JDK 21 adoption.
Browse files Browse the repository at this point in the history
PullRequest: graal/14080
  • Loading branch information
dougxc committed Apr 1, 2023
2 parents d86c0af + 734f621 commit de7a579
Show file tree
Hide file tree
Showing 254 changed files with 689 additions and 175 deletions.
2 changes: 1 addition & 1 deletion ci/ci_common/common.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ common + common.frequencies + {
windows_amd64: common.windows_amd64 + graal_common_extras,
windows_server_2016_amd64: common.windows_server_2016_amd64 + graal_common_extras,

// Other
// See GR-31169 for description of the mach5 target
mach5_target:: {targets+: ["mach5"]},
}
4 changes: 4 additions & 0 deletions ci/common.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ local common_json = import "../common.json";
} + {
[name]: common_json.jdks[name] + { jdk_version:: 20 }
for name in ["oraclejdk20"] + variants("labsjdk-ce-20") + variants("labsjdk-ee-20")
} + {
[name]: common_json.jdks[name] + { jdk_version:: 21 }
for name in ["oraclejdk21"]
},
assert std.assertEqual(std.objectFields(common_json.jdks), std.objectFields(jdks_data)),

Expand Down Expand Up @@ -52,6 +55,7 @@ local common_json = import "../common.json";
"windows-jdk17": { packages+: { "devkit:VS2022-17.1.0+1": "==0" }},
"windows-jdk19": { packages+: { "devkit:VS2022-17.1.0+1": "==0" }},
"windows-jdk20": { packages+: { "devkit:VS2022-17.1.0+1": "==0" }},
"windows-jdk21": { packages+: { "devkit:VS2022-17.1.0+1": "==1" }},
"linux-jdk17": { packages+: { "devkit:gcc10.3.0-OL6.4+1": "==0" }},
"linux-jdk19": { packages+: { "devkit:gcc11.2.0-OL6.4+1": "==0" }},
"linux-jdk20": { packages+: { "devkit:gcc11.2.0-OL6.4+1": "==0" }},
Expand Down
4 changes: 3 additions & 1 deletion common.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
"labsjdk-ce-20-llvm": {"name": "labsjdk", "version": "ce-20+34-jvmci-23.0-b10-sulong", "platformspecific": true },
"labsjdk-ee-20": {"name": "labsjdk", "version": "ee-20.0.1+9-jvmci-23.0-b10", "platformspecific": true },
"labsjdk-ee-20Debug": {"name": "labsjdk", "version": "ee-20.0.1+9-jvmci-23.0-b10-debug", "platformspecific": true },
"labsjdk-ee-20-llvm": {"name": "labsjdk", "version": "ee-20.0.1+9-jvmci-23.0-b10-sulong", "platformspecific": true }
"labsjdk-ee-20-llvm": {"name": "labsjdk", "version": "ee-20.0.1+9-jvmci-23.0-b10-sulong", "platformspecific": true },

"oraclejdk21": {"name": "jpg-jdk", "version": "21", "build_id": "15", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]}
},

"eclipse": {
Expand Down
32 changes: 22 additions & 10 deletions compiler/ci/ci_common/gate.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@

"weekly-compiler-coverage*": {},

"weekly-compiler-test-labsjdk-20Debug-linux-amd64": {},
"weekly-compiler-test-labsjdk-20Debug-linux-amd64": t("5:00:00"),

"weekly-compiler-test_serialgc-labsjdk-20-linux-amd64": t("1:00:00") + c.mach5_target,
"weekly-compiler-test_serialgc-labsjdk-20-linux-aarch64": t("1:50:00"),
Expand All @@ -296,11 +296,12 @@
# returns: an object with a single "build" field
make_build(jdk, os_arch, task, suite="compiler", extra_tasks={},
include_common_os_arch=true,
jdk_name="labsjdk",
gates_manifest=gates,
dailies_manifest=dailies,
weeklies_manifest=weeklies,
monthlies_manifest=monthlies):: {
local base_name = "%s-%s-labsjdk-%s-%s" % [suite, task, jdk, os_arch],
local base_name = "%s-%s-%s-%s-%s" % [suite, task, jdk_name, jdk, os_arch],
local gate_name = "gate-" + base_name,
local daily_name = "daily-" + base_name,
local weekly_name = "weekly-" + base_name,
Expand All @@ -327,7 +328,7 @@
else monthly_name
} +
(s + extra_tasks)[task] +
c["labsjdk%s" % jdk] +
c["%s%s" % [jdk_name, jdk]] +
(if include_common_os_arch then c[std.strReplace(os_arch, "-", "_")] else {}) +
(if is_daily then s.daily else {}) +
(if is_weekly then s.weekly else {}) +
Expand Down Expand Up @@ -365,19 +366,21 @@
true
},

local all_os_arches = [
"linux-amd64",
"linux-aarch64",
"darwin-amd64",
"darwin-aarch64",
"windows-amd64"
],

# Builds run on all platforms (platform = JDK + OS + ARCH)
local all_platforms_builds = [self.make_build(jdk, os_arch, task).build
for jdk in [
"17",
"20"
]
for os_arch in [
"linux-amd64",
"linux-aarch64",
"darwin-amd64",
"darwin-aarch64",
"windows-amd64"
]
for os_arch in all_os_arches
for task in [
"test",
"truffle_xcomp",
Expand Down Expand Up @@ -441,6 +444,14 @@
]
],

# Builds run on only on jdk21
local jdk21_builds = [self.make_build("21", os_arch, task, jdk_name="oraclejdk").build
for os_arch in all_os_arches
for task in [
"test",
]
],

# Builds run on only on linux-amd64-jdk20Debug
local linux_amd64_jdk20Debug_builds = [self.make_build("20Debug", "linux-amd64", task).build
for task in [
Expand All @@ -454,6 +465,7 @@
all_platforms_builds +
all_zgc_builds +
all_serialgc_builds +
jdk21_builds +
linux_amd64_jdk20_builds +
linux_amd64_jdk20Debug_builds,

Expand Down
1 change: 1 addition & 0 deletions compiler/mx.compiler/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -2062,6 +2062,7 @@
"exports" : [
"""* to com.oracle.graal.graal_enterprise,org.graalvm.nativeimage.pointsto,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.llvm,com.oracle.svm.svm_enterprise,com.oracle.svm_enterprise.ml_dataset,org.graalvm.nativeimage.base,
org.graalvm.extraimage.builder,com.oracle.svm.extraimage_enterprise""",
"org.graalvm.compiler.java to org.graalvm.nativeimage.agent.tracing,org.graalvm.nativeimage.configure",
"org.graalvm.compiler.core.common to jdk.internal.vm.compiler.management,org.graalvm.nativeimage.agent.tracing,org.graalvm.nativeimage.objectfile",
"org.graalvm.compiler.debug to jdk.internal.vm.compiler.management,org.graalvm.nativeimage.objectfile",
"org.graalvm.compiler.hotspot to jdk.internal.vm.compiler.management",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@
* in the unnamed module associated with the loader.
*/
public class ExportingClassLoader extends ClassLoader {
@SuppressWarnings("this-escape")
public ExportingClassLoader() {
ModuleSupport.exportAllPackagesTo(getClass(), this);
}

@SuppressWarnings("this-escape")
public ExportingClassLoader(ClassLoader parent) {
super(parent);
ModuleSupport.exportAllPackagesTo(getClass(), this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public class AArch64MacroAssembler extends AArch64Assembler {
// preferred byte alignment for a branch target
public static final int PREFERRED_BRANCH_TARGET_ALIGNMENT = 16;

@SuppressWarnings("this-escape")
public AArch64MacroAssembler(TargetDescription target) {
super(target);
this.neon = new AArch64ASIMDMacroAssembler(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class AArch64MembarOpTest extends BackendTest {
private final JVMCIBackend providers;
private final CompilationResultBuilder crb;

@SuppressWarnings("this-escape")
public AArch64MembarOpTest() {
this.providers = JVMCI.getRuntime().getHostJVMCIBackend();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,11 @@ protected boolean isPrimitiveBoxingCacheField(ResolvedJavaField field) {
if (isArray(field) && field.isFinal() && field.getName().equals("cache")) {
ResolvedJavaType type = field.getDeclaringClass();
String typeName = type.getName();
if (typeName.equals("Ljava/lang/Character$CharacterCache;") || typeName.equals("Ljava/lang/Byte$ByteCache;") || typeName.equals("Ljava/lang/Short$ShortCache;") ||
typeName.equals("Ljava/lang/Integer$IntegerCache;") || typeName.equals("Ljava/lang/Long$LongCache;")) {
if (typeName.equals("Ljava/lang/Character$CharacterCache;") ||
typeName.equals("Ljava/lang/Byte$ByteCache;") ||
typeName.equals("Ljava/lang/Short$ShortCache;") ||
typeName.equals("Ljava/lang/Integer$IntegerCache;") ||
typeName.equals("Ljava/lang/Long$LongCache;")) {
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class ConditionalEliminationRegressionTest extends GraalCompilerTest {

private final SpeculationLog speculationLog;

@SuppressWarnings("this-escape")
public ConditionalEliminationRegressionTest() {
speculationLog = getCodeCache().createSpeculationLog();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
public class CountedLoopOverflowTest extends GraalCompilerTest {
private final SpeculationLog speculationLog;

@SuppressWarnings("this-escape")
public CountedLoopOverflowTest() {
speculationLog = getCodeCache().createSpeculationLog();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ public static void resetCache() {
cache.get().clear();
}

@SuppressWarnings("this-escape")
public GraalCompilerTest() {
this.backend = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend();
this.providers = getBackend().getProviders();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public class InfopointReasonTest extends GraalCompilerTest {

public static final String[] STRINGS = new String[]{"world", "everyone", "you"};

@SuppressWarnings("this-escape")
public InfopointReasonTest() {
// Call testMethod to ensure all method references are resolved.
testMethod();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import static org.graalvm.compiler.core.GraalCompilerOptions.MaxCompilationProblemsPerAction;
import static org.graalvm.compiler.core.common.GraalOptions.TrackNodeSourcePosition;
import static org.graalvm.compiler.debug.DebugOptions.Dump;
import static org.graalvm.compiler.debug.DebugOptions.Time;
import static org.graalvm.compiler.debug.DebugOptions.Count;
import static org.graalvm.compiler.debug.DebugOptions.DumpPath;
import static org.graalvm.compiler.debug.DebugOptions.MethodFilter;
import static org.graalvm.compiler.debug.DebugOptions.PrintBackendCFG;
Expand Down Expand Up @@ -336,33 +338,47 @@ protected T handleFailure(DebugContext initialDebug, Throwable cause) {
OptionValues retryOptions = new OptionValues(initialOptions,
Dump, ":" + DebugOptions.DiagnoseDumpLevel.getValue(initialOptions),
MethodFilter, null,
Count, "",
Time, "",
DumpPath, dumpPath,
PrintBackendCFG, true,
TrackNodeSourcePosition, true);

ByteArrayOutputStream logBaos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(logBaos);
try (DebugContext retryDebug = createRetryDebugContext(initialDebug, retryOptions, ps)) {
T res = performCompilation(retryDebug);
T res;
try {
res = performCompilation(retryDebug);
} finally {
ps.println("<Metrics>");
retryDebug.printMetrics(initialDebug.getDescription(), ps, true);
ps.println("</Metrics>");
}
ps.println("There was no exception during retry.");
return postRetry(action, retryLogFile, logBaos, ps, res);
finalizeRetryLog(retryLogFile, logBaos, ps);
return postRetry(action, res);
} catch (Throwable e) {
ps.println("Exception during retry:");
e.printStackTrace(ps);
return postRetry(action, retryLogFile, logBaos, ps, handleException(cause));
finalizeRetryLog(retryLogFile, logBaos, ps);
return postRetry(action, handleException(cause));
}
}
}

private T postRetry(ExceptionAction action, String retryLogFile, ByteArrayOutputStream logBaos, PrintStream ps, T res) {
private T postRetry(ExceptionAction action, T res) {
maybeExitVM(action);
return res;
}

private static void finalizeRetryLog(String retryLogFile, ByteArrayOutputStream logBaos, PrintStream ps) {
ps.close();
try (OutputStream fos = PathUtilities.openOutputStream(retryLogFile, true)) {
fos.write(logBaos.toByteArray());
} catch (Throwable e) {
TTY.printf("Error writing to %s: %s%n", retryLogFile, e);
}
maybeExitVM(action);
return res;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
*/
public class CompilerThread extends Thread {

@SuppressWarnings("this-escape")
public CompilerThread(Runnable r, String namePrefix) {
super(r);
this.setName(namePrefix + "-" + GraalServices.getThreadId(this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ public abstract class NodeLIRBuilder implements NodeLIRBuilderTool, LIRGeneratio
private EconomicMap<Class<? extends Node>, List<MatchStatement>> matchRules;
private EconomicMap<Node, Integer> sharedMatchCounts;

@SuppressWarnings("this-escape")
public NodeLIRBuilder(StructuredGraph graph, LIRGeneratorTool gen, NodeMatchRules nodeMatchRules) {
this.gen = (LIRGenerator) gen;
this.nodeMatchRules = nodeMatchRules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

public class EconomyHighTier extends BaseTier<HighTierContext> {

@SuppressWarnings("this-escape")
public EconomyHighTier() {
CanonicalizerPhase canonicalizer = CanonicalizerPhase.create();
appendPhase(canonicalizer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

public class EconomyLowTier extends BaseTier<LowTierContext> {

@SuppressWarnings("this-escape")
public EconomyLowTier() {
CanonicalizerPhase canonicalizer = CanonicalizerPhase.create();
appendPhase(new LowTierLoweringPhase(canonicalizer));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

public class EconomyMidTier extends BaseTier<MidTierContext> {

@SuppressWarnings("this-escape")
public EconomyMidTier() {
CanonicalizerPhase canonicalizer = CanonicalizerPhase.create();
appendPhase(new RemoveValueProxyPhase(canonicalizer));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public static class Options {
// @formatter:on
}

@SuppressWarnings("this-escape")
public HighTier(OptionValues options) {
CanonicalizerPhase canonicalizer = CanonicalizerPhase.create();
appendPhase(canonicalizer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ static class Options {

}

@SuppressWarnings("this-escape")
public LowTier(OptionValues options) {
CanonicalizerPhase canonicalizer = CanonicalizerPhase.create();
CanonicalizerPhase canonicalizerWithoutGVN = canonicalizer.copyWithoutGVN();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@

public class MidTier extends BaseTier<MidTierContext> {

@SuppressWarnings("this-escape")
public MidTier(OptionValues options) {
CanonicalizerPhase canonicalizer = CanonicalizerPhase.create();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class MinimalFuzzedCompilationPlan extends AbstractCompilationPlan {
*/
private final long randomSeed;

@SuppressWarnings("this-escape")
protected MinimalFuzzedCompilationPlan(MinimalFuzzedTierPlan<HighTierContext> minimalHighTier,
MinimalFuzzedTierPlan<MidTierContext> minimalMidTier,
MinimalFuzzedTierPlan<LowTierContext> minimalLowTier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2301,7 +2301,22 @@ private void printMetricsCSV(PrintStream out, Object compilable, Integer identit
}

/**
* Appends metrics in a human readable format to {@code out} for a single method compilation.
* Prints the metrics in a human-readable format to {@code out} for a single method compilation.
*
* @param clear specifies if the metrics should be cleared after printing
*/
public void printMetrics(Description desc, PrintStream out, boolean clear) {
if (metricValues == null) {
return;
}
printMetrics(out, desc.compilable, 0, 0, desc.identifier);
if (clear) {
metricValues = null;
}
}

/**
* Appends metrics in a human-readable format to {@code out} for a single method compilation.
*
* @param identity the identity hash code of {@code compilable}
* @param compilationNr where this compilation lies in the ordered sequence of all compilations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public LogStream(OutputStream os) {
*
* @param sink the {@link Consumer} to which prints are sent
*/
@SuppressWarnings("this-escape")
public LogStream(Consumer<? super String> sink) {
this.consumer = new ForwardingConsumer(this, sink);
lineBuffer = new StringBuilder(100);
Expand Down Expand Up @@ -501,6 +502,7 @@ private static final class ForwardingConsumer implements Consumer<String> {
private final Consumer<? super String> delegate;
private final AtomicReference<PrintStream> printStreamRef;

@SuppressWarnings("this-escape")
ForwardingConsumer(LogStream owner, Consumer<? super String> delegate) {
this.owner = Objects.requireNonNull(owner, "Owner must be non null.");
this.delegate = Objects.requireNonNull(delegate, "Delegate must be non null.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ static class NodeCreationStackTrace extends NodeStackTrace {
public static class NodeInsertionStackTrace extends NodeStackTrace {
}

@SuppressWarnings("this-escape")
public Node(NodeClass<? extends Node> c) {
init(c);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
*/
public class AArch64HotSpotNodeLIRBuilder extends AArch64NodeLIRBuilder implements HotSpotNodeLIRBuilder {

@SuppressWarnings("this-escape")
public AArch64HotSpotNodeLIRBuilder(StructuredGraph graph, LIRGeneratorTool gen, AArch64NodeMatchRules nodeMatchRules) {
super(graph, gen, nodeMatchRules);
assert gen instanceof AArch64HotSpotLIRGenerator;
Expand Down
Loading

0 comments on commit de7a579

Please sign in to comment.