|
36 | 36 | import java.util.Map.Entry; |
37 | 37 | import java.util.TreeMap; |
38 | 38 | import java.util.concurrent.ConcurrentHashMap; |
| 39 | +import java.util.concurrent.ConcurrentLinkedQueue; |
39 | 40 | import java.util.concurrent.ConcurrentMap; |
40 | 41 | import java.util.concurrent.ForkJoinPool; |
41 | 42 |
|
@@ -198,6 +199,7 @@ protected PhaseSuite<HighTierContext> getAfterParseSuite() { |
198 | 199 | private final boolean optionAOTTrivialInline = SubstrateOptions.AOTTrivialInline.getValue(); |
199 | 200 |
|
200 | 201 | private final ConcurrentMap<HostedMethod, CompilationGraph> unpublishedGraphs = new ConcurrentHashMap<>(); |
| 202 | + private final ConcurrentLinkedQueue<HostedMethod> unpublishedTrivialMethods = new ConcurrentLinkedQueue<>(); |
201 | 203 |
|
202 | 204 | public abstract static class CompileReason { |
203 | 205 | /** |
@@ -701,7 +703,6 @@ private void parseDeoptimizationTargetMethods() { |
701 | 703 |
|
702 | 704 | private static boolean checkTrivial(HostedMethod method, StructuredGraph graph) { |
703 | 705 | if (!method.compilationInfo.isTrivialMethod() && method.canBeInlined() && InliningUtilities.isTrivialMethod(graph)) { |
704 | | - method.compilationInfo.setTrivialMethod(true); |
705 | 706 | return true; |
706 | 707 | } else { |
707 | 708 | return false; |
@@ -731,7 +732,11 @@ protected void inlineTrivialMethods(DebugContext debug) throws InterruptedExcept |
731 | 732 | for (Map.Entry<HostedMethod, CompilationGraph> entry : unpublishedGraphs.entrySet()) { |
732 | 733 | entry.getKey().compilationInfo.setCompilationGraph(entry.getValue()); |
733 | 734 | } |
| 735 | + for (HostedMethod method : unpublishedTrivialMethods) { |
| 736 | + method.compilationInfo.setTrivialMethod(true); |
| 737 | + } |
734 | 738 | unpublishedGraphs.clear(); |
| 739 | + unpublishedTrivialMethods.clear(); |
735 | 740 | } while (inliningProgress); |
736 | 741 | } |
737 | 742 |
|
@@ -838,6 +843,7 @@ private void doInlineTrivial(DebugContext debug, HostedMethod method) { |
838 | 843 | */ |
839 | 844 | unpublishedGraphs.put(method, CompilationGraph.encode(graph)); |
840 | 845 | if (checkTrivial(method, graph)) { |
| 846 | + unpublishedTrivialMethods.add(method); |
841 | 847 | inliningProgress = true; |
842 | 848 | } |
843 | 849 | } |
@@ -1065,7 +1071,9 @@ private void defaultParseFunction(DebugContext debug, HostedMethod method, Compi |
1065 | 1071 | assert GraphOrder.assertSchedulableGraph(graph); |
1066 | 1072 | method.compilationInfo.encodeGraph(graph); |
1067 | 1073 | method.compilationInfo.setCompileOptions(getCustomizedOptions(method, debug)); |
1068 | | - checkTrivial(method, graph); |
| 1074 | + if (checkTrivial(method, graph)) { |
| 1075 | + method.compilationInfo.setTrivialMethod(true); |
| 1076 | + } |
1069 | 1077 |
|
1070 | 1078 | } catch (Throwable ex) { |
1071 | 1079 | GraalError error = ex instanceof GraalError ? (GraalError) ex : new GraalError(ex); |
|
0 commit comments