Skip to content

Commit 5f24943

Browse files
committed
Introduce NeverInlineTrivial option and fix -H:TrackDynamicAccess=all gathering entries from non-application class and module paths
1 parent 35b4518 commit 5f24943

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,9 @@ public static long getTearDownFailureNanos() {
913913
@Option(help = "file:doc-files/NeverInlineHelp.txt", type = OptionType.Debug)//
914914
public static final HostedOptionKey<AccumulatingLocatableMultiOptionValue.Strings> NeverInline = new HostedOptionKey<>(AccumulatingLocatableMultiOptionValue.Strings.build());
915915

916+
@Option(help = "Never trivially inline provided methods. Uses the same method pattern syntax as the 'NeverInline' option.")//
917+
public static final HostedOptionKey<AccumulatingLocatableMultiOptionValue.Strings> NeverInlineTrivial = new HostedOptionKey<>(AccumulatingLocatableMultiOptionValue.Strings.build());
918+
916919
@Option(help = "Maximum number of nodes in a method so that it is considered trivial.")//
917920
public static final HostedOptionKey<Integer> MaxNodesInTrivialMethod = new HostedOptionKey<>(20);
918921

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/DynamicAccessDetectionFeature.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public ConcurrentLinkedQueue<String> getMethodCallLocations(String methodName) {
9999
}
100100
}
101101

102-
private static final Set<String> neverInlineMethods = Set.of(
102+
private static final Set<String> neverInlineTrivialMethods = Set.of(
103103
"java.lang.invoke.MethodHandles$Lookup.unreflectGetter",
104104
"java.lang.invoke.MethodHandles$Lookup.unreflectSetter",
105105
"java.io.ObjectInputStream.readObject",
@@ -363,8 +363,8 @@ public static void parseDynamicAccessOptions(EconomicMap<OptionKey<?>, Object> h
363363
}
364364
});
365365
if (!classLoaderSupport.dynamicAccessSelectorsEmpty()) {
366-
for (String method : neverInlineMethods) {
367-
SubstrateOptions.NeverInline.update(hostedValues, method);
366+
for (String method : neverInlineTrivialMethods) {
367+
SubstrateOptions.NeverInlineTrivial.update(hostedValues, method);
368368
}
369369
}
370370
}

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SVMHost.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,9 @@ public boolean hasNeverInlineDirective(ResolvedJavaMethod method) {
829829
return false;
830830
}
831831

832-
return SubstrateOptions.NeverInline.getValue().values().stream().anyMatch(re -> MethodFilter.parse(re).matches(method));
832+
return SubstrateOptions.NeverInline.getValue().values().stream()
833+
.map(MethodFilter::parse)
834+
.anyMatch(filter -> filter.matches(method));
833835
}
834836

835837
private InlineBeforeAnalysisPolicy inlineBeforeAnalysisPolicy(MultiMethod.MultiMethodKey multiMethodKey) {
@@ -1108,7 +1110,10 @@ public boolean neverInlineTrivial(AnalysisMethod caller, AnalysisMethod callee)
11081110
return true;
11091111
}
11101112
}
1111-
return false;
1113+
if (!SubstrateOptions.NeverInlineTrivial.hasBeenSet()) {
1114+
return false;
1115+
}
1116+
return SubstrateOptions.NeverInlineTrivial.getValue().values().stream().anyMatch(re -> MethodFilter.parse(re).matches(callee));
11121117
}
11131118

11141119
private static boolean shouldEvaluateNeverInlineTrivialOnlyWith(Class<?>[] onlyWith) {

0 commit comments

Comments
 (0)