summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
author The Android Open Source Project <initial-contribution@android.com> 2021-08-12 12:03:24 -0700
committer Xin Li <delphij@google.com> 2021-08-12 22:47:56 +0000
commit54fd5f77b87649f8ab9b6699e064386fdceaecec (patch)
treeb27b01463388755905959e32acc9072ac333e7c0 /compiler
parent029a811dcb18e54d54aca805db7f8af452798a0a (diff)
parent7b4fead5e9441eeb9ff5a9336d500b49ffae8d97 (diff)
Merge ab/7633965
Bug: 169893837 Merged-In: Icb57ed5eb6b8976ecf6ac88bf8c278bbe144b450 Change-Id: I42ed1234422b6af296254d93055f9e3a69441c6c
Diffstat (limited to 'compiler')
-rw-r--r--compiler/Android.bp87
-rw-r--r--compiler/art_standalone_compiler_tests.xml45
-rw-r--r--compiler/jit/jit_compiler.cc2
-rw-r--r--compiler/optimizing/ssa_liveness_analysis.h8
4 files changed, 121 insertions, 21 deletions
diff --git a/compiler/Android.bp b/compiler/Android.bp
index cb47d7753e..6b74f77b73 100644
--- a/compiler/Android.bp
+++ b/compiler/Android.bp
@@ -326,26 +326,47 @@ cc_defaults {
whole_static_libs: ["libartd-compiler"],
}
-art_cc_library {
- name: "libart-compiler-gtest",
- defaults: ["libart-gtest-defaults"],
+// Properties common to `libart-compiler-gtest` and `libartd-compiler-gtest`.
+art_cc_defaults {
+ name: "libart-compiler-gtest-common",
srcs: [
"common_compiler_test.cc",
],
shared_libs: [
- "libartd-compiler",
- "libartd-disassembler",
+ "libbase",
+ ],
+}
+
+art_cc_library {
+ name: "libart-compiler-gtest",
+ defaults: [
+ "libart-gtest-defaults",
+ "libart-compiler-gtest-common",
+ ],
+ shared_libs: [
+ "libart-compiler",
+ "libart-disassembler",
"libartbase-art-gtest",
"libart-runtime-gtest",
- "libbase",
],
}
-art_cc_test {
- name: "art_compiler_tests",
+art_cc_library {
+ name: "libartd-compiler-gtest",
defaults: [
- "art_gtest_defaults",
+ "libartd-gtest-defaults",
+ "libart-compiler-gtest-common",
],
+ shared_libs: [
+ "libartd-compiler",
+ "libartd-disassembler",
+ "libartbased-art-gtest",
+ "libartd-runtime-gtest",
+ ],
+}
+
+art_cc_defaults {
+ name: "art_compiler_tests_defaults",
data: [
":art-gtest-jars-ExceptionHandle",
":art-gtest-jars-Interfaces",
@@ -436,16 +457,9 @@ art_cc_test {
],
shared_libs: [
- "libprofiled",
- "libartd-compiler",
- "libartd-simulator-container",
-
"libbacktrace",
"libnativeloader",
],
- static_libs: [
- "libvixld",
- ],
target: {
host: {
@@ -456,6 +470,47 @@ art_cc_test {
},
}
+// Version of ART gtest `art_compiler_tests` bundled with the ART APEX on target.
+// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete.
+art_cc_test {
+ name: "art_compiler_tests",
+ defaults: [
+ "art_gtest_defaults",
+ "art_compiler_tests_defaults",
+ ],
+ shared_libs: [
+ "libprofiled",
+ "libartd-compiler",
+ "libartd-simulator-container",
+ ],
+ static_libs: [
+ "libvixld",
+ ],
+}
+
+// Standalone version of ART gtest `art_compiler_tests`, not bundled with the ART APEX on target.
+art_cc_test {
+ name: "art_standalone_compiler_tests",
+ defaults: [
+ "art_standalone_gtest_defaults",
+ "art_compiler_tests_defaults",
+ ],
+ shared_libs: [
+ "libprofile",
+ "libart-compiler",
+ ],
+ static_libs: [
+ // For now, link `libart-simulator-container` statically for simplicity,
+ // to save the added complexity to package it in test suites (along with
+ // other test artifacts) and install it on device during tests.
+ // TODO(b/192070541): Consider linking `libart-simulator-container`
+ // dynamically.
+ "libart-simulator-container",
+ "libvixl",
+ ],
+ test_config: "art_standalone_compiler_tests.xml",
+}
+
art_cc_test {
name: "art_compiler_host_tests",
device_supported: false,
diff --git a/compiler/art_standalone_compiler_tests.xml b/compiler/art_standalone_compiler_tests.xml
new file mode 100644
index 0000000000..bf450a52d1
--- /dev/null
+++ b/compiler/art_standalone_compiler_tests.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<configuration description="Runs art_standalone_compiler_tests.">
+ <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
+ <option name="cleanup" value="true" />
+ <option name="push" value="art_standalone_compiler_tests->/data/local/tmp/nativetest/art_standalone_compiler_tests" />
+ <option name="append-bitness" value="true" />
+ </target_preparer>
+
+ <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
+ <option name="cleanup" value="true" />
+ <option name="push" value="art-gtest-jars-ExceptionHandle.jar->/data/local/tmp/nativetest/art-gtest-jars-ExceptionHandle.jar" />
+ <option name="push" value="art-gtest-jars-Interfaces.jar->/data/local/tmp/nativetest/art-gtest-jars-Interfaces.jar" />
+ <option name="push" value="art-gtest-jars-MyClassNatives.jar->/data/local/tmp/nativetest/art-gtest-jars-MyClassNatives.jar" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp/nativetest" />
+ <option name="module-name" value="art_standalone_compiler_tests" />
+ <option name="ld-library-path-32" value="/apex/com.android.art/lib" />
+ <option name="ld-library-path-64" value="/apex/com.android.art/lib64" />
+ </test>
+
+ <!-- When this test is run in a Mainline context (e.g. with `mts-tradefed`), only enable it if
+ one of the Mainline modules below is present on the device used for testing. -->
+ <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
+ <!-- ART Mainline Module (internal version). -->
+ <option name="mainline-module-package-name" value="com.google.android.art" />
+ <!-- ART Mainline Module (external (AOSP) version). -->
+ <option name="mainline-module-package-name" value="com.android.art" />
+ </object>
+</configuration>
diff --git a/compiler/jit/jit_compiler.cc b/compiler/jit/jit_compiler.cc
index c5095cf876..f819cd8c97 100644
--- a/compiler/jit/jit_compiler.cc
+++ b/compiler/jit/jit_compiler.cc
@@ -188,7 +188,7 @@ bool JitCompiler::CompileMethod(
: "Compiling baseline",
&logger);
JitCodeCache* const code_cache = runtime->GetJit()->GetCodeCache();
- metrics::AutoTimer timer{runtime->GetMetrics()->JitMethodCompileTime()};
+ metrics::AutoTimer timer{runtime->GetMetrics()->JitMethodCompileTotalTime()};
success = compiler_->JitCompile(
self, code_cache, region, method, compilation_kind, jit_logger_.get());
uint64_t duration_us = timer.Stop();
diff --git a/compiler/optimizing/ssa_liveness_analysis.h b/compiler/optimizing/ssa_liveness_analysis.h
index 3ea2815e64..7f31585f34 100644
--- a/compiler/optimizing/ssa_liveness_analysis.h
+++ b/compiler/optimizing/ssa_liveness_analysis.h
@@ -873,9 +873,9 @@ class LiveInterval : public ArenaObject<kArenaAllocSsaLiveness> {
}
// Returns whether an interval, when it is non-split, is using
- // the same register of one of its input.
+ // the same register of one of its input. This function should
+ // be used only for DCHECKs.
bool IsUsingInputRegister() const {
- CHECK(kIsDebugBuild) << "Function should be used only for DCHECKs";
if (defined_by_ != nullptr && !IsSplit()) {
for (const HInstruction* input : defined_by_->GetInputs()) {
LiveInterval* interval = input->GetLiveInterval();
@@ -899,9 +899,9 @@ class LiveInterval : public ArenaObject<kArenaAllocSsaLiveness> {
// Returns whether an interval, when it is non-split, can safely use
// the same register of one of its input. Note that this method requires
- // IsUsingInputRegister() to be true.
+ // IsUsingInputRegister() to be true. This function should be used only
+ // for DCHECKs.
bool CanUseInputRegister() const {
- CHECK(kIsDebugBuild) << "Function should be used only for DCHECKs";
DCHECK(IsUsingInputRegister());
if (defined_by_ != nullptr && !IsSplit()) {
LocationSummary* locations = defined_by_->GetLocations();