diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/methodhandles/Target_java_lang_invoke_MethodType.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/methodhandles/Target_java_lang_invoke_MethodType.java index 9b8cb547f194..70ca2a256850 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/methodhandles/Target_java_lang_invoke_MethodType.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/methodhandles/Target_java_lang_invoke_MethodType.java @@ -52,6 +52,18 @@ final class Target_java_lang_invoke_MethodType { @TargetClass(className = "java.lang.invoke.Invokers") final class Target_java_lang_invoke_Invokers { + + /** + * Substitute to remove the {@code @DontInline} from the original method. + */ + @Substitute + static void maybeCustomize(Target_java_lang_invoke_MethodHandle mh) { + /* + * MethodHandle.maybeCustomized() is _currently_ substituted by an empty method. We still + * call it here and represent the original behavior to make it future-proof. + */ + mh.maybeCustomize(); + } } @TargetClass(className = "java.lang.invoke.InvokerBytecodeGenerator") diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SVMHost.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SVMHost.java index b3ce043bd522..10980fce6cf2 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SVMHost.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SVMHost.java @@ -155,6 +155,7 @@ import jdk.graal.compiler.phases.common.CanonicalizerPhase; import jdk.graal.compiler.virtual.phases.ea.PartialEscapePhase; import jdk.internal.loader.NativeLibraries; +import jdk.internal.vm.annotation.DontInline; import jdk.vm.ci.meta.DeoptimizationReason; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.ResolvedJavaField; @@ -810,6 +811,10 @@ public boolean hasNeverInlineDirective(ResolvedJavaMethod method) { return true; } + if (AnnotationAccess.isAnnotationPresent(method, DontInline.class)) { + return true; + } + if (!SubstrateOptions.NeverInline.hasBeenSet()) { return false; }