Skip to content

Commit 7dd4293

Browse files
committed
[GR-69170] Do not inline hasNextTier in parsing.
PullRequest: graal/22018
2 parents d72914f + 3a32305 commit 7dd4293

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,22 @@ public void test() {
149149
runTest("testRangeCheck");
150150
runTest("testImplicitCast");
151151
runTest("testNativeCall");
152+
runTest("testBCDSLPrologIfVersion");
153+
}
154+
155+
/*
156+
* Test for GR-69170
157+
*/
158+
@BytecodeInterpreterSwitch
159+
static Object testBCDSLPrologIfVersion(int value) {
160+
Object o = null;
161+
if (!CompilerDirectives.inInterpreter() && CompilerDirectives.hasNextTier()) {
162+
GraalDirectives.deoptimize();
163+
o = new Object();
164+
}
165+
// must be inlined
166+
trivialMethod();
167+
return o;
152168
}
153169

154170
void runTest(String methodName) {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/truffle/host/HostInliningPhase.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,6 +1351,7 @@ public static boolean shouldDenyTrivialInlining(TruffleHostEnvironment env, Reso
13511351
info.isTruffleBoundary() ||
13521352
types.isInInterpreter(callee) ||
13531353
types.isInInterpreterFastPath(callee) ||
1354+
types.isHasNextTier(callee) ||
13541355
types.isTransferToInterpreterMethod(callee));
13551356
}
13561357

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/truffle/host/TruffleKnownHostTypes.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public final class TruffleKnownHostTypes extends AbstractKnownTruffleTypes {
4949
public final ResolvedJavaMethod CompilerDirectives_transferToInterpreter = findMethod(CompilerDirectives, "transferToInterpreter");
5050
public final ResolvedJavaMethod CompilerDirectives_transferToInterpreterAndInvalidate = findMethod(CompilerDirectives, "transferToInterpreterAndInvalidate");
5151
public final ResolvedJavaMethod CompilerDirectives_inInterpreter = findMethod(CompilerDirectives, "inInterpreter");
52+
public final ResolvedJavaMethod CompilerDirectives_hasNextTier = findMethod(CompilerDirectives, "hasNextTier");
5253
public final ResolvedJavaType TruffleBoundary = lookupType("com.oracle.truffle.api.CompilerDirectives$TruffleBoundary");
5354
public final ResolvedJavaType BytecodeInterpreterSwitch = lookupType("com.oracle.truffle.api.HostCompilerDirectives$BytecodeInterpreterSwitch");
5455
public final ResolvedJavaType BytecodeInterpreterSwitchBoundary = lookupType("com.oracle.truffle.api.HostCompilerDirectives$BytecodeInterpreterSwitchBoundary");
@@ -77,6 +78,10 @@ public boolean isInInterpreterFastPath(ResolvedJavaMethod method) {
7778
return method.equals(HostCompilerDirectives_inInterpreterFastPath);
7879
}
7980

81+
public boolean isHasNextTier(ResolvedJavaMethod method) {
82+
return method.equals(CompilerDirectives_hasNextTier);
83+
}
84+
8085
/**
8186
* Determines if {@code method} is a method is a transferToInterpreter method from
8287
* CompilerDirectives.

0 commit comments

Comments
 (0)