Skip to content

Commit b68de12

Browse files
committed
truffle: make OptimizedTruffleRuntime work with master labsjdk25 [GR-69866]
1 parent 3b848e1 commit b68de12

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/truffle/test/HostInliningTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ public void test() {
151151
runTest("testImplicitCast");
152152
runTest("testNativeCall");
153153
runTest("testBCDSLPrologIfVersion");
154-
// temporarily disabled because it fails with JDK 25 (GR-69866)
155-
// runTest("testInliningRoot");
154+
runTest("testInliningRoot");
156155
}
157156

158157
/*

truffle/src/com.oracle.truffle.runtime/src/com/oracle/truffle/runtime/OptimizedTruffleRuntime.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,24 @@ public abstract class OptimizedTruffleRuntime implements TruffleRuntime, Truffle
170170

171171
private static final int JAVA_SPECIFICATION_VERSION = Runtime.version().feature();
172172

173+
private static final class Lazy {
174+
/**
175+
* True if the {@link InliningRoot} annotation is supported by the compiler.
176+
*/
177+
private static final boolean INLINING_ROOT_SUPPORTED;
178+
179+
static {
180+
boolean supported;
181+
try {
182+
HostMethodInfo.class.getDeclaredConstructor(boolean.class, boolean.class, boolean.class, boolean.class, boolean.class);
183+
supported = true;
184+
} catch (NoSuchMethodException e) {
185+
supported = false;
186+
}
187+
INLINING_ROOT_SUPPORTED = supported;
188+
}
189+
}
190+
173191
/**
174192
* Used only to reset state for native image compilation.
175193
*/
@@ -540,7 +558,7 @@ protected void installDefaultListeners() {
540558

541559
@Override
542560
public HostMethodInfo getHostMethodInfo(ResolvedJavaMethod method) {
543-
if (JAVA_SPECIFICATION_VERSION >= 26) {
561+
if (Lazy.INLINING_ROOT_SUPPORTED) {
544562
return new HostMethodInfo(isTruffleBoundary(method),
545563
isBytecodeInterpreterSwitch(method),
546564
isBytecodeInterpreterSwitchBoundary(method),

0 commit comments

Comments
 (0)