summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Santiago Aboy Solanes <solanes@google.com> 2021-11-23 15:21:03 +0000
committer Treehugger Robot <treehugger-gerrit@google.com> 2021-11-23 17:40:31 +0000
commitf6bb80661e2a4f2940fc899dd1474aa457e1b45a (patch)
treeee0a04c67ab1ae0772d233ec990ccfd1950fa91a
parent06ed744ba590fc65921f79e849f55dc6d4b62593 (diff)
Turn off cross-dex inlining while we take a look at 207329152
Bug: 207329152 Test: ART tests Change-Id: I4d0b3c9a562f60c3dcdbfac4941cf20a1767232b
-rw-r--r--compiler/optimizing/inliner.cc7
-rw-r--r--test/2237-checker-inline-multidex/expected-stderr.txt0
-rw-r--r--test/2237-checker-inline-multidex/expected-stdout.txt4
-rw-r--r--test/2237-checker-inline-multidex/info.txt1
-rw-r--r--test/2237-checker-inline-multidex/src-multidex/Multi.java41
-rw-r--r--test/2237-checker-inline-multidex/src/Main.java72
-rw-r--r--test/462-checker-inlining-dex-files/src/Main.java53
-rw-r--r--test/580-checker-string-fact-intrinsics/src-art/Main.java8
8 files changed, 41 insertions, 145 deletions
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index a40218d7a0..f8bd436f62 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -67,6 +67,9 @@ static constexpr size_t kMaximumNumberOfRecursiveCalls = 4;
// Controls the use of inline caches in AOT mode.
static constexpr bool kUseAOTInlineCaches = true;
+// Enables the use of cross-dex inlining in AOT mode.
+static constexpr bool kEnableAotCrossDexInlining = false;
+
// We check for line numbers to make sure the DepthString implementation
// aligns the output nicely.
#define LOG_INTERNAL(msg) \
@@ -1716,6 +1719,10 @@ static bool CanEncodeInlinedMethodInStackMap(const DexFile& outer_dex_file,
return true;
}
+ if (!kEnableAotCrossDexInlining) {
+ return false;
+ }
+
// Inline across dexfiles if the callee's DexFile is:
// 1) in the bootclasspath, or
if (callee->GetDeclaringClass()->GetClassLoader() == nullptr) {
diff --git a/test/2237-checker-inline-multidex/expected-stderr.txt b/test/2237-checker-inline-multidex/expected-stderr.txt
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/2237-checker-inline-multidex/expected-stderr.txt
+++ /dev/null
diff --git a/test/2237-checker-inline-multidex/expected-stdout.txt b/test/2237-checker-inline-multidex/expected-stdout.txt
deleted file mode 100644
index 571349a527..0000000000
--- a/test/2237-checker-inline-multidex/expected-stdout.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-abc
-def
-ghi
-class Multi$Multi2
diff --git a/test/2237-checker-inline-multidex/info.txt b/test/2237-checker-inline-multidex/info.txt
deleted file mode 100644
index fc6dc60e66..0000000000
--- a/test/2237-checker-inline-multidex/info.txt
+++ /dev/null
@@ -1 +0,0 @@
-Checks that we inline across dex files, even when we need an environment.
diff --git a/test/2237-checker-inline-multidex/src-multidex/Multi.java b/test/2237-checker-inline-multidex/src-multidex/Multi.java
deleted file mode 100644
index cd234c3477..0000000000
--- a/test/2237-checker-inline-multidex/src-multidex/Multi.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public class Multi {
- public static String $inline$NeedsEnvironmentMultiDex(String str) {
- // StringBuilderAppend needs an environment but it doesn't need a .bss entry.
- StringBuilder sb = new StringBuilder();
- return sb.append(str).toString();
- }
-
- public static String $inline$NeedsBssEntryStringMultiDex() {
- return "def";
- }
-
- private static String $noinline$InnerInvokeMultiDex() {
- return "ghi";
- }
-
- public static String $inline$NeedsBssEntryInvokeMultiDex() {
- return $noinline$InnerInvokeMultiDex();
- }
-
- public static Class<?> NeedsBssEntryClassMultiDex() {
- return Multi2.class;
- }
-
- private class Multi2 {}
-}
diff --git a/test/2237-checker-inline-multidex/src/Main.java b/test/2237-checker-inline-multidex/src/Main.java
deleted file mode 100644
index 7ab2e7fa64..0000000000
--- a/test/2237-checker-inline-multidex/src/Main.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public class Main {
- public static void main(String[] args) {
- System.out.println(testNeedsEnvironment());
- System.out.println(testNeedsBssEntryString());
- System.out.println(testNeedsBssEntryInvoke());
- System.out.println(testClass());
- }
-
- /// CHECK-START: java.lang.String Main.testNeedsEnvironment() inliner (before)
- /// CHECK: InvokeStaticOrDirect method_name:Multi.$inline$NeedsEnvironmentMultiDex
-
- /// CHECK-START: java.lang.String Main.testNeedsEnvironment() inliner (after)
- /// CHECK-NOT: InvokeStaticOrDirect method_name:Multi.$inline$NeedsEnvironmentMultiDex
-
- /// CHECK-START: java.lang.String Main.testNeedsEnvironment() inliner (after)
- /// CHECK: StringBuilderAppend
- public static String testNeedsEnvironment() {
- return Multi.$inline$NeedsEnvironmentMultiDex("abc");
- }
-
- /// CHECK-START: java.lang.String Main.testNeedsBssEntryString() inliner (before)
- /// CHECK: InvokeStaticOrDirect method_name:Multi.$inline$NeedsBssEntryStringMultiDex
-
- /// CHECK-START: java.lang.String Main.testNeedsBssEntryString() inliner (after)
- /// CHECK-NOT: InvokeStaticOrDirect method_name:Multi.$inline$NeedsBssEntryStringMultiDex
-
- /// CHECK-START: java.lang.String Main.testNeedsBssEntryString() inliner (after)
- /// CHECK: LoadString load_kind:BssEntry
- public static String testNeedsBssEntryString() {
- return Multi.$inline$NeedsBssEntryStringMultiDex();
- }
-
- /// CHECK-START: java.lang.String Main.testNeedsBssEntryInvoke() inliner (before)
- /// CHECK: InvokeStaticOrDirect method_name:Multi.$inline$NeedsBssEntryInvokeMultiDex
-
- /// CHECK-START: java.lang.String Main.testNeedsBssEntryInvoke() inliner (after)
- /// CHECK-NOT: InvokeStaticOrDirect method_name:Multi.$inline$NeedsBssEntryInvokeMultiDex
-
- /// CHECK-START: java.lang.String Main.testNeedsBssEntryInvoke() inliner (after)
- /// CHECK: InvokeStaticOrDirect method_name:Multi.$noinline$InnerInvokeMultiDex method_load_kind:BssEntry
- public static String testNeedsBssEntryInvoke() {
- return Multi.$inline$NeedsBssEntryInvokeMultiDex();
- }
-
- /// CHECK-START: java.lang.Class Main.testClass() inliner (before)
- /// CHECK: InvokeStaticOrDirect method_name:Multi.NeedsBssEntryClassMultiDex
-
- /// CHECK-START: java.lang.Class Main.testClass() inliner (after)
- /// CHECK-NOT: InvokeStaticOrDirect method_name:Multi.NeedsBssEntryClassMultiDex
-
- /// CHECK-START: java.lang.Class Main.testClass() inliner (after)
- /// CHECK: LoadClass load_kind:BssEntry class_name:Multi$Multi2
- public static Class<?> testClass() {
- return Multi.NeedsBssEntryClassMultiDex();
- }
-}
diff --git a/test/462-checker-inlining-dex-files/src/Main.java b/test/462-checker-inlining-dex-files/src/Main.java
index f426b40d6e..c6fff4188f 100644
--- a/test/462-checker-inlining-dex-files/src/Main.java
+++ b/test/462-checker-inlining-dex-files/src/Main.java
@@ -47,14 +47,15 @@ public class Main {
return OtherDex.returnIntMethod();
}
- /// CHECK-START: int Main.inlineOtherDexStatic() inliner (before)
- /// CHECK-DAG: <<Invoke:i\d+>> InvokeStaticOrDirect method_name:OtherDex.returnOtherDexStatic
+ /// CHECK-START: int Main.dontInlineOtherDexStatic() inliner (before)
+ /// CHECK-DAG: <<Invoke:i\d+>> InvokeStaticOrDirect
/// CHECK-DAG: Return [<<Invoke>>]
- /// CHECK-START: int Main.inlineOtherDexStatic() inliner (after)
- /// CHECK-NOT: InvokeStaticOrDirect method_name:OtherDex.returnOtherDexStatic
+ /// CHECK-START: int Main.dontInlineOtherDexStatic() inliner (after)
+ /// CHECK-DAG: <<Invoke:i\d+>> InvokeStaticOrDirect
+ /// CHECK-DAG: Return [<<Invoke>>]
- public static int inlineOtherDexStatic() {
+ public static int dontInlineOtherDexStatic() {
return OtherDex.returnOtherDexStatic();
}
@@ -85,25 +86,28 @@ public class Main {
return OtherDex.recursiveCall();
}
- /// CHECK-START: java.lang.String Main.inlineReturnString() inliner (before)
- /// CHECK-DAG: <<Invoke:l\d+>> InvokeStaticOrDirect method_name:OtherDex.returnString
+ /// CHECK-START: java.lang.String Main.dontInlineReturnString() inliner (before)
+ /// CHECK-DAG: <<Invoke:l\d+>> InvokeStaticOrDirect
/// CHECK-DAG: Return [<<Invoke>>]
- /// CHECK-START: java.lang.String Main.inlineReturnString() inliner (after)
- /// CHECK-NOT: InvokeStaticOrDirect method_name:OtherDex.returnString
+ /// CHECK-START: java.lang.String Main.dontInlineReturnString() inliner (after)
+ /// CHECK-DAG: <<Invoke:l\d+>> InvokeStaticOrDirect
+ /// CHECK-DAG: Return [<<Invoke>>]
- public static String inlineReturnString() {
+ public static String dontInlineReturnString() {
return OtherDex.returnString();
}
- /// CHECK-START: java.lang.Class Main.inlineOtherDexClass() inliner (before)
- /// CHECK-DAG: <<Invoke:l\d+>> InvokeStaticOrDirect method_name:OtherDex.returnOtherDexClass
+
+ /// CHECK-START: java.lang.Class Main.dontInlineOtherDexClass() inliner (before)
+ /// CHECK-DAG: <<Invoke:l\d+>> InvokeStaticOrDirect
/// CHECK-DAG: Return [<<Invoke>>]
- /// CHECK-START: java.lang.Class Main.inlineOtherDexClass() inliner (after)
- /// CHECK-NOT: InvokeStaticOrDirect method_name:OtherDex.returnOtherDexClass
+ /// CHECK-START: java.lang.Class Main.dontInlineOtherDexClass() inliner (after)
+ /// CHECK-DAG: <<Invoke:l\d+>> InvokeStaticOrDirect
+ /// CHECK-DAG: Return [<<Invoke>>]
- public static Class<?> inlineOtherDexClass() {
+ public static Class<?> dontInlineOtherDexClass() {
return OtherDex.returnOtherDexClass();
}
@@ -124,14 +128,15 @@ public class Main {
return OtherDex.returnMainClass();
}
- /// CHECK-START: java.lang.Class Main.inlineOtherDexClassStaticCall() inliner (before)
- /// CHECK-DAG: <<Invoke:l\d+>> InvokeStaticOrDirect method_name:OtherDex.returnOtherDexClassStaticCall
+ /// CHECK-START: java.lang.Class Main.dontInlineOtherDexClassStaticCall() inliner (before)
+ /// CHECK-DAG: <<Invoke:l\d+>> InvokeStaticOrDirect
/// CHECK-DAG: Return [<<Invoke>>]
- /// CHECK-START: java.lang.Class Main.inlineOtherDexClassStaticCall() inliner (after)
- /// CHECK-NOT: InvokeStaticOrDirect method_name:OtherDex.returnOtherDexClassStaticCall
+ /// CHECK-START: java.lang.Class Main.dontInlineOtherDexClassStaticCall() inliner (after)
+ /// CHECK-DAG: <<Invoke:l\d+>> InvokeStaticOrDirect
+ /// CHECK-DAG: Return [<<Invoke>>]
- public static Class<?> inlineOtherDexClassStaticCall() {
+ public static Class<?> dontInlineOtherDexClassStaticCall() {
return OtherDex.returnOtherDexClassStaticCall();
}
@@ -162,7 +167,7 @@ public class Main {
throw new Error("Expected 38");
}
- if (inlineOtherDexStatic() != 1) {
+ if (dontInlineOtherDexStatic() != 1) {
throw new Error("Expected 1");
}
@@ -170,15 +175,15 @@ public class Main {
throw new Error("Expected 42");
}
- if (inlineReturnString() != "OtherDex") {
+ if (dontInlineReturnString() != "OtherDex") {
throw new Error("Expected OtherDex");
}
- if (inlineOtherDexClass() != OtherDex.class) {
+ if (dontInlineOtherDexClass() != OtherDex.class) {
throw new Error("Expected " + OtherDex.class);
}
- if (inlineOtherDexClassStaticCall() != OtherDex.class) {
+ if (dontInlineOtherDexClassStaticCall() != OtherDex.class) {
throw new Error("Expected " + OtherDex.class);
}
diff --git a/test/580-checker-string-fact-intrinsics/src-art/Main.java b/test/580-checker-string-fact-intrinsics/src-art/Main.java
index 34af579a4b..d0750f9ae8 100644
--- a/test/580-checker-string-fact-intrinsics/src-art/Main.java
+++ b/test/580-checker-string-fact-intrinsics/src-art/Main.java
@@ -40,14 +40,16 @@ public class Main {
// java.lang.StringFactory.newStringFromChars(char[] data)
//
// which contains a call to the former (non-public) native method.
- // After the inliner runs, we can see the inlined call and check
- // that the compiler intrinsifies it.
+ // However, this call will not be inlined (because it is a method in
+ // another Dex file and which contains a call, which needs an
+ // environment), so we cannot use Checker here to ensure the native
+ // call was intrinsified either.
/// CHECK-START: void Main.testNewStringFromChars() builder (after)
/// CHECK-DAG: InvokeStaticOrDirect method_name:java.lang.StringFactory.newStringFromChars intrinsic:None
/// CHECK-START: void Main.testNewStringFromChars() inliner (after)
- /// CHECK-DAG: InvokeStaticOrDirect method_name:java.lang.StringFactory.newStringFromChars intrinsic:StringNewStringFromChars
+ /// CHECK-DAG: InvokeStaticOrDirect method_name:java.lang.StringFactory.newStringFromChars intrinsic:None
public static void testNewStringFromChars() {
char[] chars = { 'b', 'a', 'r' };