Skip to content

Commit 0c778f9

Browse files
committed
[GR-61366] [GR-65064] Espresso: support for guest 25.
PullRequest: graal/20378
2 parents 24c965b + 2e4d323 commit 0c778f9

File tree

46 files changed

+1169
-327
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1169
-327
lines changed

espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ private ParserKlass parseClassImpl() throws ValidationException {
636636
// Ensure there are no trailing bytes
637637
stream.checkEndOfFile();
638638

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

642642
public static Symbol<Name> getClassName(ParsingContext parsingContext, byte[] bytes) throws ValidationException {

espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaVersion.java

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,15 @@ public static final class VersionRange {
3939
public static final VersionRange VERSION_19_OR_HIGHER = higher(19);
4040
public static final VersionRange VERSION_20_OR_LOWER = lower(20);
4141
public static final VersionRange VERSION_21_OR_HIGHER = higher(21);
42-
public static final VersionRange ALL = new VersionRange(0, LATEST_SUPPORTED);
42+
public static final VersionRange VERSION_21_OR_LOWER = lower(21);
43+
public static final VersionRange VERSION_22_OR_HIGHER = higher(22);
44+
public static final VersionRange VERSION_24_OR_LOWER = lower(24);
45+
public static final VersionRange VERSION_25_OR_HIGHER = higher(25);
46+
47+
public static final VersionRange ALL = between(0, LATEST_SUPPORTED);
48+
public static final VersionRange VERSION_9_TO_21 = between(9, 21);
49+
public static final VersionRange VERSION_9_TO_23 = between(9, 23);
50+
public static final VersionRange VERSION_22_TO_23 = between(22, 23);
4351

4452
private final int low;
4553
private final int high;
@@ -57,14 +65,19 @@ public static VersionRange higher(int version) {
5765
return new VersionRange(version, LATEST_SUPPORTED);
5866
}
5967

68+
public static VersionRange between(int low, int high) {
69+
return new VersionRange(low, high);
70+
}
71+
6072
public boolean contains(JavaVersion version) {
6173
return version.inRange(low, high);
6274
}
6375
}
6476

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

67-
public static final int LATEST_SUPPORTED = 21;
79+
public static final int LATEST_SUPPORTED = 25;
80+
public static final int LATEST_SUPPORTED_CLASSFILE = ClassfileParser.JAVA_25_VERSION;
6881

6982
private final int version;
7083

@@ -174,6 +187,26 @@ public boolean java21OrLater() {
174187
return version >= 21;
175188
}
176189

190+
public boolean java21OrEarlier() {
191+
return version <= 21;
192+
}
193+
194+
public boolean java22OrLater() {
195+
return version >= 22;
196+
}
197+
198+
public boolean java23OrEarlier() {
199+
return version <= 23;
200+
}
201+
202+
public boolean java24OrEarlier() {
203+
return version <= 24;
204+
}
205+
206+
public boolean java25OrLater() {
207+
return version >= 25;
208+
}
209+
177210
public boolean inRange(int low, int high) {
178211
return version >= low && version <= high;
179212
}

espresso-shared/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserKlass.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ public final class ParserKlass {
5959
*/
6060
private final ParserConstantPool pool;
6161

62+
private final char majorVersion;
63+
private final char minorVersion;
64+
6265
private final int thisKlassIndex;
6366
private final long hiddenKlassId;
6467

@@ -72,7 +75,11 @@ public ParserKlass(ParserConstantPool pool,
7275
ParserField[] fields,
7376
Attribute[] attributes,
7477
int thisKlassIndex,
78+
int majorVersion,
79+
int minorVersion,
7580
long hiddenKlassId) {
81+
assert majorVersion == (char) majorVersion;
82+
assert minorVersion == (char) minorVersion;
7683
this.pool = pool;
7784
this.flags = flags;
7885
this.name = name;
@@ -83,6 +90,8 @@ public ParserKlass(ParserConstantPool pool,
8390
this.fields = fields;
8491
this.attributes = attributes;
8592
this.thisKlassIndex = thisKlassIndex;
93+
this.majorVersion = (char) majorVersion;
94+
this.minorVersion = (char) minorVersion;
8695
this.hiddenKlassId = hiddenKlassId;
8796
}
8897

@@ -147,6 +156,14 @@ public long getHiddenKlassId() {
147156
return hiddenKlassId;
148157
}
149158

159+
public int getMajorVersion() {
160+
return majorVersion;
161+
}
162+
163+
public int getMinorVersion() {
164+
return minorVersion;
165+
}
166+
150167
@Override
151168
public String toString() {
152169
return "ParserKlass<" + getType() + ">";

espresso-shared/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/LinkResolver.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ private static <R extends RuntimeAccess<C, M, F>, C extends TypeAccess<C, M, F>,
547547
// version of the class file.
548548
if (!resolved.isConstructor()) {
549549
if (!symbolicHolder.isInterface() &&
550+
currentKlass != null &&
550551
symbolicHolder != currentKlass &&
551552
currentKlass.getSuperClass() != null &&
552553
symbolicHolder != currentKlass.getSuperClass() &&

espresso/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Added experimental support for JVMCI. It can be enabled with the `java.EnableJVMCI` option.
66
* 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.
77
* Added the `org.graalvm.continuations.IdentityHashCodes` class, providing utilities for restoring identity hashcodes. This may be used for more properly deserializing continuations.
8+
* Added support for guest Java version 25.
89

910
## Version 24.2.0
1011
### User-visible changes

espresso/ci/ci_common/common.jsonnet

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,12 @@ local benchmark_suites = ['dacapo', 'renaissance', 'scala-dacapo'];
117117
darwin_aarch64_21: self.espresso_jdk_21 + graal_common.labsjdkLatest + self.darwin_aarch64,
118118
windows_21: self.espresso_jdk_21 + graal_common.labsjdkLatest + self.windows + devkits["windows-jdk-latest"],
119119

120-
linux_amd64_latest: graal_common.labsjdkLatest + self.linux_amd64,
121-
120+
linux_amd64_latest: graal_common.labsjdkLatest + self.linux_amd64,
122121

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

124+
125+
125126
// precise targets and capabilities
126127
jdkLatest_gate_linux_amd64 : self.gate + self.linux_amd64_latest,
127128
jdk21_gate_linux_amd64 : self.gate + self.linux_amd64_21,
@@ -163,7 +164,8 @@ local benchmark_suites = ['dacapo', 'renaissance', 'scala-dacapo'];
163164
jdk21_on_demand_bench_linux : self.onDemandBench + self.linux_amd64_21 + self.x52,
164165
jdk21_on_demand_bench_darwin : self.onDemandBench + self.darwin_amd64_21,
165166
jdk21_on_demand_bench_windows : self.onDemandBench + self.windows_21,
166-
167+
jdkLatest_weekly_linux_amd64 : self.weekly + self.linux_amd64_latest,
168+
167169
// shared snippets
168170
eclipse: graal_common.deps.eclipse,
169171

espresso/src/com.oracle.truffle.espresso.launcher/src/com/oracle/truffle/espresso/launcher/EspressoLauncher.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ protected List<String> preprocessArguments(List<String> arguments, Map<String, S
212212
case "--enable-native-access":
213213
parseNumberedOption(args, "java.EnableNativeAccess", "module");
214214
break;
215+
case "--illegal-native-access":
216+
espressoOptions.put("java.IllegalNativeAccess", args.getValue(arg, "illegal native access"));
217+
break;
215218
case "-m":
216219
case "--module":
217220
/* This arguments specifies in which module we find the main class. */
@@ -273,10 +276,6 @@ protected List<String> preprocessArguments(List<String> arguments, Map<String, S
273276
case "-Xshare:off":
274277
// ignore
275278
break;
276-
case "-XX:+UseJVMCICompiler":
277-
case "-XX:-UseJVMCICompiler":
278-
getError().println("Ignoring " + arg);
279-
break;
280279

281280
case "-XX:+PauseOnExit":
282281
pauseOnExit = true;
@@ -432,6 +431,10 @@ private void parseArgFile(String pathArg, List<String> expanded) {
432431
"WhiteBoxAPI",
433432
"EnableJVMCI");
434433

434+
private static final Set<String> ignoredXXOptions = Set.of(
435+
"UseJVMCICompiler",
436+
"EnableDynamicAgentLoading");
437+
435438
private void handleXXArg(String fullArg, ArrayList<String> unrecognized) {
436439
String arg = fullArg.substring("-XX:".length());
437440
String name;
@@ -448,6 +451,10 @@ private void handleXXArg(String fullArg, ArrayList<String> unrecognized) {
448451
name = arg.substring(0, idx);
449452
value = arg.substring(idx + 1);
450453
}
454+
if (ignoredXXOptions.contains(name)) {
455+
getError().println("Ignoring " + arg);
456+
return;
457+
}
451458
if (knownPassThroughOptions.contains(name)) {
452459
espressoOptions.put("java." + name, value);
453460
return;

espresso/src/com.oracle.truffle.espresso.libjavavm/src/com/oracle/truffle/espresso/libjavavm/Arguments.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ private Arguments() {
7777
"TieredStopAtLevel",
7878
"MaxMetaspaceSize",
7979
"HeapDumpOnOutOfMemoryError",
80-
"UseJVMCICompiler");
80+
"UseJVMCICompiler",
81+
"EnableDynamicAgentLoading");
8182

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

0 commit comments

Comments
 (0)