Hide internal libart-compiler symbols
Add version_script for libart-compiler
Link libart-compiler statically for tests that use internal symbols
Add a test to ensure that runtime can use jit_load
libart-compiler.so size after applying version_script:
arm64*: 4044k -> 3332k (-17.6%)
arm32: 3086564 -> 2535600 (-17.9%)
x86: 5375496 -> 4183368 (-22.2%)
x86_64: 5670976 -> 4509632 (-20.5%)
*sparse file size on device obtained by "ls -lsk libart-compiler.so"
Bug: 186902856
Change-Id: I9ea03c70abcb7693ed3b8c7a672e194b8a139f1f
Test: m acts_tests catbox cts general-tests host-unit-tests test_mapping tradefed-all vts dist
Test: m test-art-host-gtest-art_runtime_tests test-art-host-gtest-art_runtime_compiler_tests
diff --git a/compiler/Android.bp b/compiler/Android.bp
index 8916fa1..50af288 100644
--- a/compiler/Android.bp
+++ b/compiler/Android.bp
@@ -176,6 +176,7 @@
],
export_include_dirs: ["."],
+ version_script: "libart-compiler.map",
}
cc_defaults {
@@ -488,11 +489,12 @@
],
shared_libs: [
"libprofiled",
- "libartd-compiler",
"libartd-simulator-container",
+ "liblzma",
],
static_libs: [
"libvixld",
+ "libartd-compiler",
],
}
@@ -506,7 +508,8 @@
data: [":generate-boot-image"],
shared_libs: [
"libprofile",
- "libart-compiler",
+ "liblzma",
+ "libartpalette",
],
static_libs: [
// For now, link `libart-simulator-container` statically for simplicity,
@@ -516,6 +519,7 @@
// dynamically.
"libart-simulator-container",
"libvixl",
+ "libart-compiler",
],
test_config: "art_standalone_compiler_tests.xml",
}
@@ -548,9 +552,10 @@
},
},
shared_libs: [
- "libartd-compiler",
+ "liblzma",
],
static_libs: [
+ "libartd-compiler",
"libvixld",
],
}
diff --git a/compiler/libart-compiler.map b/compiler/libart-compiler.map
new file mode 100644
index 0000000..fb1eefc
--- /dev/null
+++ b/compiler/libart-compiler.map
@@ -0,0 +1,46 @@
+
+ART_COMPILER {
+global:
+ global:
+ extern "C++" {
+ "art::CompiledCode::CodeDelta() const";
+ "art::CompiledCode::CodeDelta(art::InstructionSet)";
+ "art::CompiledCode::CodePointer(void const*, art::InstructionSet)";
+ "art::CompiledMethodStorage::CompiledMethodStorage(int)";
+ "art::CompiledMethodStorage::DumpMemoryUsage(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool) const";
+ "art::CompiledMethodStorage::GetThunkCode(art::linker::LinkerPatch const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)";
+ "art::CompiledMethodStorage::UniqueVMapTableEntries() const";
+ "art::CompiledMethodStorage::~CompiledMethodStorage()";
+ "art::Compiler::Create(art::CompilerOptions const&, art::CompiledMethodStorage*, art::Compiler::Kind)";
+ "art::CompilerOptions::CompilerOptions()";
+ "art::CompilerOptions::GetVerificationResults() const";
+ "art::CompilerOptions::IsImageClass(char const*) const";
+ "art::CompilerOptions::IsPreloadedClass(char const*) const";
+ "art::CompilerOptions::ParseDumpInitFailures(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)";
+ "art::CompilerOptions::ParseRegisterAllocationStrategy(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)";
+ "art::CompilerOptions::ShouldCompileWithClinitCheck(art::ArtMethod*) const";
+ "art::CompilerOptions::~CompilerOptions()";
+ "art::CreateTrampoline32(art::InstructionSet, art::EntryPointCallingConvention, art::ThreadOffset<(art::PointerSize)4>)";
+ "art::CreateTrampoline64(art::InstructionSet, art::EntryPointCallingConvention, art::ThreadOffset<(art::PointerSize)8>)";
+ "art::VerificationResults::AddRejectedClass(art::ClassReference)";
+ "art::VerificationResults::AddUncompilableMethod(art::MethodReference)";
+ "art::VerificationResults::IsClassRejected(art::ClassReference) const";
+ "art::VerificationResults::IsUncompilableMethod(art::MethodReference) const";
+ "art::VerificationResults::VerificationResults()";
+ "art::VerificationResults::~VerificationResults()";
+ "art::linker::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, art::linker::LinkerPatch::Type)";
+ "art::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, art::Whence const&)";
+ "void art::debug::WriteDebugInfo<art::ElfTypes32>(art::ElfBuilder<art::ElfTypes32>*, art::debug::DebugInfo const&)";
+ "void art::debug::WriteDebugInfo<art::ElfTypes64>(art::ElfBuilder<art::ElfTypes64>*, art::debug::DebugInfo const&)";
+ art::CompiledCode::AlignCode*;
+ art::CompiledMethod::*;
+ art::IntrinsicObjects*;
+ art::debug::MakeMiniDebugInfo*;
+ };
+
+ jit_load;
+
+ local:
+ *;
+};
+
diff --git a/dex2oat/Android.bp b/dex2oat/Android.bp
index cd04dc1..084239c 100644
--- a/dex2oat/Android.bp
+++ b/dex2oat/Android.bp
@@ -296,6 +296,7 @@
],
static_libs: [
"libart-dex2oat",
+ "libelffile",
],
lto: {
thin: true,
@@ -355,6 +356,7 @@
],
static_libs: [
"libartd-dex2oat",
+ "libelffiled",
],
},
host: {
@@ -555,13 +557,14 @@
],
shared_libs: [
"libartbased",
- "libartd-compiler",
"libartd-dexlayout",
+ "liblzma",
"libprofiled",
],
static_libs: [
- "libartd-dex2oat-gtest",
+ "libartd-compiler",
"libartd-dex2oat",
+ "libartd-dex2oat-gtest",
"libvixld",
],
}
@@ -575,14 +578,15 @@
],
data: [":generate-boot-image"],
shared_libs: [
- "libartbase",
- "libart-compiler",
"libart-dexlayout",
+ "libartbase",
+ "liblzma",
"libprofile",
],
static_libs: [
- "libart-dex2oat-gtest",
+ "libart-compiler",
"libart-dex2oat",
+ "libart-dex2oat-gtest",
"libvixl",
],
test_config: "art_standalone_dex2oat_tests.xml",
diff --git a/oatdump/Android.bp b/oatdump/Android.bp
index 5724280..ba7ceb5 100644
--- a/oatdump/Android.bp
+++ b/oatdump/Android.bp
@@ -70,6 +70,9 @@
"libdexfile",
"libprofile",
],
+ static_libs: [
+ "libelffile",
+ ],
},
host: {
// Make the host binary static, except for system libraries.
@@ -124,6 +127,9 @@
"libdexfiled",
"libprofiled",
],
+ static_libs: [
+ "libelffiled",
+ ],
},
host: {
// Make the host binary static, except for system libraries.
diff --git a/runtime/Android.bp b/runtime/Android.bp
index d42848f..a9a4424 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -822,6 +822,7 @@
"intern_table_test.cc",
"interpreter/safe_math_test.cc",
"interpreter/unstarted_runtime_test.cc",
+ "jit/jit_load_test.cc",
"jit/jit_memory_region_test.cc",
"jit/profile_saver_test.cc",
"jit/profiling_info_test.cc",
diff --git a/runtime/jit/jit_load_test.cc b/runtime/jit/jit_load_test.cc
new file mode 100644
index 0000000..4b080a5
--- /dev/null
+++ b/runtime/jit/jit_load_test.cc
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include "common_runtime_test.h"
+#include "compiler_callbacks.h"
+
+namespace art {
+
+class JitLoadTest : public CommonRuntimeTest {
+ protected:
+ void SetUpRuntimeOptions(RuntimeOptions *options) override {
+ callbacks_.reset();
+ CommonRuntimeTest::SetUpRuntimeOptions(options);
+ options->push_back(std::make_pair("-Xusejit:true", nullptr));
+ }
+};
+
+
+TEST_F(JitLoadTest, JitLoad) {
+ Thread::Current()->TransitionFromSuspendedToRunnable();
+ runtime_->Start();
+ ASSERT_NE(runtime_->GetJit(), nullptr);
+}
+
+} // namespace art