Skip to content

Commit e0d746e

Browse files
committed
Remove deopt/boundary from executeUncached methods in Bytecode DSL
1 parent f3b06c0 commit e0d746e

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

truffle/src/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/generator/FlatNodeGenFactory.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2735,7 +2735,7 @@ public CodeExecutableElement createExecuteMethod(CodeTypeElement clazz, CodeExec
27352735
List<SpecializationData> specializations, boolean skipStateChecks) {
27362736
final List<SpecializationData> allSpecializations = specializations;
27372737
int signatureSize = node.getPolymorphicExecutable().getSignatureParameters().size();
2738-
ExecutableTypeData type = new ExecutableTypeData(node, baseMethod, signatureSize, List.of(node.getFrameType()), false);
2738+
ExecutableTypeData type = new ExecutableTypeData(node, baseMethod, signatureSize, List.of(node.getFrameType()), false, true);
27392739

27402740
List<SpecializationData> implementedSpecializations = allSpecializations;
27412741
CodeExecutableElement method = createExecuteMethod(type);
@@ -2838,20 +2838,19 @@ private CodeExecutableElement createUncachedExecute(ExecutableTypeData forType)
28382838
effectiveEvaluatedCount++;
28392839
}
28402840

2841-
boolean isExecutableInUncached = effectiveEvaluatedCount != node.getExecutionCount() && !node.getChildren().isEmpty();
2842-
if (!isExecutableInUncached) {
2843-
GeneratorUtils.addBoundaryOrTransferToInterpreter(method, builder);
2844-
}
2845-
28462841
if (forType.getMethod() != null) {
28472842
method.getModifiers().addAll(forType.getMethod().getModifiers());
28482843
method.getModifiers().remove(Modifier.ABSTRACT);
28492844
}
28502845

2846+
boolean isExecutableInUncached = effectiveEvaluatedCount != node.getExecutionCount() && !node.getChildren().isEmpty();
28512847
if (isExecutableInUncached) {
28522848
builder.tree(GeneratorUtils.createShouldNotReachHere("This execute method cannot be used for uncached node versions as it requires child nodes to be present. " +
28532849
"Use an execute method that takes all arguments as parameters."));
28542850
} else {
2851+
if (forType.isReachableForRuntimeCompilation()) {
2852+
GeneratorUtils.addBoundaryOrTransferToInterpreter(method, builder);
2853+
}
28552854
generateTraceOnEnterCall(builder, frameState);
28562855
generateTraceOnExceptionStart(builder);
28572856
SpecializationGroup group = SpecializationGroup.create(compatibleSpecializations);

truffle/src/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/ExecutableTypeData.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public class ExecutableTypeData extends MessageContainer implements Comparable<E
7070
private String uniqueName;
7171

7272
private final boolean ignoreUnexpected;
73+
private final boolean reachableForRuntimeCompilation;
7374

7475
public ExecutableTypeData(NodeData node, TypeMirror returnType, String uniqueName, TypeMirror frameParameter, List<TypeMirror> evaluatedParameters) {
7576
this.node = node;
@@ -79,14 +80,16 @@ public ExecutableTypeData(NodeData node, TypeMirror returnType, String uniqueNam
7980
this.uniqueName = uniqueName;
8081
this.method = null;
8182
this.ignoreUnexpected = false;
83+
this.reachableForRuntimeCompilation = true;
8284
}
8385

8486
@SuppressWarnings("this-escape")
85-
public ExecutableTypeData(NodeData node, ExecutableElement method, int signatureSize, List<TypeMirror> frameTypes, boolean ignoreUnexpected) {
87+
public ExecutableTypeData(NodeData node, ExecutableElement method, int signatureSize, List<TypeMirror> frameTypes, boolean ignoreUnexpected, boolean reachableForRuntimeCompilation) {
8688
this.node = node;
8789
this.method = method;
8890
this.returnType = method.getReturnType();
8991
this.ignoreUnexpected = ignoreUnexpected;
92+
this.reachableForRuntimeCompilation = reachableForRuntimeCompilation;
9093
TypeMirror foundFrameParameter = null;
9194
List<? extends VariableElement> parameters = method.getParameters();
9295

@@ -218,6 +221,10 @@ public int getEvaluatedCount() {
218221
return evaluatedParameters.size();
219222
}
220223

224+
public boolean isReachableForRuntimeCompilation() {
225+
return reachableForRuntimeCompilation;
226+
}
227+
221228
public boolean canDelegateTo(ExecutableTypeData to) {
222229
ExecutableTypeData from = this;
223230
if (to.getEvaluatedCount() < from.getEvaluatedCount()) {

truffle/src/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/NodeParser.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2277,7 +2277,8 @@ private List<ExecutableTypeData> parseExecutableTypeData(NodeData node, List<? e
22772277
continue;
22782278
}
22792279
boolean ignoreUnexpected = mode == ParseMode.EXPORTED_MESSAGE;
2280-
ExecutableTypeData executableType = new ExecutableTypeData(node, method, signatureSize, context.getFrameTypes(), ignoreUnexpected);
2280+
boolean reachableForRuntimeCompilation = !(mode == ParseMode.OPERATION && node.isGenerateUncached());
2281+
ExecutableTypeData executableType = new ExecutableTypeData(node, method, signatureSize, context.getFrameTypes(), ignoreUnexpected, reachableForRuntimeCompilation);
22812282

22822283
if (executableType.getFrameParameter() != null) {
22832284
boolean supportedType = false;

0 commit comments

Comments
 (0)