@@ -184,7 +184,7 @@ protected PhaseSuite<HighTierContext> getAfterParseSuite() {
184
184
private final boolean printMethodHistogram = NativeImageOptions .PrintMethodHistogram .getValue ();
185
185
private final boolean optionAOTTrivialInline = SubstrateOptions .AOTTrivialInline .getValue ();
186
186
187
- public record UnpublishedTrivialMethods (CompilationGraph unpublishedGraph , boolean isTrivial ) {
187
+ public record UnpublishedTrivialMethods (CompilationGraph unpublishedGraph , boolean newlyTrivial ) {
188
188
}
189
189
190
190
private final ConcurrentMap <HostedMethod , UnpublishedTrivialMethods > unpublishedTrivialMethods = new ConcurrentHashMap <>();
@@ -701,12 +701,8 @@ private void parseDeoptimizationTargetMethods() {
701
701
});
702
702
}
703
703
704
- private static boolean checkTrivial (HostedMethod method , StructuredGraph graph ) {
705
- if (!method .compilationInfo .isTrivialMethod () && method .canBeInlined () && InliningUtilities .isTrivialMethod (graph )) {
706
- return true ;
707
- } else {
708
- return false ;
709
- }
704
+ private static boolean checkNewlyTrivial (HostedMethod method , StructuredGraph graph ) {
705
+ return !method .compilationInfo .isTrivialMethod () && method .canBeInlined () && InliningUtilities .isTrivialMethod (graph );
710
706
}
711
707
712
708
@ SuppressWarnings ("try" )
@@ -731,8 +727,9 @@ protected void inlineTrivialMethods(DebugContext debug) throws InterruptedExcept
731
727
}
732
728
for (Map .Entry <HostedMethod , UnpublishedTrivialMethods > entry : unpublishedTrivialMethods .entrySet ()) {
733
729
entry .getKey ().compilationInfo .setCompilationGraph (entry .getValue ().unpublishedGraph );
734
- if (entry .getValue ().isTrivial ) {
735
- entry .getKey ().compilationInfo .setTrivialMethod (true );
730
+ if (entry .getValue ().newlyTrivial ) {
731
+ inliningProgress = true ;
732
+ entry .getKey ().compilationInfo .setTrivialMethod ();
736
733
}
737
734
}
738
735
unpublishedTrivialMethods .clear ();
@@ -746,12 +743,16 @@ class TrivialInliningPlugin implements InlineInvokePlugin {
746
743
@ Override
747
744
public InlineInfo shouldInlineInvoke (GraphBuilderContext b , ResolvedJavaMethod method , ValueNode [] args ) {
748
745
if (makeInlineDecision ((HostedMethod ) b .getMethod (), (HostedMethod ) method ) && b .recursiveInliningDepth (method ) == 0 ) {
749
- inlinedDuringDecoding = true ;
750
746
return InlineInfo .createStandardInlineInfo (method );
751
747
} else {
752
748
return InlineInfo .DO_NOT_INLINE_WITH_EXCEPTION ;
753
749
}
754
750
}
751
+
752
+ @ Override
753
+ public void notifyAfterInline (ResolvedJavaMethod methodToInline ) {
754
+ inlinedDuringDecoding = true ;
755
+ }
755
756
}
756
757
757
758
class InliningGraphDecoder extends PEGraphDecoder {
@@ -839,7 +840,7 @@ private void doInlineTrivial(DebugContext debug, HostedMethod method) {
839
840
* that there was inlining progress, which triggers another round of inlining
840
841
* where only "always inline" methods are inlined.
841
842
*/
842
- method .compilationInfo .setTrivialInliningDisabled (true );
843
+ method .compilationInfo .setTrivialInliningDisabled ();
843
844
inliningProgress = true ;
844
845
845
846
} else {
@@ -849,12 +850,7 @@ private void doInlineTrivial(DebugContext debug, HostedMethod method) {
849
850
* non-deterministic. This is why we are saving graphs to be published at the
850
851
* end of each round.
851
852
*/
852
- if (checkTrivial (method , graph )) {
853
- unpublishedTrivialMethods .put (method , new UnpublishedTrivialMethods (CompilationGraph .encode (graph ), true ));
854
- inliningProgress = true ;
855
- } else {
856
- unpublishedTrivialMethods .put (method , new UnpublishedTrivialMethods (CompilationGraph .encode (graph ), false ));
857
- }
853
+ unpublishedTrivialMethods .put (method , new UnpublishedTrivialMethods (CompilationGraph .encode (graph ), checkNewlyTrivial (method , graph )));
858
854
}
859
855
}
860
856
} catch (Throwable ex ) {
@@ -1056,8 +1052,8 @@ private void defaultParseFunction(DebugContext debug, HostedMethod method, Compi
1056
1052
notifyBeforeEncode (method , graph );
1057
1053
assert GraphOrder .assertSchedulableGraph (graph );
1058
1054
method .compilationInfo .encodeGraph (graph );
1059
- if (checkTrivial (method , graph )) {
1060
- method .compilationInfo .setTrivialMethod (true );
1055
+ if (checkNewlyTrivial (method , graph )) {
1056
+ method .compilationInfo .setTrivialMethod ();
1061
1057
}
1062
1058
} catch (Throwable ex ) {
1063
1059
GraalError error = ex instanceof GraalError ? (GraalError ) ex : new GraalError (ex );
0 commit comments