Skip to content

Commit 1a746a5

Browse files
author
Maja Skoko
committed
trivial inlining temp
1 parent 44a3c92 commit 1a746a5

File tree

1 file changed

+10
-2
lines changed
  • substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code

1 file changed

+10
-2
lines changed

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/CompileQueue.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import java.util.Map.Entry;
3737
import java.util.TreeMap;
3838
import java.util.concurrent.ConcurrentHashMap;
39+
import java.util.concurrent.ConcurrentLinkedQueue;
3940
import java.util.concurrent.ConcurrentMap;
4041
import java.util.concurrent.ForkJoinPool;
4142

@@ -198,6 +199,7 @@ protected PhaseSuite<HighTierContext> getAfterParseSuite() {
198199
private final boolean optionAOTTrivialInline = SubstrateOptions.AOTTrivialInline.getValue();
199200

200201
private final ConcurrentMap<HostedMethod, CompilationGraph> unpublishedGraphs = new ConcurrentHashMap<>();
202+
private final ConcurrentLinkedQueue<HostedMethod> unpublishedTrivialMethods = new ConcurrentLinkedQueue<>();
201203

202204
public abstract static class CompileReason {
203205
/**
@@ -701,7 +703,6 @@ private void parseDeoptimizationTargetMethods() {
701703

702704
private static boolean checkTrivial(HostedMethod method, StructuredGraph graph) {
703705
if (!method.compilationInfo.isTrivialMethod() && method.canBeInlined() && InliningUtilities.isTrivialMethod(graph)) {
704-
method.compilationInfo.setTrivialMethod(true);
705706
return true;
706707
} else {
707708
return false;
@@ -731,7 +732,11 @@ protected void inlineTrivialMethods(DebugContext debug) throws InterruptedExcept
731732
for (Map.Entry<HostedMethod, CompilationGraph> entry : unpublishedGraphs.entrySet()) {
732733
entry.getKey().compilationInfo.setCompilationGraph(entry.getValue());
733734
}
735+
for (HostedMethod method : unpublishedTrivialMethods) {
736+
method.compilationInfo.setTrivialMethod(true);
737+
}
734738
unpublishedGraphs.clear();
739+
unpublishedTrivialMethods.clear();
735740
} while (inliningProgress);
736741
}
737742

@@ -838,6 +843,7 @@ private void doInlineTrivial(DebugContext debug, HostedMethod method) {
838843
*/
839844
unpublishedGraphs.put(method, CompilationGraph.encode(graph));
840845
if (checkTrivial(method, graph)) {
846+
unpublishedTrivialMethods.add(method);
841847
inliningProgress = true;
842848
}
843849
}
@@ -1065,7 +1071,9 @@ private void defaultParseFunction(DebugContext debug, HostedMethod method, Compi
10651071
assert GraphOrder.assertSchedulableGraph(graph);
10661072
method.compilationInfo.encodeGraph(graph);
10671073
method.compilationInfo.setCompileOptions(getCustomizedOptions(method, debug));
1068-
checkTrivial(method, graph);
1074+
if (checkTrivial(method, graph)) {
1075+
method.compilationInfo.setTrivialMethod(true);
1076+
}
10691077

10701078
} catch (Throwable ex) {
10711079
GraalError error = ex instanceof GraalError ? (GraalError) ex : new GraalError(ex);

0 commit comments

Comments
 (0)