Skip to content

Commit 2b59bc4

Browse files
committed
Add workaround host inlining bug (GR-69170).
1 parent cf9aece commit 2b59bc4

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

truffle/src/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/bytecode/generator/BytecodeRootNodeElement.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14211,6 +14211,8 @@ private List<CodeExecutableElement> createContinueAt() {
1421114211
b.declaration(arrayOf(type(byte.class)), "bc", uncheckedCast(type(byte[].class), "this.bytecodes"));
1421214212
if (tier.isCached()) {
1421314213
ex.addAnnotationMirror(createExplodeLoopAnnotation("MERGE_EXPLODE"));
14214+
b.declaration(type(int.class), "counter", "0");
14215+
b.declaration(loopCounter.asType(), "loopCounter", "null");
1421414216
}
1421514217

1421614218
b.startIf().startStaticCall(types.HostCompilerDirectives, "inInterpreterFastPath").end().end().startBlock();
@@ -14219,20 +14221,19 @@ private List<CodeExecutableElement> createContinueAt() {
1421914221
if (tier.isCached()) {
1422014222
b.startStatement().startStaticCall(type(Reference.class), "reachabilityFence").tree(uncheckedCast(arrayOf(types.Node), "this.cachedNodes_")).end().end();
1422114223
}
14222-
b.end();
14223-
14224-
b.statement("int bci = ", decodeBci("startState"));
14225-
b.statement("int sp = ", decodeSp("startState"));
14226-
1422714224
if (tier.isCached()) {
14228-
b.declaration(type(int.class), "counter", "0");
14229-
b.declaration(loopCounter.asType(), "loopCounter", "null");
14230-
b.startIf().startStaticCall(types.CompilerDirectives, "hasNextTier").end().string("&& !").startStaticCall(types.CompilerDirectives, "inInterpreter").end().end().startBlock();
14225+
b.end().startElseIf().startStaticCall(types.CompilerDirectives, "hasNextTier").end().end().startBlock();
1423114226
b.lineComment("Using a class for the loop counter is a workaround to prevent PE from merging it at the end of the loop.");
1423214227
b.lineComment("We need to use a class with PE, in the interpreter we can use a regular counter.");
1423314228
b.startAssign("loopCounter").startNew(loopCounter.asType()).end().end();
1423414229
b.end();
14230+
} else {
14231+
b.end();
1423514232
}
14233+
14234+
b.statement("int bci = ", decodeBci("startState"));
14235+
b.statement("int sp = ", decodeSp("startState"));
14236+
1423614237
if (model.needsBciSlot() && !model.storeBciInFrame && !tier.isUncached()) {
1423714238
// If a bci slot is allocated but not used for non-uncached interpreters, set it to
1423814239
// an invalid value just in case it gets read during a stack walk.

0 commit comments

Comments
 (0)