Skip to content

[GR-61366] [GR-65064] Espresso: support for guest 25. #11216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ private ParserKlass parseClassImpl() throws ValidationException {
// Ensure there are no trailing bytes
stream.checkEndOfFile();

return new ParserKlass(pool, classFlags, thisKlassName, thisKlassType, superKlass, superInterfaces, methods, fields, attributes, thisKlassIndex, -1);
return new ParserKlass(pool, classFlags, thisKlassName, thisKlassType, superKlass, superInterfaces, methods, fields, attributes, thisKlassIndex, majorVersion, minorVersion, -1);
}

public static Symbol<Name> getClassName(ParsingContext parsingContext, byte[] bytes) throws ValidationException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ public static final class VersionRange {
public static final VersionRange VERSION_19_OR_HIGHER = higher(19);
public static final VersionRange VERSION_20_OR_LOWER = lower(20);
public static final VersionRange VERSION_21_OR_HIGHER = higher(21);
public static final VersionRange ALL = new VersionRange(0, LATEST_SUPPORTED);
public static final VersionRange VERSION_21_OR_LOWER = lower(21);
public static final VersionRange VERSION_22_OR_HIGHER = higher(22);
public static final VersionRange VERSION_24_OR_LOWER = lower(24);
public static final VersionRange VERSION_25_OR_HIGHER = higher(25);

public static final VersionRange ALL = between(0, LATEST_SUPPORTED);
public static final VersionRange VERSION_9_TO_21 = between(9, 21);
public static final VersionRange VERSION_9_TO_23 = between(9, 23);
public static final VersionRange VERSION_22_TO_23 = between(22, 23);

private final int low;
private final int high;
Expand All @@ -57,14 +65,19 @@ public static VersionRange higher(int version) {
return new VersionRange(version, LATEST_SUPPORTED);
}

public static VersionRange between(int low, int high) {
return new VersionRange(low, high);
}

public boolean contains(JavaVersion version) {
return version.inRange(low, high);
}
}

public static final JavaVersion HOST_VERSION = forVersion(Runtime.version());

public static final int LATEST_SUPPORTED = 21;
public static final int LATEST_SUPPORTED = 25;
public static final int LATEST_SUPPORTED_CLASSFILE = ClassfileParser.JAVA_25_VERSION;

private final int version;

Expand Down Expand Up @@ -174,6 +187,26 @@ public boolean java21OrLater() {
return version >= 21;
}

public boolean java21OrEarlier() {
return version <= 21;
}

public boolean java22OrLater() {
return version >= 22;
}

public boolean java23OrEarlier() {
return version <= 23;
}

public boolean java24OrEarlier() {
return version <= 24;
}

public boolean java25OrLater() {
return version >= 25;
}

public boolean inRange(int low, int high) {
return version >= low && version <= high;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ public final class ParserKlass {
*/
private final ParserConstantPool pool;

private final char majorVersion;
private final char minorVersion;

private final int thisKlassIndex;
private final long hiddenKlassId;

Expand All @@ -72,7 +75,11 @@ public ParserKlass(ParserConstantPool pool,
ParserField[] fields,
Attribute[] attributes,
int thisKlassIndex,
int majorVersion,
int minorVersion,
long hiddenKlassId) {
assert majorVersion == (char) majorVersion;
assert minorVersion == (char) minorVersion;
this.pool = pool;
this.flags = flags;
this.name = name;
Expand All @@ -83,6 +90,8 @@ public ParserKlass(ParserConstantPool pool,
this.fields = fields;
this.attributes = attributes;
this.thisKlassIndex = thisKlassIndex;
this.majorVersion = (char) majorVersion;
this.minorVersion = (char) minorVersion;
this.hiddenKlassId = hiddenKlassId;
}

Expand Down Expand Up @@ -147,6 +156,14 @@ public long getHiddenKlassId() {
return hiddenKlassId;
}

public int getMajorVersion() {
return majorVersion;
}

public int getMinorVersion() {
return minorVersion;
}

@Override
public String toString() {
return "ParserKlass<" + getType() + ">";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ private static <R extends RuntimeAccess<C, M, F>, C extends TypeAccess<C, M, F>,
// version of the class file.
if (!resolved.isConstructor()) {
if (!symbolicHolder.isInterface() &&
currentKlass != null &&
symbolicHolder != currentKlass &&
currentKlass.getSuperClass() != null &&
symbolicHolder != currentKlass.getSuperClass() &&
Expand Down
1 change: 1 addition & 0 deletions espresso/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Added experimental support for JVMCI. It can be enabled with the `java.EnableJVMCI` option.
* Added experimentation support for `-javaagent`. It can also be enabled from the polyglot API with `java.JavaAgent.$i` option set to `/path/to/jar=agent-options` where `$i` starts at 0 and increments by 1 for each extra java agent.
* Added the `org.graalvm.continuations.IdentityHashCodes` class, providing utilities for restoring identity hashcodes. This may be used for more properly deserializing continuations.
* Added support for guest Java version 25.

## Version 24.2.0
### User-visible changes
Expand Down
8 changes: 5 additions & 3 deletions espresso/ci/ci_common/common.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,12 @@ local benchmark_suites = ['dacapo', 'renaissance', 'scala-dacapo'];
darwin_aarch64_21: self.espresso_jdk_21 + graal_common.labsjdkLatest + self.darwin_aarch64,
windows_21: self.espresso_jdk_21 + graal_common.labsjdkLatest + self.windows + devkits["windows-jdk-latest"],

linux_amd64_latest: graal_common.labsjdkLatest + self.linux_amd64,

linux_amd64_latest: graal_common.labsjdkLatest + self.linux_amd64,

linux_amd64_graalvm21: self.espresso_jdk_21 + graal_common.graalvmee21 + self.espresso_jdk_21_llvm + self.linux_amd64,



// precise targets and capabilities
jdkLatest_gate_linux_amd64 : self.gate + self.linux_amd64_latest,
jdk21_gate_linux_amd64 : self.gate + self.linux_amd64_21,
Expand Down Expand Up @@ -163,7 +164,8 @@ local benchmark_suites = ['dacapo', 'renaissance', 'scala-dacapo'];
jdk21_on_demand_bench_linux : self.onDemandBench + self.linux_amd64_21 + self.x52,
jdk21_on_demand_bench_darwin : self.onDemandBench + self.darwin_amd64_21,
jdk21_on_demand_bench_windows : self.onDemandBench + self.windows_21,

jdkLatest_weekly_linux_amd64 : self.weekly + self.linux_amd64_latest,

// shared snippets
eclipse: graal_common.deps.eclipse,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ protected List<String> preprocessArguments(List<String> arguments, Map<String, S
case "--enable-native-access":
parseNumberedOption(args, "java.EnableNativeAccess", "module");
break;
case "--illegal-native-access":
espressoOptions.put("java.IllegalNativeAccess", args.getValue(arg, "illegal native access"));
break;
case "-m":
case "--module":
/* This arguments specifies in which module we find the main class. */
Expand Down Expand Up @@ -273,10 +276,6 @@ protected List<String> preprocessArguments(List<String> arguments, Map<String, S
case "-Xshare:off":
// ignore
break;
case "-XX:+UseJVMCICompiler":
case "-XX:-UseJVMCICompiler":
getError().println("Ignoring " + arg);
break;

case "-XX:+PauseOnExit":
pauseOnExit = true;
Expand Down Expand Up @@ -432,6 +431,10 @@ private void parseArgFile(String pathArg, List<String> expanded) {
"WhiteBoxAPI",
"EnableJVMCI");

private static final Set<String> ignoredXXOptions = Set.of(
"UseJVMCICompiler",
"EnableDynamicAgentLoading");

private void handleXXArg(String fullArg, ArrayList<String> unrecognized) {
String arg = fullArg.substring("-XX:".length());
String name;
Expand All @@ -448,6 +451,10 @@ private void handleXXArg(String fullArg, ArrayList<String> unrecognized) {
name = arg.substring(0, idx);
value = arg.substring(idx + 1);
}
if (ignoredXXOptions.contains(name)) {
getError().println("Ignoring " + arg);
return;
}
if (knownPassThroughOptions.contains(name)) {
espressoOptions.put("java." + name, value);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ private Arguments() {
"TieredStopAtLevel",
"MaxMetaspaceSize",
"HeapDumpOnOutOfMemoryError",
"UseJVMCICompiler");
"UseJVMCICompiler",
"EnableDynamicAgentLoading");

private static final Map<String, String> MAPPED_XX_OPTIONS = Map.of(
"TieredCompilation", "engine.MultiTier");
Expand Down Expand Up @@ -181,6 +182,8 @@ public static int setupContext(Context.Builder builder, JNIJavaVMInitArgs args,
handler.addModules(optionString.substring("--add-modules=".length()));
} else if (optionString.startsWith("--enable-native-access=")) {
handler.enableNativeAccess(optionString.substring("--enable-native-access=".length()));
} else if (optionString.startsWith("--illegal-native-access=")) {
builder.option("java.IllegalNativeAccess", optionString.substring("--illegal-native-access=".length()));
} else if (optionString.startsWith("--module-path=")) {
builder.option("java.ModulePath", optionString.substring("--module-path=".length()));
} else if (optionString.startsWith("--upgrade-module-path=")) {
Expand Down
Loading
Loading