From 02711f8d0132188dd2c7630cbb88f4faeef686bd Mon Sep 17 00:00:00 2001 From: Christian Haeubl Date: Fri, 22 Apr 2022 10:25:49 +0200 Subject: [PATCH] Remove AlwaysInlineAllCallees and AlwaysInlineSelectCallees. --- .../core/annotate/AlwaysInlineAllCallees.java | 48 ----------------- .../annotate/AlwaysInlineSelectCallees.java | 54 ------------------- .../oracle/svm/hosted/code/CompileQueue.java | 12 ++--- 3 files changed, 3 insertions(+), 111 deletions(-) delete mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/annotate/AlwaysInlineAllCallees.java delete mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/annotate/AlwaysInlineSelectCallees.java diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/annotate/AlwaysInlineAllCallees.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/annotate/AlwaysInlineAllCallees.java deleted file mode 100644 index ecb870ad51ac..000000000000 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/annotate/AlwaysInlineAllCallees.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.svm.core.annotate; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * In an annotated method, all statically bindable callee methods are inlined (unless the callee is - * annotated with {@link NeverInline}). The inlining is performed recursively. Be careful, it can - * get out of control easily. If you need more fine-grained control over inlining, consider using - * {@link AlwaysInlineSelectCallees}. - * - * This annotation exists primarily for testing purposes. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.METHOD, ElementType.CONSTRUCTOR}) -public @interface AlwaysInlineAllCallees { - - /** - * Documents the reason why the annotated code must have all callees inlined. - */ - String value(); -} diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/annotate/AlwaysInlineSelectCallees.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/annotate/AlwaysInlineSelectCallees.java deleted file mode 100644 index 16fb0663b684..000000000000 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/annotate/AlwaysInlineSelectCallees.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2020, 2020, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.oracle.svm.core.annotate; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * In a method annotated with this, the methods specified in {@link #callees} are inlined, unless - * they are annotated with {@link NeverInline}. - * - * This annotation exists primarily for testing purposes. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.METHOD, ElementType.CONSTRUCTOR}) -public @interface AlwaysInlineSelectCallees { - - /** - * Documents the reason why the annotated code must have all callees inlined. - */ - String reason(); - - /** - * List of callee methods to always inline. These should be qualified names, e.g. - * {@code "java.lang.String.length()"} or - * {@code "java.lang.StringBuilder.append(java.lang.String)"} - */ - String[] callees(); -} diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/CompileQueue.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/CompileQueue.java index bdc17eac5d99..9a8a27dda4f1 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/CompileQueue.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/CompileQueue.java @@ -135,8 +135,6 @@ import com.oracle.graal.pointsto.util.CompletionExecutor.DebugContextRunnable; import com.oracle.svm.core.SubstrateOptions; import com.oracle.svm.core.SubstrateOptions.OptimizationLevel; -import com.oracle.svm.core.annotate.AlwaysInlineAllCallees; -import com.oracle.svm.core.annotate.AlwaysInlineSelectCallees; import com.oracle.svm.core.annotate.DeoptTest; import com.oracle.svm.core.annotate.NeverInlineTrivial; import com.oracle.svm.core.annotate.RestrictHeapAccess; @@ -711,7 +709,7 @@ private void doInlineTrivial(DebugContext debug, final HostedMethod method) { private boolean tryInlineTrivial(StructuredGraph graph, Invoke invoke, boolean firstInline) { if (invoke.getInvokeKind().isDirect()) { HostedMethod singleCallee = (HostedMethod) invoke.callTarget().targetMethod(); - if (makeInlineDecision(invoke, singleCallee) && InliningUtilities.recursionDepth(invoke, singleCallee) == 0) { + if (makeInlineDecision(singleCallee) && InliningUtilities.recursionDepth(invoke, singleCallee) == 0) { if (firstInline) { graph.getDebug().dump(DebugContext.DETAILED_LEVEL, graph, "Before inlining"); } @@ -724,20 +722,16 @@ private boolean tryInlineTrivial(StructuredGraph graph, Invoke invoke, boolean f return false; } - private boolean makeInlineDecision(Invoke invoke, HostedMethod callee) { + private boolean makeInlineDecision(HostedMethod callee) { if (!callee.canBeInlined() || callee.getAnnotation(NeverInlineTrivial.class) != null) { return false; } - if (callee.shouldBeInlined() || callerAnnotatedWith(invoke, AlwaysInlineAllCallees.class)) { + if (callee.shouldBeInlined()) { return true; } if (optionAOTTrivialInline && callee.compilationInfo.isTrivialMethod()) { return true; } - AlwaysInlineSelectCallees selectCallees = getCallerAnnotation(invoke, AlwaysInlineSelectCallees.class); - if (selectCallees != null && Arrays.stream(selectCallees.callees()).anyMatch(c -> c.equals(callee.getQualifiedName()))) { - return true; - } return false; }