summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build/art.go15
-rw-r--r--compiler/Android.bp22
-rw-r--r--compiler/debug/dwarf/dwarf_test.h6
-rw-r--r--compiler/debug/elf_debug_frame_writer.h4
-rw-r--r--compiler/debug/elf_debug_info_writer.h7
-rw-r--r--compiler/debug/elf_debug_line_writer.h6
-rw-r--r--compiler/debug/elf_debug_writer.cc18
-rw-r--r--compiler/debug/elf_debug_writer.h4
-rw-r--r--compiler/debug/elf_gnu_debugdata_writer.h7
-rw-r--r--compiler/debug/elf_symtab_writer.h4
-rw-r--r--compiler/linker/arm64/relative_patcher_arm64.cc1
-rw-r--r--compiler/linker/buffered_output_stream.cc2
-rw-r--r--compiler/linker/buffered_output_stream.h2
-rw-r--r--compiler/linker/elf_builder.h (renamed from compiler/elf_builder.h)8
-rw-r--r--compiler/linker/error_delaying_output_stream.h2
-rw-r--r--compiler/linker/file_output_stream.cc2
-rw-r--r--compiler/linker/file_output_stream.h2
-rw-r--r--compiler/linker/output_stream.cc2
-rw-r--r--compiler/linker/output_stream.h2
-rw-r--r--compiler/linker/output_stream_test.cc2
-rw-r--r--compiler/linker/relative_patcher.h3
-rw-r--r--compiler/linker/relative_patcher_test.h4
-rw-r--r--compiler/linker/vector_output_stream.cc2
-rw-r--r--compiler/linker/vector_output_stream.h2
-rw-r--r--compiler/optimizing/code_generator_arm64.cc1
-rw-r--r--compiler/optimizing/code_generator_arm_vixl.cc1
-rw-r--r--compiler/optimizing/code_generator_mips.cc1
-rw-r--r--compiler/optimizing/code_generator_mips64.cc1
-rw-r--r--compiler/optimizing/code_generator_x86.cc1
-rw-r--r--compiler/optimizing/code_generator_x86_64.cc1
-rw-r--r--compiler/optimizing/intrinsics_arm64.cc1
-rw-r--r--compiler/optimizing/intrinsics_arm_vixl.cc1
-rw-r--r--compiler/optimizing/intrinsics_mips.cc1
-rw-r--r--compiler/optimizing/intrinsics_mips64.cc1
-rw-r--r--compiler/optimizing/intrinsics_x86.cc1
-rw-r--r--compiler/optimizing/intrinsics_x86_64.cc1
-rw-r--r--compiler/optimizing/optimizing_compiler.cc1
-rw-r--r--compiler/optimizing/scheduler_arm.cc1
-rw-r--r--compiler/utils/arm/assembler_arm_vixl.cc1
-rw-r--r--compiler/utils/arm64/assembler_arm64.cc1
-rw-r--r--compiler/utils/mips/assembler_mips.h1
-rw-r--r--compiler/utils/mips64/assembler_mips64.h1
-rw-r--r--compiler/utils/x86/assembler_x86.h1
-rw-r--r--compiler/utils/x86_64/assembler_x86_64.h1
-rw-r--r--dex2oat/Android.bp103
-rw-r--r--dex2oat/dex2oat.cc70
l---------dex2oat/generate-operator-out.py1
-rw-r--r--dex2oat/linker/elf_writer.cc (renamed from compiler/elf_writer.cc)2
-rw-r--r--dex2oat/linker/elf_writer.h (renamed from compiler/elf_writer.h)12
-rw-r--r--dex2oat/linker/elf_writer_quick.cc (renamed from compiler/elf_writer_quick.cc)4
-rw-r--r--dex2oat/linker/elf_writer_quick.h (renamed from compiler/elf_writer_quick.h)9
-rw-r--r--dex2oat/linker/elf_writer_test.cc (renamed from compiler/elf_writer_test.cc)4
-rw-r--r--dex2oat/linker/image_test.cc (renamed from compiler/image_test.cc)2
-rw-r--r--dex2oat/linker/image_test.h (renamed from compiler/image_test.h)13
-rw-r--r--dex2oat/linker/image_write_read_test.cc (renamed from compiler/image_write_read_test.cc)2
-rw-r--r--dex2oat/linker/image_writer.cc (renamed from compiler/image_writer.cc)4
-rw-r--r--dex2oat/linker/image_writer.h (renamed from compiler/image_writer.h)9
-rw-r--r--dex2oat/linker/multi_oat_relative_patcher.cc (renamed from compiler/linker/multi_oat_relative_patcher.cc)3
-rw-r--r--dex2oat/linker/multi_oat_relative_patcher.h (renamed from compiler/linker/multi_oat_relative_patcher.h)12
-rw-r--r--dex2oat/linker/multi_oat_relative_patcher_test.cc (renamed from compiler/linker/multi_oat_relative_patcher_test.cc)2
-rw-r--r--dex2oat/linker/oat_writer.cc (renamed from compiler/oat_writer.cc)4
-rw-r--r--dex2oat/linker/oat_writer.h (renamed from compiler/oat_writer.h)27
-rw-r--r--dex2oat/linker/oat_writer_test.cc (renamed from compiler/oat_test.cc)10
-rw-r--r--oatdump/oatdump.cc11
-rw-r--r--runtime/arch/arm/asm_support_arm.h3
-rw-r--r--runtime/arch/arm/quick_entrypoints_arm.S12
-rw-r--r--runtime/arch/mips/quick_entrypoints_mips.S8
-rw-r--r--runtime/arch/mips64/quick_entrypoints_mips64.S8
-rw-r--r--runtime/asm_support.h14
-rw-r--r--runtime/class_linker.h13
-rw-r--r--runtime/class_table.h12
-rw-r--r--runtime/dex_instruction.cc42
-rw-r--r--runtime/dex_instruction_test.cc37
-rw-r--r--runtime/globals.h2
-rw-r--r--runtime/image.h6
-rw-r--r--runtime/intern_table.h8
-rw-r--r--runtime/java_vm_ext.cc2
-rw-r--r--runtime/jit/profile_compilation_info.cc27
-rw-r--r--runtime/jit/profile_compilation_info.h6
-rw-r--r--runtime/mirror/object-inl.h1
-rw-r--r--runtime/mirror/object-readbarrier-inl.h1
-rw-r--r--runtime/mirror/object_reference.h1
-rw-r--r--runtime/verifier/method_verifier.cc11
83 files changed, 422 insertions, 245 deletions
diff --git a/build/art.go b/build/art.go
index 19b39cdbce..1bcaf51a1d 100644
--- a/build/art.go
+++ b/build/art.go
@@ -261,6 +261,7 @@ var artTestMutex sync.Mutex
func init() {
android.RegisterModuleType("art_cc_library", artLibrary)
+ android.RegisterModuleType("art_cc_static_library", artStaticLibrary)
android.RegisterModuleType("art_cc_binary", artBinary)
android.RegisterModuleType("art_cc_test", artTest)
android.RegisterModuleType("art_cc_test_library", artTestLibrary)
@@ -292,8 +293,18 @@ func artDefaultsFactory() android.Module {
}
func artLibrary() android.Module {
- library, _ := cc.NewLibrary(android.HostAndDeviceSupported)
- module := library.Init()
+ m, _ := cc.NewLibrary(android.HostAndDeviceSupported)
+ module := m.Init()
+
+ installCodegenCustomizer(module, true)
+
+ return module
+}
+
+func artStaticLibrary() android.Module {
+ m, library := cc.NewLibrary(android.HostAndDeviceSupported)
+ library.BuildOnlyStatic()
+ module := m.Init()
installCodegenCustomizer(module, true)
diff --git a/compiler/Android.bp b/compiler/Android.bp
index c798d9782a..14756792c0 100644
--- a/compiler/Android.bp
+++ b/compiler/Android.bp
@@ -38,7 +38,6 @@ art_cc_defaults {
"driver/dex_compilation_unit.cc",
"linker/buffered_output_stream.cc",
"linker/file_output_stream.cc",
- "linker/multi_oat_relative_patcher.cc",
"linker/output_stream.cc",
"linker/vector_output_stream.cc",
"linker/relative_patcher.cc",
@@ -95,10 +94,6 @@ art_cc_defaults {
"utils/jni_macro_assembler.cc",
"utils/swap_space.cc",
"compiler.cc",
- "elf_writer.cc",
- "elf_writer_quick.cc",
- "image_writer.cc",
- "oat_writer.cc",
],
codegen: {
@@ -198,19 +193,10 @@ art_cc_defaults {
generated_sources: ["art_compiler_operator_srcs"],
shared_libs: [
"libbase",
- "liblz4",
"liblzma",
],
include_dirs: ["art/disassembler"],
export_include_dirs: ["."],
-
- // For SHA-1 checksumming of build ID
- static: {
- whole_static_libs: ["libcrypto"],
- },
- shared: {
- shared_libs: ["libcrypto"],
- },
}
gensrcs {
@@ -222,7 +208,6 @@ gensrcs {
"dex/dex_to_dex_compiler.h",
"driver/compiler_driver.h",
"driver/compiler_options.h",
- "image_writer.h",
"optimizing/locations.h",
"utils/arm/constants_arm.h",
@@ -265,7 +250,6 @@ art_cc_library {
},
shared_libs: [
"libart",
- "libart-dexlayout",
],
}
@@ -305,7 +289,6 @@ art_cc_library {
},
shared_libs: [
"libartd",
- "libartd-dexlayout"
],
}
@@ -332,15 +315,10 @@ art_cc_test {
"dex/dex_to_dex_decompiler_test.cc",
"driver/compiled_method_storage_test.cc",
"driver/compiler_driver_test.cc",
- "elf_writer_test.cc",
"exception_test.cc",
- "image_test.cc",
- "image_write_read_test.cc",
"jni/jni_compiler_test.cc",
"linker/method_bss_mapping_encoder_test.cc",
- "linker/multi_oat_relative_patcher_test.cc",
"linker/output_stream_test.cc",
- "oat_test.cc",
"optimizing/bounds_check_elimination_test.cc",
"optimizing/dominator_test.cc",
"optimizing/find_loops_test.cc",
diff --git a/compiler/debug/dwarf/dwarf_test.h b/compiler/debug/dwarf/dwarf_test.h
index e1f538d9a7..b30ff143d3 100644
--- a/compiler/debug/dwarf/dwarf_test.h
+++ b/compiler/debug/dwarf/dwarf_test.h
@@ -28,8 +28,8 @@
#include "base/unix_file/fd_file.h"
#include "common_runtime_test.h"
-#include "elf_builder.h"
#include "gtest/gtest.h"
+#include "linker/elf_builder.h"
#include "linker/file_output_stream.h"
#include "os.h"
@@ -62,8 +62,8 @@ class DwarfTest : public CommonRuntimeTest {
// Write simple elf file with just the DWARF sections.
InstructionSet isa = (sizeof(typename ElfTypes::Addr) == 8) ? kX86_64 : kX86;
ScratchFile file;
- FileOutputStream output_stream(file.GetFile());
- ElfBuilder<ElfTypes> builder(isa, nullptr, &output_stream);
+ linker::FileOutputStream output_stream(file.GetFile());
+ linker::ElfBuilder<ElfTypes> builder(isa, nullptr, &output_stream);
builder.Start();
if (!debug_info_data_.empty()) {
builder.WriteSection(".debug_info", &debug_info_data_);
diff --git a/compiler/debug/elf_debug_frame_writer.h b/compiler/debug/elf_debug_frame_writer.h
index f9d33c1c30..6dacdfa48c 100644
--- a/compiler/debug/elf_debug_frame_writer.h
+++ b/compiler/debug/elf_debug_frame_writer.h
@@ -24,7 +24,7 @@
#include "debug/dwarf/dwarf_constants.h"
#include "debug/dwarf/headers.h"
#include "debug/method_debug_info.h"
-#include "elf_builder.h"
+#include "linker/elf_builder.h"
namespace art {
namespace debug {
@@ -168,7 +168,7 @@ static void WriteCIE(InstructionSet isa,
}
template<typename ElfTypes>
-void WriteCFISection(ElfBuilder<ElfTypes>* builder,
+void WriteCFISection(linker::ElfBuilder<ElfTypes>* builder,
const ArrayRef<const MethodDebugInfo>& method_infos,
dwarf::CFIFormat format,
bool write_oat_patches) {
diff --git a/compiler/debug/elf_debug_info_writer.h b/compiler/debug/elf_debug_info_writer.h
index 6c6bd63b14..2b617273b5 100644
--- a/compiler/debug/elf_debug_info_writer.h
+++ b/compiler/debug/elf_debug_info_writer.h
@@ -29,8 +29,9 @@
#include "debug/method_debug_info.h"
#include "dex_file-inl.h"
#include "dex_file.h"
-#include "elf_builder.h"
+#include "heap_poisoning.h"
#include "linear_alloc.h"
+#include "linker/elf_builder.h"
#include "mirror/array.h"
#include "mirror/class-inl.h"
#include "mirror/class.h"
@@ -67,7 +68,7 @@ class ElfDebugInfoWriter {
using Elf_Addr = typename ElfTypes::Addr;
public:
- explicit ElfDebugInfoWriter(ElfBuilder<ElfTypes>* builder)
+ explicit ElfDebugInfoWriter(linker::ElfBuilder<ElfTypes>* builder)
: builder_(builder),
debug_abbrev_(&debug_abbrev_buffer_) {
}
@@ -92,7 +93,7 @@ class ElfDebugInfoWriter {
}
private:
- ElfBuilder<ElfTypes>* builder_;
+ linker::ElfBuilder<ElfTypes>* builder_;
std::vector<uintptr_t> debug_info_patches_;
std::vector<uint8_t> debug_abbrev_buffer_;
dwarf::DebugAbbrevWriter<> debug_abbrev_;
diff --git a/compiler/debug/elf_debug_line_writer.h b/compiler/debug/elf_debug_line_writer.h
index cdd1e53f94..cf5d65efac 100644
--- a/compiler/debug/elf_debug_line_writer.h
+++ b/compiler/debug/elf_debug_line_writer.h
@@ -25,7 +25,7 @@
#include "debug/dwarf/headers.h"
#include "debug/elf_compilation_unit.h"
#include "dex_file-inl.h"
-#include "elf_builder.h"
+#include "linker/elf_builder.h"
#include "stack_map.h"
namespace art {
@@ -43,7 +43,7 @@ class ElfDebugLineWriter {
using Elf_Addr = typename ElfTypes::Addr;
public:
- explicit ElfDebugLineWriter(ElfBuilder<ElfTypes>* builder) : builder_(builder) {
+ explicit ElfDebugLineWriter(linker::ElfBuilder<ElfTypes>* builder) : builder_(builder) {
}
void Start() {
@@ -280,7 +280,7 @@ class ElfDebugLineWriter {
}
private:
- ElfBuilder<ElfTypes>* builder_;
+ linker::ElfBuilder<ElfTypes>* builder_;
std::vector<uintptr_t> debug_line_patches_;
};
diff --git a/compiler/debug/elf_debug_writer.cc b/compiler/debug/elf_debug_writer.cc
index c5ff85827e..33c46d7e1f 100644
--- a/compiler/debug/elf_debug_writer.cc
+++ b/compiler/debug/elf_debug_writer.cc
@@ -29,7 +29,7 @@
#include "debug/elf_gnu_debugdata_writer.h"
#include "debug/elf_symtab_writer.h"
#include "debug/method_debug_info.h"
-#include "elf_builder.h"
+#include "linker/elf_builder.h"
#include "linker/vector_output_stream.h"
#include "oat.h"
@@ -37,7 +37,7 @@ namespace art {
namespace debug {
template <typename ElfTypes>
-void WriteDebugInfo(ElfBuilder<ElfTypes>* builder,
+void WriteDebugInfo(linker::ElfBuilder<ElfTypes>* builder,
const ArrayRef<const MethodDebugInfo>& method_infos,
dwarf::CFIFormat cfi_format,
bool write_oat_patches) {
@@ -133,8 +133,9 @@ static std::vector<uint8_t> WriteDebugElfFileForMethodsInternal(
const ArrayRef<const MethodDebugInfo>& method_infos) {
std::vector<uint8_t> buffer;
buffer.reserve(KB);
- VectorOutputStream out("Debug ELF file", &buffer);
- std::unique_ptr<ElfBuilder<ElfTypes>> builder(new ElfBuilder<ElfTypes>(isa, features, &out));
+ linker::VectorOutputStream out("Debug ELF file", &buffer);
+ std::unique_ptr<linker::ElfBuilder<ElfTypes>> builder(
+ new linker::ElfBuilder<ElfTypes>(isa, features, &out));
// No program headers since the ELF file is not linked and has no allocated sections.
builder->Start(false /* write_program_headers */);
WriteDebugInfo(builder.get(),
@@ -165,8 +166,9 @@ static std::vector<uint8_t> WriteDebugElfFileForClassesInternal(
REQUIRES_SHARED(Locks::mutator_lock_) {
std::vector<uint8_t> buffer;
buffer.reserve(KB);
- VectorOutputStream out("Debug ELF file", &buffer);
- std::unique_ptr<ElfBuilder<ElfTypes>> builder(new ElfBuilder<ElfTypes>(isa, features, &out));
+ linker::VectorOutputStream out("Debug ELF file", &buffer);
+ std::unique_ptr<linker::ElfBuilder<ElfTypes>> builder(
+ new linker::ElfBuilder<ElfTypes>(isa, features, &out));
// No program headers since the ELF file is not linked and has no allocated sections.
builder->Start(false /* write_program_headers */);
ElfDebugInfoWriter<ElfTypes> info_writer(builder.get());
@@ -192,12 +194,12 @@ std::vector<uint8_t> WriteDebugElfFileForClasses(InstructionSet isa,
// Explicit instantiations
template void WriteDebugInfo<ElfTypes32>(
- ElfBuilder<ElfTypes32>* builder,
+ linker::ElfBuilder<ElfTypes32>* builder,
const ArrayRef<const MethodDebugInfo>& method_infos,
dwarf::CFIFormat cfi_format,
bool write_oat_patches);
template void WriteDebugInfo<ElfTypes64>(
- ElfBuilder<ElfTypes64>* builder,
+ linker::ElfBuilder<ElfTypes64>* builder,
const ArrayRef<const MethodDebugInfo>& method_infos,
dwarf::CFIFormat cfi_format,
bool write_oat_patches);
diff --git a/compiler/debug/elf_debug_writer.h b/compiler/debug/elf_debug_writer.h
index 6e26ba36c4..d24ca9b203 100644
--- a/compiler/debug/elf_debug_writer.h
+++ b/compiler/debug/elf_debug_writer.h
@@ -23,7 +23,7 @@
#include "base/macros.h"
#include "base/mutex.h"
#include "debug/dwarf/dwarf_constants.h"
-#include "elf_builder.h"
+#include "linker/elf_builder.h"
namespace art {
class OatHeader;
@@ -35,7 +35,7 @@ struct MethodDebugInfo;
template <typename ElfTypes>
void WriteDebugInfo(
- ElfBuilder<ElfTypes>* builder,
+ linker::ElfBuilder<ElfTypes>* builder,
const ArrayRef<const MethodDebugInfo>& method_infos,
dwarf::CFIFormat cfi_format,
bool write_oat_patches);
diff --git a/compiler/debug/elf_gnu_debugdata_writer.h b/compiler/debug/elf_gnu_debugdata_writer.h
index fb63d62572..1cdf6b0ad1 100644
--- a/compiler/debug/elf_gnu_debugdata_writer.h
+++ b/compiler/debug/elf_gnu_debugdata_writer.h
@@ -20,7 +20,7 @@
#include <vector>
#include "arch/instruction_set.h"
-#include "elf_builder.h"
+#include "linker/elf_builder.h"
#include "linker/vector_output_stream.h"
// liblzma.
@@ -85,8 +85,9 @@ static std::vector<uint8_t> MakeMiniDebugInfoInternal(
const ArrayRef<const MethodDebugInfo>& method_infos) {
std::vector<uint8_t> buffer;
buffer.reserve(KB);
- VectorOutputStream out("Mini-debug-info ELF file", &buffer);
- std::unique_ptr<ElfBuilder<ElfTypes>> builder(new ElfBuilder<ElfTypes>(isa, features, &out));
+ linker::VectorOutputStream out("Mini-debug-info ELF file", &buffer);
+ std::unique_ptr<linker::ElfBuilder<ElfTypes>> builder(
+ new linker::ElfBuilder<ElfTypes>(isa, features, &out));
builder->Start();
// Mirror .rodata and .text as NOBITS sections.
// It is needed to detected relocations after compression.
diff --git a/compiler/debug/elf_symtab_writer.h b/compiler/debug/elf_symtab_writer.h
index abd2699a1f..b37f984860 100644
--- a/compiler/debug/elf_symtab_writer.h
+++ b/compiler/debug/elf_symtab_writer.h
@@ -20,7 +20,7 @@
#include <unordered_set>
#include "debug/method_debug_info.h"
-#include "elf_builder.h"
+#include "linker/elf_builder.h"
#include "utils.h"
namespace art {
@@ -36,7 +36,7 @@ namespace debug {
constexpr bool kGenerateSingleArmMappingSymbol = true;
template <typename ElfTypes>
-static void WriteDebugSymbols(ElfBuilder<ElfTypes>* builder,
+static void WriteDebugSymbols(linker::ElfBuilder<ElfTypes>* builder,
const ArrayRef<const MethodDebugInfo>& method_infos,
bool with_signature) {
uint64_t mapping_symbol_address = std::numeric_limits<uint64_t>::max();
diff --git a/compiler/linker/arm64/relative_patcher_arm64.cc b/compiler/linker/arm64/relative_patcher_arm64.cc
index 270ba3c08d..82f502a3af 100644
--- a/compiler/linker/arm64/relative_patcher_arm64.cc
+++ b/compiler/linker/arm64/relative_patcher_arm64.cc
@@ -23,6 +23,7 @@
#include "compiled_method.h"
#include "driver/compiler_driver.h"
#include "entrypoints/quick/quick_entrypoints_enum.h"
+#include "heap_poisoning.h"
#include "linker/output_stream.h"
#include "lock_word.h"
#include "mirror/array-inl.h"
diff --git a/compiler/linker/buffered_output_stream.cc b/compiler/linker/buffered_output_stream.cc
index 4c66c764a9..07066b76ac 100644
--- a/compiler/linker/buffered_output_stream.cc
+++ b/compiler/linker/buffered_output_stream.cc
@@ -19,6 +19,7 @@
#include <string.h>
namespace art {
+namespace linker {
BufferedOutputStream::BufferedOutputStream(std::unique_ptr<OutputStream> out)
: OutputStream(out->GetLocation()), // Before out is moved to out_.
@@ -67,4 +68,5 @@ off_t BufferedOutputStream::Seek(off_t offset, Whence whence) {
return out_->Seek(offset, whence);
}
+} // namespace linker
} // namespace art
diff --git a/compiler/linker/buffered_output_stream.h b/compiler/linker/buffered_output_stream.h
index a2eefbbf17..66994e82a1 100644
--- a/compiler/linker/buffered_output_stream.h
+++ b/compiler/linker/buffered_output_stream.h
@@ -24,6 +24,7 @@
#include "globals.h"
namespace art {
+namespace linker {
class BufferedOutputStream FINAL : public OutputStream {
public:
@@ -49,6 +50,7 @@ class BufferedOutputStream FINAL : public OutputStream {
DISALLOW_COPY_AND_ASSIGN(BufferedOutputStream);
};
+} // namespace linker
} // namespace art
#endif // ART_COMPILER_LINKER_BUFFERED_OUTPUT_STREAM_H_
diff --git a/compiler/elf_builder.h b/compiler/linker/elf_builder.h
index 2ef9fa1ccb..79412370bc 100644
--- a/compiler/elf_builder.h
+++ b/compiler/linker/elf_builder.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_COMPILER_ELF_BUILDER_H_
-#define ART_COMPILER_ELF_BUILDER_H_
+#ifndef ART_COMPILER_LINKER_ELF_BUILDER_H_
+#define ART_COMPILER_LINKER_ELF_BUILDER_H_
#include <vector>
@@ -30,6 +30,7 @@
#include "linker/error_delaying_output_stream.h"
namespace art {
+namespace linker {
// Writes ELF file.
//
@@ -1021,6 +1022,7 @@ class ElfBuilder FINAL {
DISALLOW_COPY_AND_ASSIGN(ElfBuilder);
};
+} // namespace linker
} // namespace art
-#endif // ART_COMPILER_ELF_BUILDER_H_
+#endif // ART_COMPILER_LINKER_ELF_BUILDER_H_
diff --git a/compiler/linker/error_delaying_output_stream.h b/compiler/linker/error_delaying_output_stream.h
index 99410e4bb1..33e6b5ab23 100644
--- a/compiler/linker/error_delaying_output_stream.h
+++ b/compiler/linker/error_delaying_output_stream.h
@@ -22,6 +22,7 @@
#include "base/logging.h"
namespace art {
+namespace linker {
// OutputStream wrapper that delays reporting an error until Flush().
class ErrorDelayingOutputStream FINAL : public OutputStream {
@@ -96,6 +97,7 @@ class ErrorDelayingOutputStream FINAL : public OutputStream {
off_t output_offset_; // Keep track of the current position in the stream.
};
+} // namespace linker
} // namespace art
#endif // ART_COMPILER_LINKER_ERROR_DELAYING_OUTPUT_STREAM_H_
diff --git a/compiler/linker/file_output_stream.cc b/compiler/linker/file_output_stream.cc
index bbfbdfdca8..477846ec65 100644
--- a/compiler/linker/file_output_stream.cc
+++ b/compiler/linker/file_output_stream.cc
@@ -22,6 +22,7 @@
#include "base/unix_file/fd_file.h"
namespace art {
+namespace linker {
FileOutputStream::FileOutputStream(File* file) : OutputStream(file->GetPath()), file_(file) {}
@@ -37,4 +38,5 @@ bool FileOutputStream::Flush() {
return file_->Flush() == 0;
}
+} // namespace linker
} // namespace art
diff --git a/compiler/linker/file_output_stream.h b/compiler/linker/file_output_stream.h
index f2d845379f..28296a47fd 100644
--- a/compiler/linker/file_output_stream.h
+++ b/compiler/linker/file_output_stream.h
@@ -22,6 +22,7 @@
#include "os.h"
namespace art {
+namespace linker {
class FileOutputStream FINAL : public OutputStream {
public:
@@ -41,6 +42,7 @@ class FileOutputStream FINAL : public OutputStream {
DISALLOW_COPY_AND_ASSIGN(FileOutputStream);
};
+} // namespace linker
} // namespace art
#endif // ART_COMPILER_LINKER_FILE_OUTPUT_STREAM_H_
diff --git a/compiler/linker/output_stream.cc b/compiler/linker/output_stream.cc
index a8b64ca1ce..f5a19138a5 100644
--- a/compiler/linker/output_stream.cc
+++ b/compiler/linker/output_stream.cc
@@ -17,6 +17,7 @@
#include "output_stream.h"
namespace art {
+namespace linker {
std::ostream& operator<<(std::ostream& os, const Whence& rhs) {
switch (rhs) {
@@ -28,4 +29,5 @@ std::ostream& operator<<(std::ostream& os, const Whence& rhs) {
return os;
}
+} // namespace linker
} // namespace art
diff --git a/compiler/linker/output_stream.h b/compiler/linker/output_stream.h
index 96a5f489f0..5310e2fa41 100644
--- a/compiler/linker/output_stream.h
+++ b/compiler/linker/output_stream.h
@@ -23,6 +23,7 @@
#include "base/macros.h"
namespace art {
+namespace linker {
enum Whence {
kSeekSet = SEEK_SET,
@@ -59,6 +60,7 @@ class OutputStream {
DISALLOW_COPY_AND_ASSIGN(OutputStream);
};
+} // namespace linker
} // namespace art
#endif // ART_COMPILER_LINKER_OUTPUT_STREAM_H_
diff --git a/compiler/linker/output_stream_test.cc b/compiler/linker/output_stream_test.cc
index 87cb10000b..ad298406be 100644
--- a/compiler/linker/output_stream_test.cc
+++ b/compiler/linker/output_stream_test.cc
@@ -23,6 +23,7 @@
#include "common_runtime_test.h"
namespace art {
+namespace linker {
class OutputStreamTest : public CommonRuntimeTest {
protected:
@@ -133,4 +134,5 @@ TEST_F(OutputStreamTest, BufferedFlush) {
ASSERT_TRUE(checking_output_stream->flush_called);
}
+} // namespace linker
} // namespace art
diff --git a/compiler/linker/relative_patcher.h b/compiler/linker/relative_patcher.h
index 53a096627f..e079946e71 100644
--- a/compiler/linker/relative_patcher.h
+++ b/compiler/linker/relative_patcher.h
@@ -29,7 +29,6 @@ namespace art {
class CompiledMethod;
class LinkerPatch;
-class OutputStream;
namespace debug {
struct MethodDebugInfo;
@@ -37,6 +36,8 @@ struct MethodDebugInfo;
namespace linker {
+class OutputStream;
+
/**
* @class RelativePatcherTargetProvider
* @brief Interface for providing method offsets for relative call targets.
diff --git a/compiler/linker/relative_patcher_test.h b/compiler/linker/relative_patcher_test.h
index ca8743a561..f7dbc1ef1c 100644
--- a/compiler/linker/relative_patcher_test.h
+++ b/compiler/linker/relative_patcher_test.h
@@ -252,8 +252,8 @@ class RelativePatcherTest : public testing::Test {
}
// Map method reference to assinged offset.
- // Wrap the map in a class implementing linker::RelativePatcherTargetProvider.
- class MethodOffsetMap FINAL : public linker::RelativePatcherTargetProvider {
+ // Wrap the map in a class implementing RelativePatcherTargetProvider.
+ class MethodOffsetMap FINAL : public RelativePatcherTargetProvider {
public:
std::pair<bool, uint32_t> FindMethodOffset(MethodReference ref) OVERRIDE {
auto it = map.find(ref);
diff --git a/compiler/linker/vector_output_stream.cc b/compiler/linker/vector_output_stream.cc
index f758005c52..75f90e5f94 100644
--- a/compiler/linker/vector_output_stream.cc
+++ b/compiler/linker/vector_output_stream.cc
@@ -19,6 +19,7 @@
#include "base/logging.h"
namespace art {
+namespace linker {
VectorOutputStream::VectorOutputStream(const std::string& location, std::vector<uint8_t>* vector)
: OutputStream(location), offset_(vector->size()), vector_(vector) {}
@@ -45,4 +46,5 @@ off_t VectorOutputStream::Seek(off_t offset, Whence whence) {
return offset_;
}
+} // namespace linker
} // namespace art
diff --git a/compiler/linker/vector_output_stream.h b/compiler/linker/vector_output_stream.h
index a9b93e7a83..92caf596ab 100644
--- a/compiler/linker/vector_output_stream.h
+++ b/compiler/linker/vector_output_stream.h
@@ -24,6 +24,7 @@
#include <vector>
namespace art {
+namespace linker {
class VectorOutputStream FINAL : public OutputStream {
public:
@@ -64,6 +65,7 @@ class VectorOutputStream FINAL : public OutputStream {
DISALLOW_COPY_AND_ASSIGN(VectorOutputStream);
};
+} // namespace linker
} // namespace art
#endif // ART_COMPILER_LINKER_VECTOR_OUTPUT_STREAM_H_
diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc
index c61ef0a0bc..8814cfc251 100644
--- a/compiler/optimizing/code_generator_arm64.cc
+++ b/compiler/optimizing/code_generator_arm64.cc
@@ -27,6 +27,7 @@
#include "entrypoints/quick/quick_entrypoints.h"
#include "entrypoints/quick/quick_entrypoints_enum.h"
#include "gc/accounting/card_table.h"
+#include "heap_poisoning.h"
#include "intrinsics.h"
#include "intrinsics_arm64.h"
#include "linker/arm64/relative_patcher_arm64.h"
diff --git a/compiler/optimizing/code_generator_arm_vixl.cc b/compiler/optimizing/code_generator_arm_vixl.cc
index 6147259bd3..baf68c4e11 100644
--- a/compiler/optimizing/code_generator_arm_vixl.cc
+++ b/compiler/optimizing/code_generator_arm_vixl.cc
@@ -27,6 +27,7 @@
#include "compiled_method.h"
#include "entrypoints/quick/quick_entrypoints.h"
#include "gc/accounting/card_table.h"
+#include "heap_poisoning.h"
#include "intrinsics_arm_vixl.h"
#include "linker/arm/relative_patcher_thumb2.h"
#include "mirror/array-inl.h"
diff --git a/compiler/optimizing/code_generator_mips.cc b/compiler/optimizing/code_generator_mips.cc
index 9db2bd35ca..6256722661 100644
--- a/compiler/optimizing/code_generator_mips.cc
+++ b/compiler/optimizing/code_generator_mips.cc
@@ -26,6 +26,7 @@
#include "entrypoints/quick/quick_entrypoints.h"
#include "entrypoints/quick/quick_entrypoints_enum.h"
#include "gc/accounting/card_table.h"
+#include "heap_poisoning.h"
#include "intrinsics.h"
#include "intrinsics_mips.h"
#include "mirror/array-inl.h"
diff --git a/compiler/optimizing/code_generator_mips64.cc b/compiler/optimizing/code_generator_mips64.cc
index a27cbce3db..e8ae2db019 100644
--- a/compiler/optimizing/code_generator_mips64.cc
+++ b/compiler/optimizing/code_generator_mips64.cc
@@ -24,6 +24,7 @@
#include "entrypoints/quick/quick_entrypoints.h"
#include "entrypoints/quick/quick_entrypoints_enum.h"
#include "gc/accounting/card_table.h"
+#include "heap_poisoning.h"
#include "intrinsics.h"
#include "intrinsics_mips64.h"
#include "mirror/array-inl.h"
diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc
index c153cf78da..0b9130fa5a 100644
--- a/compiler/optimizing/code_generator_x86.cc
+++ b/compiler/optimizing/code_generator_x86.cc
@@ -23,6 +23,7 @@
#include "entrypoints/quick/quick_entrypoints.h"
#include "entrypoints/quick/quick_entrypoints_enum.h"
#include "gc/accounting/card_table.h"
+#include "heap_poisoning.h"
#include "intrinsics.h"
#include "intrinsics_x86.h"
#include "lock_word.h"
diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc
index bbf05a70d6..39a65806a4 100644
--- a/compiler/optimizing/code_generator_x86_64.cc
+++ b/compiler/optimizing/code_generator_x86_64.cc
@@ -22,6 +22,7 @@
#include "compiled_method.h"
#include "entrypoints/quick/quick_entrypoints.h"
#include "gc/accounting/card_table.h"
+#include "heap_poisoning.h"
#include "intrinsics.h"
#include "intrinsics_x86_64.h"
#include "lock_word.h"
diff --git a/compiler/optimizing/intrinsics_arm64.cc b/compiler/optimizing/intrinsics_arm64.cc
index 1ed1b7537e..96efe7f3b1 100644
--- a/compiler/optimizing/intrinsics_arm64.cc
+++ b/compiler/optimizing/intrinsics_arm64.cc
@@ -21,6 +21,7 @@
#include "code_generator_arm64.h"
#include "common_arm64.h"
#include "entrypoints/quick/quick_entrypoints.h"
+#include "heap_poisoning.h"
#include "intrinsics.h"
#include "lock_word.h"
#include "mirror/array-inl.h"
diff --git a/compiler/optimizing/intrinsics_arm_vixl.cc b/compiler/optimizing/intrinsics_arm_vixl.cc
index d2dc88a73b..e2494f0ce8 100644
--- a/compiler/optimizing/intrinsics_arm_vixl.cc
+++ b/compiler/optimizing/intrinsics_arm_vixl.cc
@@ -20,6 +20,7 @@
#include "art_method.h"
#include "code_generator_arm_vixl.h"
#include "common_arm.h"
+#include "heap_poisoning.h"
#include "lock_word.h"
#include "mirror/array-inl.h"
#include "mirror/object_array-inl.h"
diff --git a/compiler/optimizing/intrinsics_mips.cc b/compiler/optimizing/intrinsics_mips.cc
index 2669d97d82..fe5579c8be 100644
--- a/compiler/optimizing/intrinsics_mips.cc
+++ b/compiler/optimizing/intrinsics_mips.cc
@@ -20,6 +20,7 @@
#include "art_method.h"
#include "code_generator_mips.h"
#include "entrypoints/quick/quick_entrypoints.h"
+#include "heap_poisoning.h"
#include "intrinsics.h"
#include "mirror/array-inl.h"
#include "mirror/object_array-inl.h"
diff --git a/compiler/optimizing/intrinsics_mips64.cc b/compiler/optimizing/intrinsics_mips64.cc
index 74be954a75..80448f1389 100644
--- a/compiler/optimizing/intrinsics_mips64.cc
+++ b/compiler/optimizing/intrinsics_mips64.cc
@@ -20,6 +20,7 @@
#include "art_method.h"
#include "code_generator_mips64.h"
#include "entrypoints/quick/quick_entrypoints.h"
+#include "heap_poisoning.h"
#include "intrinsics.h"
#include "mirror/array-inl.h"
#include "mirror/object_array-inl.h"
diff --git a/compiler/optimizing/intrinsics_x86.cc b/compiler/optimizing/intrinsics_x86.cc
index a18b0cc400..abd9014438 100644
--- a/compiler/optimizing/intrinsics_x86.cc
+++ b/compiler/optimizing/intrinsics_x86.cc
@@ -23,6 +23,7 @@
#include "base/bit_utils.h"
#include "code_generator_x86.h"
#include "entrypoints/quick/quick_entrypoints.h"
+#include "heap_poisoning.h"
#include "intrinsics.h"
#include "intrinsics_utils.h"
#include "lock_word.h"
diff --git a/compiler/optimizing/intrinsics_x86_64.cc b/compiler/optimizing/intrinsics_x86_64.cc
index 5abdb1d1bd..7798c0d99e 100644
--- a/compiler/optimizing/intrinsics_x86_64.cc
+++ b/compiler/optimizing/intrinsics_x86_64.cc
@@ -23,6 +23,7 @@
#include "base/bit_utils.h"
#include "code_generator_x86_64.h"
#include "entrypoints/quick/quick_entrypoints.h"
+#include "heap_poisoning.h"
#include "intrinsics.h"
#include "intrinsics_utils.h"
#include "lock_word.h"
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index e128a15cfd..8dd2762a75 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -63,7 +63,6 @@
#include "driver/compiler_driver-inl.h"
#include "driver/compiler_options.h"
#include "driver/dex_compilation_unit.h"
-#include "elf_writer_quick.h"
#include "graph_checker.h"
#include "graph_visualizer.h"
#include "gvn.h"
diff --git a/compiler/optimizing/scheduler_arm.cc b/compiler/optimizing/scheduler_arm.cc
index d6eb6e3c52..66756a5fc7 100644
--- a/compiler/optimizing/scheduler_arm.cc
+++ b/compiler/optimizing/scheduler_arm.cc
@@ -19,6 +19,7 @@
#include "arch/arm/instruction_set_features_arm.h"
#include "code_generator_utils.h"
#include "common_arm.h"
+#include "heap_poisoning.h"
#include "mirror/array-inl.h"
#include "mirror/string.h"
diff --git a/compiler/utils/arm/assembler_arm_vixl.cc b/compiler/utils/arm/assembler_arm_vixl.cc
index 9df1b7434a..34849cd58d 100644
--- a/compiler/utils/arm/assembler_arm_vixl.cc
+++ b/compiler/utils/arm/assembler_arm_vixl.cc
@@ -21,6 +21,7 @@
#include "base/bit_utils.h"
#include "base/bit_utils_iterator.h"
#include "entrypoints/quick/quick_entrypoints.h"
+#include "heap_poisoning.h"
#include "thread.h"
using namespace vixl::aarch32; // NOLINT(build/namespaces)
diff --git a/compiler/utils/arm64/assembler_arm64.cc b/compiler/utils/arm64/assembler_arm64.cc
index d8a48a563c..bb989588d6 100644
--- a/compiler/utils/arm64/assembler_arm64.cc
+++ b/compiler/utils/arm64/assembler_arm64.cc
@@ -17,6 +17,7 @@
#include "assembler_arm64.h"
#include "base/logging.h"
#include "entrypoints/quick/quick_entrypoints.h"
+#include "heap_poisoning.h"
#include "offsets.h"
#include "thread.h"
diff --git a/compiler/utils/mips/assembler_mips.h b/compiler/utils/mips/assembler_mips.h
index 0f163ac83f..0b4eb9ca55 100644
--- a/compiler/utils/mips/assembler_mips.h
+++ b/compiler/utils/mips/assembler_mips.h
@@ -28,6 +28,7 @@
#include "base/stl_util_identity.h"
#include "constants_mips.h"
#include "globals.h"
+#include "heap_poisoning.h"
#include "managed_register_mips.h"
#include "offsets.h"
#include "utils/assembler.h"
diff --git a/compiler/utils/mips64/assembler_mips64.h b/compiler/utils/mips64/assembler_mips64.h
index dd6dcd1896..bb54382811 100644
--- a/compiler/utils/mips64/assembler_mips64.h
+++ b/compiler/utils/mips64/assembler_mips64.h
@@ -28,6 +28,7 @@
#include "base/stl_util_identity.h"
#include "constants_mips64.h"
#include "globals.h"
+#include "heap_poisoning.h"
#include "managed_register_mips64.h"
#include "offsets.h"
#include "utils/assembler.h"
diff --git a/compiler/utils/x86/assembler_x86.h b/compiler/utils/x86/assembler_x86.h
index 2964dbaabc..dce3ad228c 100644
--- a/compiler/utils/x86/assembler_x86.h
+++ b/compiler/utils/x86/assembler_x86.h
@@ -26,6 +26,7 @@
#include "base/macros.h"
#include "constants_x86.h"
#include "globals.h"
+#include "heap_poisoning.h"
#include "managed_register_x86.h"
#include "offsets.h"
#include "utils/assembler.h"
diff --git a/compiler/utils/x86_64/assembler_x86_64.h b/compiler/utils/x86_64/assembler_x86_64.h
index 3dab235d1c..fc0839b5a8 100644
--- a/compiler/utils/x86_64/assembler_x86_64.h
+++ b/compiler/utils/x86_64/assembler_x86_64.h
@@ -25,6 +25,7 @@
#include "base/macros.h"
#include "constants_x86_64.h"
#include "globals.h"
+#include "heap_poisoning.h"
#include "managed_register_x86_64.h"
#include "offsets.h"
#include "utils/assembler.h"
diff --git a/dex2oat/Android.bp b/dex2oat/Android.bp
index f13f01cabe..bdb8ff1fb1 100644
--- a/dex2oat/Android.bp
+++ b/dex2oat/Android.bp
@@ -14,6 +14,78 @@
// limitations under the License.
//
+art_cc_defaults {
+ name: "libart-dex2oat-defaults",
+ defaults: ["art_defaults"],
+ host_supported: true,
+ clang: true,
+ srcs: [
+ "linker/elf_writer.cc",
+ "linker/elf_writer_quick.cc",
+ "linker/image_writer.cc",
+ "linker/multi_oat_relative_patcher.cc",
+ "linker/oat_writer.cc",
+ ],
+ target: {
+ host: {
+ // For compiler driver TLS.
+ host_ldlibs: ["-lpthread"],
+ },
+ android: {
+ // For atrace.
+ shared_libs: ["libcutils"],
+ },
+ },
+ generated_sources: ["art_dex2oat_operator_srcs"],
+ shared_libs: [
+ "libart-compiler",
+ "libart-dexlayout",
+ "libbase",
+ "liblz4",
+ "liblzma",
+ ],
+ export_include_dirs: ["."],
+
+ // For SHA-1 checksumming of build ID
+ static: {
+ whole_static_libs: ["libcrypto"],
+ },
+ shared: {
+ shared_libs: ["libcrypto"],
+ },
+}
+
+gensrcs {
+ name: "art_dex2oat_operator_srcs",
+ cmd: "$(location generate-operator-out.py) art/dex2oat $(in) > $(out)",
+ tool_files: ["generate-operator-out.py"],
+ srcs: [
+ "linker/image_writer.h",
+ ],
+ output_extension: "operator_out.cc",
+}
+
+art_cc_static_library {
+ name: "libart-dex2oat",
+ defaults: ["libart-dex2oat-defaults"],
+ shared_libs: [
+ "libart-compiler",
+ "libart"
+ ],
+}
+
+art_cc_static_library {
+ name: "libartd-dex2oat",
+ defaults: [
+ "art_debug_defaults",
+ "libart-dex2oat-defaults",
+ ],
+ shared_libs: [
+ "libartd-compiler",
+ "libartd"
+ ],
+}
+
cc_library_headers {
name: "dex2oat_headers",
host_supported: true,
@@ -45,11 +117,16 @@ art_cc_binary {
"dex2oat-defaults",
],
shared_libs: [
- "libart",
"libart-compiler",
+ "libart-dexlayout",
+ "libart",
"libbase",
+ "liblz4",
"libsigchain",
],
+ static_libs: [
+ "libart-dex2oat",
+ ]
}
art_cc_binary {
@@ -59,11 +136,16 @@ art_cc_binary {
"dex2oat-defaults",
],
shared_libs: [
- "libartd",
"libartd-compiler",
+ "libartd-dexlayout",
+ "libartd",
"libbase",
+ "liblz4",
"libsigchain",
],
+ static_libs: [
+ "libartd-dex2oat",
+ ]
}
art_cc_binary {
@@ -85,6 +167,7 @@ art_cc_binary {
"-z muldefs",
],
static_libs: [
+ "libart-dex2oat",
"libart-compiler",
"libart-dexlayout",
"libart",
@@ -115,6 +198,7 @@ art_cc_binary {
"-z muldefs",
],
static_libs: [
+ "libartd-dex2oat",
"libartd-compiler",
"libartd-dexlayout",
"libartd",
@@ -131,6 +215,21 @@ art_cc_test {
srcs: [
"dex2oat_test.cc",
"dex2oat_image_test.cc",
+ "linker/elf_writer_test.cc",
+ "linker/image_test.cc",
+ "linker/image_write_read_test.cc",
+ "linker/multi_oat_relative_patcher_test.cc",
+ "linker/oat_writer_test.cc",
],
header_libs: ["dex2oat_headers"],
+ shared_libs: [
+ "libartd-compiler",
+ "libartd-dexlayout",
+ "libbase",
+ "liblz4",
+ "libsigchain",
+ ],
+ static_libs: [
+ "libartd-dex2oat",
+ ]
}
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index d8caf42f69..21d38956e3 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -61,19 +61,20 @@
#include "driver/compiler_driver.h"
#include "driver/compiler_options.h"
#include "elf_file.h"
-#include "elf_writer.h"
-#include "elf_writer_quick.h"
#include "gc/space/image_space.h"
#include "gc/space/space-inl.h"
#include "gc/verification.h"
-#include "image_writer.h"
#include "interpreter/unstarted_runtime.h"
#include "java_vm_ext.h"
#include "jit/profile_compilation_info.h"
#include "leb128.h"
#include "linker/buffered_output_stream.h"
+#include "linker/elf_writer.h"
+#include "linker/elf_writer_quick.h"
#include "linker/file_output_stream.h"
+#include "linker/image_writer.h"
#include "linker/multi_oat_relative_patcher.h"
+#include "linker/oat_writer.h"
#include "mirror/class-inl.h"
#include "mirror/class_loader.h"
#include "mirror/object-inl.h"
@@ -81,7 +82,6 @@
#include "nativehelper/ScopedLocalRef.h"
#include "oat_file.h"
#include "oat_file_assistant.h"
-#include "oat_writer.h"
#include "os.h"
#include "runtime.h"
#include "runtime_options.h"
@@ -1455,8 +1455,9 @@ class Dex2Oat FINAL {
// Note: we're only invalidating the magic data in the file, as dex2oat needs the rest of
// the information to remain valid.
if (update_input_vdex_) {
- std::unique_ptr<BufferedOutputStream> vdex_out = std::make_unique<BufferedOutputStream>(
- std::make_unique<FileOutputStream>(vdex_files_.back().get()));
+ std::unique_ptr<linker::BufferedOutputStream> vdex_out =
+ std::make_unique<linker::BufferedOutputStream>(
+ std::make_unique<linker::FileOutputStream>(vdex_files_.back().get()));
if (!vdex_out->WriteFully(&VdexFile::Header::kVdexInvalidMagic,
arraysize(VdexFile::Header::kVdexInvalidMagic))) {
PLOG(ERROR) << "Failed to invalidate vdex header. File: " << vdex_out->GetLocation();
@@ -2026,14 +2027,14 @@ class Dex2Oat FINAL {
VLOG(compiler) << "App image base=" << reinterpret_cast<void*>(image_base_);
}
- image_writer_.reset(new ImageWriter(*driver_,
- image_base_,
- compiler_options_->GetCompilePic(),
- IsAppImage(),
- image_storage_mode_,
- oat_filenames_,
- dex_file_oat_index_map_,
- dirty_image_objects_.get()));
+ image_writer_.reset(new linker::ImageWriter(*driver_,
+ image_base_,
+ compiler_options_->GetCompilePic(),
+ IsAppImage(),
+ image_storage_mode_,
+ oat_filenames_,
+ dex_file_oat_index_map_,
+ dirty_image_objects_.get()));
// We need to prepare method offsets in the image address space for direct method patching.
TimingLogger::ScopedTiming t2("dex2oat Prepare image address space", timings_);
@@ -2046,7 +2047,7 @@ class Dex2Oat FINAL {
// Initialize the writers with the compiler driver, image writer, and their
// dex files. The writers were created without those being there yet.
for (size_t i = 0, size = oat_files_.size(); i != size; ++i) {
- std::unique_ptr<OatWriter>& oat_writer = oat_writers_[i];
+ std::unique_ptr<linker::OatWriter>& oat_writer = oat_writers_[i];
std::vector<const DexFile*>& dex_files = dex_files_per_oat_file_[i];
oat_writer->Initialize(driver_.get(), image_writer_.get(), dex_files);
}
@@ -2057,8 +2058,9 @@ class Dex2Oat FINAL {
verifier::VerifierDeps* verifier_deps = callbacks_->GetVerifierDeps();
for (size_t i = 0, size = oat_files_.size(); i != size; ++i) {
File* vdex_file = vdex_files_[i].get();
- std::unique_ptr<BufferedOutputStream> vdex_out =
- std::make_unique<BufferedOutputStream>(std::make_unique<FileOutputStream>(vdex_file));
+ std::unique_ptr<linker::BufferedOutputStream> vdex_out =
+ std::make_unique<linker::BufferedOutputStream>(
+ std::make_unique<linker::FileOutputStream>(vdex_file));
if (!oat_writers_[i]->WriteVerifierDeps(vdex_out.get(), verifier_deps)) {
LOG(ERROR) << "Failed to write verifier dependencies into VDEX " << vdex_file->GetPath();
@@ -2082,8 +2084,8 @@ class Dex2Oat FINAL {
TimingLogger::ScopedTiming t2("dex2oat Write ELF", timings_);
linker::MultiOatRelativePatcher patcher(instruction_set_, instruction_set_features_.get());
for (size_t i = 0, size = oat_files_.size(); i != size; ++i) {
- std::unique_ptr<ElfWriter>& elf_writer = elf_writers_[i];
- std::unique_ptr<OatWriter>& oat_writer = oat_writers_[i];
+ std::unique_ptr<linker::ElfWriter>& elf_writer = elf_writers_[i];
+ std::unique_ptr<linker::OatWriter>& oat_writer = oat_writers_[i];
oat_writer->PrepareLayout(&patcher);
@@ -2116,14 +2118,14 @@ class Dex2Oat FINAL {
for (size_t i = 0, size = oat_files_.size(); i != size; ++i) {
std::unique_ptr<File>& oat_file = oat_files_[i];
- std::unique_ptr<ElfWriter>& elf_writer = elf_writers_[i];
- std::unique_ptr<OatWriter>& oat_writer = oat_writers_[i];
+ std::unique_ptr<linker::ElfWriter>& elf_writer = elf_writers_[i];
+ std::unique_ptr<linker::OatWriter>& oat_writer = oat_writers_[i];
// We need to mirror the layout of the ELF file in the compressed debug-info.
// Therefore PrepareDebugInfo() relies on the SetLoadedSectionSizes() call further above.
elf_writer->PrepareDebugInfo(oat_writer->GetMethodDebugInfo());
- OutputStream*& rodata = rodata_[i];
+ linker::OutputStream*& rodata = rodata_[i];
DCHECK(rodata != nullptr);
if (!oat_writer->WriteRodata(rodata)) {
LOG(ERROR) << "Failed to write .rodata section to the ELF file " << oat_file->GetPath();
@@ -2132,7 +2134,7 @@ class Dex2Oat FINAL {
elf_writer->EndRoData(rodata);
rodata = nullptr;
- OutputStream* text = elf_writer->StartText();
+ linker::OutputStream* text = elf_writer->StartText();
if (!oat_writer->WriteCode(text)) {
LOG(ERROR) << "Failed to write .text section to the ELF file " << oat_file->GetPath();
return false;
@@ -2510,13 +2512,13 @@ class Dex2Oat FINAL {
elf_writers_.reserve(oat_files_.size());
oat_writers_.reserve(oat_files_.size());
for (const std::unique_ptr<File>& oat_file : oat_files_) {
- elf_writers_.emplace_back(CreateElfWriterQuick(instruction_set_,
- instruction_set_features_.get(),
- compiler_options_.get(),
- oat_file.get()));
+ elf_writers_.emplace_back(linker::CreateElfWriterQuick(instruction_set_,
+ instruction_set_features_.get(),
+ compiler_options_.get(),
+ oat_file.get()));
elf_writers_.back()->Start();
const bool do_dexlayout = DoDexLayoutOptimizations();
- oat_writers_.emplace_back(new OatWriter(
+ oat_writers_.emplace_back(new linker::OatWriter(
IsBootImage(), timings_, do_dexlayout ? profile_compilation_info_.get() : nullptr));
}
}
@@ -2679,7 +2681,7 @@ class Dex2Oat FINAL {
return false;
}
- if (!ElfWriter::Fixup(oat_file.get(), oat_data_begins[i])) {
+ if (!linker::ElfWriter::Fixup(oat_file.get(), oat_data_begins[i])) {
oat_file->Erase();
LOG(ERROR) << "Failed to fixup ELF file " << oat_file->GetPath();
return false;
@@ -2882,11 +2884,11 @@ class Dex2Oat FINAL {
std::vector<const DexFile*> dex_files_;
std::string no_inline_from_string_;
- std::vector<std::unique_ptr<ElfWriter>> elf_writers_;
- std::vector<std::unique_ptr<OatWriter>> oat_writers_;
- std::vector<OutputStream*> rodata_;
- std::vector<std::unique_ptr<OutputStream>> vdex_out_;
- std::unique_ptr<ImageWriter> image_writer_;
+ std::vector<std::unique_ptr<linker::ElfWriter>> elf_writers_;
+ std::vector<std::unique_ptr<linker::OatWriter>> oat_writers_;
+ std::vector<linker::OutputStream*> rodata_;
+ std::vector<std::unique_ptr<linker::OutputStream>> vdex_out_;
+ std::unique_ptr<linker::ImageWriter> image_writer_;
std::unique_ptr<CompilerDriver> driver_;
std::vector<std::unique_ptr<MemMap>> opened_dex_files_maps_;
diff --git a/dex2oat/generate-operator-out.py b/dex2oat/generate-operator-out.py
new file mode 120000
index 0000000000..cc291d20c1
--- /dev/null
+++ b/dex2oat/generate-operator-out.py
@@ -0,0 +1 @@
+../tools/generate-operator-out.py \ No newline at end of file
diff --git a/compiler/elf_writer.cc b/dex2oat/linker/elf_writer.cc
index 37e4f113fa..ca34864293 100644
--- a/compiler/elf_writer.cc
+++ b/dex2oat/linker/elf_writer.cc
@@ -20,6 +20,7 @@
#include "elf_file.h"
namespace art {
+namespace linker {
uintptr_t ElfWriter::GetOatDataAddress(ElfFile* elf_file) {
uintptr_t oatdata_address = elf_file->FindSymbolAddress(SHT_DYNSYM,
@@ -59,4 +60,5 @@ bool ElfWriter::Fixup(File* file, uintptr_t oat_data_begin) {
return elf_file->Fixup(base_address);
}
+} // namespace linker
} // namespace art
diff --git a/compiler/elf_writer.h b/dex2oat/linker/elf_writer.h
index a8a5bc32b7..0eb36eda0f 100644
--- a/compiler/elf_writer.h
+++ b/dex2oat/linker/elf_writer.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_COMPILER_ELF_WRITER_H_
-#define ART_COMPILER_ELF_WRITER_H_
+#ifndef ART_DEX2OAT_LINKER_ELF_WRITER_H_
+#define ART_DEX2OAT_LINKER_ELF_WRITER_H_
#include <stdint.h>
#include <cstddef>
@@ -30,12 +30,15 @@
namespace art {
class ElfFile;
-class OutputStream;
namespace debug {
struct MethodDebugInfo;
} // namespace debug
+namespace linker {
+
+class OutputStream;
+
class ElfWriter {
public:
// Looks up information about location of oat file in elf file container.
@@ -78,6 +81,7 @@ class ElfWriter {
ElfWriter() = default;
};
+} // namespace linker
} // namespace art
-#endif // ART_COMPILER_ELF_WRITER_H_
+#endif // ART_DEX2OAT_LINKER_ELF_WRITER_H_
diff --git a/compiler/elf_writer_quick.cc b/dex2oat/linker/elf_writer_quick.cc
index 5d6dd2e1d7..93f5a1d6cf 100644
--- a/compiler/elf_writer_quick.cc
+++ b/dex2oat/linker/elf_writer_quick.cc
@@ -27,17 +27,18 @@
#include "debug/method_debug_info.h"
#include "driver/compiler_options.h"
#include "elf.h"
-#include "elf_builder.h"
#include "elf_utils.h"
#include "globals.h"
#include "leb128.h"
#include "linker/buffered_output_stream.h"
+#include "linker/elf_builder.h"
#include "linker/file_output_stream.h"
#include "thread-current-inl.h"
#include "thread_pool.h"
#include "utils.h"
namespace art {
+namespace linker {
// .eh_frame and .debug_frame are almost identical.
// Except for some minor formatting differences, the main difference
@@ -315,4 +316,5 @@ size_t ElfWriterQuick<ElfTypes>::GetLoadedSize() {
template class ElfWriterQuick<ElfTypes32>;
template class ElfWriterQuick<ElfTypes64>;
+} // namespace linker
} // namespace art
diff --git a/compiler/elf_writer_quick.h b/dex2oat/linker/elf_writer_quick.h
index 3d5dd39a66..e20957c5ce 100644
--- a/compiler/elf_writer_quick.h
+++ b/dex2oat/linker/elf_writer_quick.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_COMPILER_ELF_WRITER_QUICK_H_
-#define ART_COMPILER_ELF_WRITER_QUICK_H_
+#ifndef ART_DEX2OAT_LINKER_ELF_WRITER_QUICK_H_
+#define ART_DEX2OAT_LINKER_ELF_WRITER_QUICK_H_
#include <memory>
@@ -28,11 +28,14 @@ namespace art {
class CompilerOptions;
class InstructionSetFeatures;
+namespace linker {
+
std::unique_ptr<ElfWriter> CreateElfWriterQuick(InstructionSet instruction_set,
const InstructionSetFeatures* features,
const CompilerOptions* compiler_options,
File* elf_file);
+} // namespace linker
} // namespace art
-#endif // ART_COMPILER_ELF_WRITER_QUICK_H_
+#endif // ART_DEX2OAT_LINKER_ELF_WRITER_QUICK_H_
diff --git a/compiler/elf_writer_test.cc b/dex2oat/linker/elf_writer_test.cc
index 984e9ee4e9..9f8ed77526 100644
--- a/compiler/elf_writer_test.cc
+++ b/dex2oat/linker/elf_writer_test.cc
@@ -18,14 +18,15 @@
#include "base/unix_file/fd_file.h"
#include "common_compiler_test.h"
-#include "elf_builder.h"
#include "elf_file.h"
#include "elf_file_impl.h"
#include "elf_writer_quick.h"
+#include "linker/elf_builder.h"
#include "oat.h"
#include "utils.h"
namespace art {
+namespace linker {
class ElfWriterTest : public CommonCompilerTest {
protected:
@@ -161,4 +162,5 @@ TEST_F(ElfWriterTest, EncodeDecodeOatPatches) {
}
}
+} // namespace linker
} // namespace art
diff --git a/compiler/image_test.cc b/dex2oat/linker/image_test.cc
index 7b623dd979..ab6e7a875a 100644
--- a/compiler/image_test.cc
+++ b/dex2oat/linker/image_test.cc
@@ -24,6 +24,7 @@
#include "thread.h"
namespace art {
+namespace linker {
TEST_F(ImageTest, TestImageLayout) {
std::vector<size_t> image_sizes;
@@ -153,4 +154,5 @@ TEST_F(ImageTest, TestDefaultMethods) {
ASSERT_TRUE(class_linker_->IsQuickToInterpreterBridge(code));
}
+} // namespace linker
} // namespace art
diff --git a/compiler/image_test.h b/dex2oat/linker/image_test.h
index f1adeddb69..71f1fa607e 100644
--- a/compiler/image_test.h
+++ b/dex2oat/linker/image_test.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_COMPILER_IMAGE_TEST_H_
-#define ART_COMPILER_IMAGE_TEST_H_
+#ifndef ART_DEX2OAT_LINKER_IMAGE_TEST_H_
+#define ART_DEX2OAT_LINKER_IMAGE_TEST_H_
#include "image.h"
@@ -33,11 +33,11 @@
#include "debug/method_debug_info.h"
#include "dex/quick_compiler_callbacks.h"
#include "driver/compiler_options.h"
-#include "elf_writer.h"
-#include "elf_writer_quick.h"
#include "gc/space/image_space.h"
#include "image_writer.h"
#include "linker/buffered_output_stream.h"
+#include "linker/elf_writer.h"
+#include "linker/elf_writer_quick.h"
#include "linker/file_output_stream.h"
#include "linker/multi_oat_relative_patcher.h"
#include "lock_word.h"
@@ -48,6 +48,7 @@
#include "utils.h"
namespace art {
+namespace linker {
static const uintptr_t kRequestedImageBase = ART_BASE_ADDRESS;
@@ -494,7 +495,7 @@ inline void ImageTest::TestWriteRead(ImageHeader::StorageMode storage_mode) {
}
}
-
+} // namespace linker
} // namespace art
-#endif // ART_COMPILER_IMAGE_TEST_H_
+#endif // ART_DEX2OAT_LINKER_IMAGE_TEST_H_
diff --git a/compiler/image_write_read_test.cc b/dex2oat/linker/image_write_read_test.cc
index 32c0b06766..30996b562b 100644
--- a/compiler/image_write_read_test.cc
+++ b/dex2oat/linker/image_write_read_test.cc
@@ -17,6 +17,7 @@
#include "image_test.h"
namespace art {
+namespace linker {
TEST_F(ImageTest, WriteReadUncompressed) {
TestWriteRead(ImageHeader::kStorageModeUncompressed);
@@ -30,4 +31,5 @@ TEST_F(ImageTest, WriteReadLZ4HC) {
TestWriteRead(ImageHeader::kStorageModeLZ4HC);
}
+} // namespace linker
} // namespace art
diff --git a/compiler/image_writer.cc b/dex2oat/linker/image_writer.cc
index 4ffe238cc7..ee568e80ea 100644
--- a/compiler/image_writer.cc
+++ b/dex2oat/linker/image_writer.cc
@@ -38,7 +38,6 @@
#include "driver/compiler_driver.h"
#include "elf_file.h"
#include "elf_utils.h"
-#include "elf_writer.h"
#include "gc/accounting/card_table-inl.h"
#include "gc/accounting/heap_bitmap.h"
#include "gc/accounting/space_bitmap-inl.h"
@@ -82,6 +81,7 @@ using ::art::mirror::ObjectArray;
using ::art::mirror::String;
namespace art {
+namespace linker {
// Separate objects into multiple bins to optimize dirty memory use.
static constexpr bool kBinObjects = true;
@@ -2835,5 +2835,5 @@ void ImageWriter::CopyAndFixupPointer(void** target, void* value) {
}
}
-
+} // namespace linker
} // namespace art
diff --git a/compiler/image_writer.h b/dex2oat/linker/image_writer.h
index 2fc394e862..bdea0009a6 100644
--- a/compiler/image_writer.h
+++ b/dex2oat/linker/image_writer.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_COMPILER_IMAGE_WRITER_H_
-#define ART_COMPILER_IMAGE_WRITER_H_
+#ifndef ART_DEX2OAT_LINKER_IMAGE_WRITER_H_
+#define ART_DEX2OAT_LINKER_IMAGE_WRITER_H_
#include <stdint.h>
#include "base/memory_tool.h"
@@ -66,6 +66,8 @@ class ImtConflictTable;
static constexpr int kInvalidFd = -1;
+namespace linker {
+
// Write a Space built during compilation for use during execution.
class ImageWriter FINAL {
public:
@@ -620,6 +622,7 @@ class ImageWriter FINAL {
DISALLOW_COPY_AND_ASSIGN(ImageWriter);
};
+} // namespace linker
} // namespace art
-#endif // ART_COMPILER_IMAGE_WRITER_H_
+#endif // ART_DEX2OAT_LINKER_IMAGE_WRITER_H_
diff --git a/compiler/linker/multi_oat_relative_patcher.cc b/dex2oat/linker/multi_oat_relative_patcher.cc
index 4ae75d61c7..178a78f0bb 100644
--- a/compiler/linker/multi_oat_relative_patcher.cc
+++ b/dex2oat/linker/multi_oat_relative_patcher.cc
@@ -26,8 +26,7 @@ namespace linker {
MultiOatRelativePatcher::MultiOatRelativePatcher(InstructionSet instruction_set,
const InstructionSetFeatures* features)
: method_offset_map_(),
- relative_patcher_(
- linker::RelativePatcher::Create(instruction_set, features, &method_offset_map_)),
+ relative_patcher_(RelativePatcher::Create(instruction_set, features, &method_offset_map_)),
adjustment_(0u),
instruction_set_(instruction_set),
start_size_code_alignment_(0u),
diff --git a/compiler/linker/multi_oat_relative_patcher.h b/dex2oat/linker/multi_oat_relative_patcher.h
index 02cd4b0118..6683366467 100644
--- a/compiler/linker/multi_oat_relative_patcher.h
+++ b/dex2oat/linker/multi_oat_relative_patcher.h
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-#ifndef ART_COMPILER_LINKER_MULTI_OAT_RELATIVE_PATCHER_H_
-#define ART_COMPILER_LINKER_MULTI_OAT_RELATIVE_PATCHER_H_
+#ifndef ART_DEX2OAT_LINKER_MULTI_OAT_RELATIVE_PATCHER_H_
+#define ART_DEX2OAT_LINKER_MULTI_OAT_RELATIVE_PATCHER_H_
#include "arch/instruction_set.h"
#include "debug/method_debug_info.h"
#include "method_reference.h"
-#include "relative_patcher.h"
+#include "linker/relative_patcher.h"
#include "safe_map.h"
namespace art {
@@ -131,8 +131,8 @@ class MultiOatRelativePatcher FINAL {
private:
// Map method reference to assigned offset.
- // Wrap the map in a class implementing linker::RelativePatcherTargetProvider.
- class MethodOffsetMap : public linker::RelativePatcherTargetProvider {
+ // Wrap the map in a class implementing RelativePatcherTargetProvider.
+ class MethodOffsetMap : public RelativePatcherTargetProvider {
public:
std::pair<bool, uint32_t> FindMethodOffset(MethodReference ref) OVERRIDE;
SafeMap<MethodReference, uint32_t> map;
@@ -155,4 +155,4 @@ class MultiOatRelativePatcher FINAL {
} // namespace linker
} // namespace art
-#endif // ART_COMPILER_LINKER_MULTI_OAT_RELATIVE_PATCHER_H_
+#endif // ART_DEX2OAT_LINKER_MULTI_OAT_RELATIVE_PATCHER_H_
diff --git a/compiler/linker/multi_oat_relative_patcher_test.cc b/dex2oat/linker/multi_oat_relative_patcher_test.cc
index 5c359dc9ca..1b2d43e4c5 100644
--- a/compiler/linker/multi_oat_relative_patcher_test.cc
+++ b/dex2oat/linker/multi_oat_relative_patcher_test.cc
@@ -19,7 +19,7 @@
#include "compiled_method.h"
#include "debug/method_debug_info.h"
#include "gtest/gtest.h"
-#include "vector_output_stream.h"
+#include "linker/vector_output_stream.h"
namespace art {
namespace linker {
diff --git a/compiler/oat_writer.cc b/dex2oat/linker/oat_writer.cc
index ce1b755a9d..51c2a037a0 100644
--- a/compiler/oat_writer.cc
+++ b/dex2oat/linker/oat_writer.cc
@@ -61,6 +61,7 @@
#include "zip_archive.h"
namespace art {
+namespace linker {
namespace { // anonymous namespace
@@ -600,7 +601,7 @@ bool OatWriter::WriteAndOpenDexFiles(
return true;
}
-void OatWriter::PrepareLayout(linker::MultiOatRelativePatcher* relative_patcher) {
+void OatWriter::PrepareLayout(MultiOatRelativePatcher* relative_patcher) {
CHECK(write_state_ == WriteState::kPrepareLayout);
relative_patcher_ = relative_patcher;
@@ -3629,4 +3630,5 @@ const uint8_t* OatWriter::LookupBootImageClassTableSlot(const DexFile& dex_file,
UNREACHABLE();
}
+} // namespace linker
} // namespace art
diff --git a/compiler/oat_writer.h b/dex2oat/linker/oat_writer.h
index ef0ce52743..a93dd23493 100644
--- a/compiler/oat_writer.h
+++ b/dex2oat/linker/oat_writer.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_COMPILER_OAT_WRITER_H_
-#define ART_COMPILER_OAT_WRITER_H_
+#ifndef ART_DEX2OAT_LINKER_OAT_WRITER_H_
+#define ART_DEX2OAT_LINKER_OAT_WRITER_H_
#include <stdint.h>
#include <cstddef>
@@ -23,7 +23,7 @@
#include "base/array_ref.h"
#include "base/dchecked_vector.h"
-#include "linker/relative_patcher.h" // For linker::RelativePatcherTargetProvider.
+#include "linker/relative_patcher.h" // For RelativePatcherTargetProvider.
#include "mem_map.h"
#include "method_reference.h"
#include "mirror/class.h"
@@ -38,9 +38,7 @@ namespace art {
class BitVector;
class CompiledMethod;
class CompilerDriver;
-class ImageWriter;
class ProfileCompilationInfo;
-class OutputStream;
class TimingLogger;
class TypeLookupTable;
class VdexFile;
@@ -50,14 +48,16 @@ namespace debug {
struct MethodDebugInfo;
} // namespace debug
-namespace linker {
-class MultiOatRelativePatcher;
-} // namespace linker
-
namespace verifier {
- class VerifierDeps;
+class VerifierDeps;
} // namespace verifier
+namespace linker {
+
+class ImageWriter;
+class MultiOatRelativePatcher;
+class OutputStream;
+
// OatHeader variable length with count of D OatDexFiles
//
// TypeLookupTable[0] one descriptor to class def index hash table for each OatDexFile.
@@ -183,7 +183,7 @@ class OatWriter {
}
// Prepare layout of remaining data.
- void PrepareLayout(linker::MultiOatRelativePatcher* relative_patcher);
+ void PrepareLayout(MultiOatRelativePatcher* relative_patcher);
// Write the rest of .rodata section (ClassOffsets[], OatClass[], maps).
bool WriteRodata(OutputStream* out);
// Write the code to the .text section.
@@ -478,7 +478,7 @@ class OatWriter {
uint32_t size_method_bss_mappings_;
// The helper for processing relative patches is external so that we can patch across oat files.
- linker::MultiOatRelativePatcher* relative_patcher_;
+ MultiOatRelativePatcher* relative_patcher_;
// The locations of absolute patches relative to the start of the executable section.
dchecked_vector<uintptr_t> absolute_patch_locations_;
@@ -489,6 +489,7 @@ class OatWriter {
DISALLOW_COPY_AND_ASSIGN(OatWriter);
};
+} // namespace linker
} // namespace art
-#endif // ART_COMPILER_OAT_WRITER_H_
+#endif // ART_DEX2OAT_LINKER_OAT_WRITER_H_
diff --git a/compiler/oat_test.cc b/dex2oat/linker/oat_writer_test.cc
index 6f8904979d..0600ceb12d 100644
--- a/compiler/oat_test.cc
+++ b/dex2oat/linker/oat_writer_test.cc
@@ -30,10 +30,10 @@
#include "dex/verification_results.h"
#include "driver/compiler_driver.h"
#include "driver/compiler_options.h"
-#include "elf_writer.h"
-#include "elf_writer_quick.h"
#include "entrypoints/quick/quick_entrypoints.h"
#include "linker/buffered_output_stream.h"
+#include "linker/elf_writer.h"
+#include "linker/elf_writer_quick.h"
#include "linker/file_output_stream.h"
#include "linker/multi_oat_relative_patcher.h"
#include "linker/vector_output_stream.h"
@@ -46,6 +46,7 @@
#include "utils/test_dex_file_builder.h"
namespace art {
+namespace linker {
NO_RETURN static void Usage(const char* fmt, ...) {
va_list ap;
@@ -212,8 +213,8 @@ class OatTest : public CommonCompilerTest {
ScopedObjectAccess soa(Thread::Current());
class_linker->RegisterDexFile(*dex_file, nullptr);
}
- linker::MultiOatRelativePatcher patcher(compiler_driver_->GetInstructionSet(),
- instruction_set_features_.get());
+ MultiOatRelativePatcher patcher(compiler_driver_->GetInstructionSet(),
+ instruction_set_features_.get());
oat_writer.Initialize(compiler_driver_.get(), nullptr, dex_files);
oat_writer.PrepareLayout(&patcher);
size_t rodata_size = oat_writer.GetOatHeader().GetExecutableOffset();
@@ -867,4 +868,5 @@ TEST_F(OatTest, UpdateChecksum) {
EXPECT_EQ(216138397U, oat_header->GetChecksum());
}
+} // namespace linker
} // namespace art
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index 7b11258a89..36bd4bcc24 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -41,7 +41,6 @@
#include "dex_file-inl.h"
#include "dex_instruction-inl.h"
#include "disassembler.h"
-#include "elf_builder.h"
#include "gc/accounting/space_bitmap-inl.h"
#include "gc/space/image_space.h"
#include "gc/space/large_object_space.h"
@@ -51,6 +50,7 @@
#include "indenter.h"
#include "interpreter/unstarted_runtime.h"
#include "linker/buffered_output_stream.h"
+#include "linker/elf_builder.h"
#include "linker/file_output_stream.h"
#include "mirror/array-inl.h"
#include "mirror/class-inl.h"
@@ -133,9 +133,10 @@ class OatSymbolizer FINAL {
if (elf_file == nullptr) {
return false;
}
- std::unique_ptr<BufferedOutputStream> output_stream =
- std::make_unique<BufferedOutputStream>(std::make_unique<FileOutputStream>(elf_file.get()));
- builder_.reset(new ElfBuilder<ElfTypes>(isa, features.get(), output_stream.get()));
+ std::unique_ptr<linker::BufferedOutputStream> output_stream =
+ std::make_unique<linker::BufferedOutputStream>(
+ std::make_unique<linker::FileOutputStream>(elf_file.get()));
+ builder_.reset(new linker::ElfBuilder<ElfTypes>(isa, features.get(), output_stream.get()));
builder_->Start();
@@ -326,7 +327,7 @@ class OatSymbolizer FINAL {
private:
const OatFile* oat_file_;
- std::unique_ptr<ElfBuilder<ElfTypes> > builder_;
+ std::unique_ptr<linker::ElfBuilder<ElfTypes>> builder_;
std::vector<debug::MethodDebugInfo> method_debug_infos_;
std::unordered_set<uint32_t> seen_offsets_;
const std::string output_name_;
diff --git a/runtime/arch/arm/asm_support_arm.h b/runtime/arch/arm/asm_support_arm.h
index 3d85872617..ac17303cf9 100644
--- a/runtime/arch/arm/asm_support_arm.h
+++ b/runtime/arch/arm/asm_support_arm.h
@@ -56,7 +56,4 @@
#define BAKER_MARK_INTROSPECTION_GC_ROOT_LDR_WIDE_OFFSET -8
#define BAKER_MARK_INTROSPECTION_GC_ROOT_LDR_NARROW_OFFSET -6
-// Flag for enabling R4 optimization in arm runtime
-// #define ARM_R4_SUSPEND_FLAG
-
#endif // ART_RUNTIME_ARCH_ARM_ASM_SUPPORT_ARM_H_
diff --git a/runtime/arch/arm/quick_entrypoints_arm.S b/runtime/arch/arm/quick_entrypoints_arm.S
index ab9ca840ef..6ff8dd60b8 100644
--- a/runtime/arch/arm/quick_entrypoints_arm.S
+++ b/runtime/arch/arm/quick_entrypoints_arm.S
@@ -571,10 +571,6 @@ ENTRY art_quick_invoke_stub_internal
add ip, ip, #4 @ skip r0
ldm ip, {r1-r3} @ copy r1 - r3
-#ifdef ARM_R4_SUSPEND_FLAG
- mov r4, #SUSPEND_CHECK_INTERVAL @ reset r4 to suspend check interval
-#endif
-
REFRESH_MARKING_REGISTER
ldr ip, [r0, #ART_METHOD_QUICK_CODE_OFFSET_32] @ get pointer to the code
@@ -1533,14 +1529,6 @@ GENERATE_ALLOC_ARRAY_TLAB art_quick_alloc_array_resolved64_tlab, artAllocArrayFr
*/
.extern artTestSuspendFromCode
ENTRY art_quick_test_suspend
-#ifdef ARM_R4_SUSPEND_FLAG
- ldrh rSUSPEND, [rSELF, #THREAD_FLAGS_OFFSET]
- cbnz rSUSPEND, 1f @ check Thread::Current()->suspend_count_ == 0
- mov rSUSPEND, #SUSPEND_CHECK_INTERVAL @ reset rSUSPEND to SUSPEND_CHECK_INTERVAL
- bx lr @ return if suspend_count_ == 0
-1:
- mov rSUSPEND, #SUSPEND_CHECK_INTERVAL @ reset rSUSPEND to SUSPEND_CHECK_INTERVAL
-#endif
SETUP_SAVE_EVERYTHING_FRAME r0, RUNTIME_SAVE_EVERYTHING_FOR_SUSPEND_CHECK_METHOD_OFFSET @ save everything for GC stack crawl
mov r0, rSELF
bl artTestSuspendFromCode @ (Thread*)
diff --git a/runtime/arch/mips/quick_entrypoints_mips.S b/runtime/arch/mips/quick_entrypoints_mips.S
index 74e0a7ae25..f6204bd8b6 100644
--- a/runtime/arch/mips/quick_entrypoints_mips.S
+++ b/runtime/arch/mips/quick_entrypoints_mips.S
@@ -971,7 +971,6 @@ ENTRY art_quick_invoke_stub
move $fp, $sp # save sp in fp
.cfi_def_cfa_register 30
move $s1, $a3 # move managed thread pointer into s1
- addiu $s0, $zero, SUSPEND_CHECK_INTERVAL # reset s0 to suspend check interval
addiu $t0, $a2, 4 # create space for ArtMethod* in frame.
subu $t0, $sp, $t0 # reserve & align *stack* to 16 bytes:
srl $t0, $t0, 4 # native calling convention only aligns to 8B,
@@ -1131,7 +1130,6 @@ ENTRY art_quick_invoke_static_stub
move $fp, $sp # save sp in fp
.cfi_def_cfa_register 30
move $s1, $a3 # move managed thread pointer into s1
- addiu $s0, $zero, SUSPEND_CHECK_INTERVAL # reset s0 to suspend check interval
addiu $t0, $a2, 4 # create space for ArtMethod* in frame.
subu $t0, $sp, $t0 # reserve & align *stack* to 16 bytes:
srl $t0, $t0, 4 # native calling convention only aligns to 8B,
@@ -2061,12 +2059,6 @@ ONE_ARG_SAVE_EVERYTHING_DOWNCALL art_quick_initialize_type_and_verify_access, ar
*/
.extern artTestSuspendFromCode
ENTRY_NO_GP art_quick_test_suspend
- lh rSUSPEND, THREAD_FLAGS_OFFSET(rSELF)
- bnez rSUSPEND, 1f
- addiu rSUSPEND, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL
- jalr $zero, $ra
- nop
-1:
SETUP_SAVE_EVERYTHING_FRAME RUNTIME_SAVE_EVERYTHING_FOR_SUSPEND_CHECK_METHOD_OFFSET
# save everything for stack crawl
la $t9, artTestSuspendFromCode
diff --git a/runtime/arch/mips64/quick_entrypoints_mips64.S b/runtime/arch/mips64/quick_entrypoints_mips64.S
index 1817502c77..d4ad275f35 100644
--- a/runtime/arch/mips64/quick_entrypoints_mips64.S
+++ b/runtime/arch/mips64/quick_entrypoints_mips64.S
@@ -1052,7 +1052,6 @@ ENTRY_NO_GP art_quick_invoke_stub
sd $a4, 0($sp)
.cfi_rel_offset 8, 0
- daddiu $s0, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL
move $s1, $a3 # move managed thread pointer into s1 (rSELF)
move $s8, $sp # save sp in s8 (fp)
@@ -1155,7 +1154,6 @@ ENTRY_NO_GP art_quick_invoke_static_stub
sd $a4, 0($sp)
.cfi_rel_offset 8, 0
- daddiu $s0, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL
move $s1, $a3 # move managed thread pointer into s1 (rSELF)
move $s8, $sp # save sp in s8 (fp)
@@ -1975,12 +1973,6 @@ ONE_ARG_SAVE_EVERYTHING_DOWNCALL art_quick_initialize_type_and_verify_access, ar
*/
.extern artTestSuspendFromCode
ENTRY_NO_GP art_quick_test_suspend
- lh rSUSPEND, THREAD_FLAGS_OFFSET(rSELF)
- bne rSUSPEND, $zero, 1f
- daddiu rSUSPEND, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL
- jalr $zero, $ra
- nop
-1:
SETUP_SAVE_EVERYTHING_FRAME RUNTIME_SAVE_EVERYTHING_FOR_SUSPEND_CHECK_METHOD_OFFSET
# save everything for stack crawl
jal artTestSuspendFromCode # (Thread*)
diff --git a/runtime/asm_support.h b/runtime/asm_support.h
index a4e34592f5..e18f11080f 100644
--- a/runtime/asm_support.h
+++ b/runtime/asm_support.h
@@ -20,20 +20,6 @@
#include "heap_poisoning.h"
#include "read_barrier_config.h"
-#if defined(__arm__) || defined(__mips__)
-// In quick code for ARM and MIPS we make poor use of registers and perform frequent suspend
-// checks in the event of loop back edges. The SUSPEND_CHECK_INTERVAL constant is loaded into a
-// register at the point of an up-call or after handling a suspend check. It reduces the number of
-// loads of the TLS suspend check value by the given amount (turning it into a decrement and compare
-// of a register). This increases the time for a thread to respond to requests from GC and the
-// debugger, damaging GC performance and creating other unwanted artifacts. For example, this count
-// has the effect of making loops and Java code look cold in profilers, where the count is reset
-// impacts where samples will occur. Reducing the count as much as possible improves profiler
-// accuracy in tools like traceview.
-// TODO: get a compiler that can do a proper job of loop optimization and remove this.
-#define SUSPEND_CHECK_INTERVAL 96
-#endif
-
// To generate tests related to the constants in this header, either define ADD_TEST_EQ before
// including, or use asm_support_check.h.
#ifndef ADD_TEST_EQ // Allow #include-r to replace with their own.
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 2f92da36b4..f97433c0b7 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -43,6 +43,13 @@ namespace space {
class ImageSpace;
} // namespace space
} // namespace gc
+
+namespace linker {
+ struct CompilationHelper;
+ class ImageWriter;
+ class OatWriter;
+} // namespace linker
+
namespace mirror {
class ClassLoader;
class DexCache;
@@ -1276,12 +1283,12 @@ class ClassLinker {
class FindVirtualMethodHolderVisitor;
friend class AppImageClassLoadersAndDexCachesHelper;
- friend struct CompilationHelper; // For Compile in ImageTest.
friend class ImageDumper; // for DexLock
- friend class ImageWriter; // for GetClassRoots
+ friend struct linker::CompilationHelper; // For Compile in ImageTest.
+ friend class linker::ImageWriter; // for GetClassRoots
+ friend class linker::OatWriter; // for boot image string/class table slot address lookup.
friend class JniCompilerTest; // for GetRuntimeQuickGenericJniStub
friend class JniInternalTest; // for GetRuntimeQuickGenericJniStub
- friend class OatWriter; // for boot image string/class table slot address lookup.
friend class VMClassLoader; // for LookupClass and FindClassInBaseDexClassLoader.
ART_FRIEND_TEST(ClassLinkerTest, RegisterDexFileName); // for DexLock, and RegisterDexFileLocked
ART_FRIEND_TEST(mirror::DexCacheMethodHandlesTest, Open); // for AllocDexCache
diff --git a/runtime/class_table.h b/runtime/class_table.h
index 0ffe93e051..744c010218 100644
--- a/runtime/class_table.h
+++ b/runtime/class_table.h
@@ -32,6 +32,14 @@ namespace art {
class OatFile;
+namespace linker {
+class ImageWriter;
+} // namespace linker
+
+namespace linker {
+class OatWriter;
+} // namespace linker
+
namespace mirror {
class Class;
class ClassLoader;
@@ -286,8 +294,8 @@ class ClassTable {
// Keep track of oat files with GC roots associated with dex caches in `strong_roots_`.
std::vector<const OatFile*> oat_files_ GUARDED_BY(lock_);
- friend class ImageWriter; // for InsertWithoutLocks.
- friend class OatWriter; // for boot class TableSlot address lookup.
+ friend class linker::ImageWriter; // for InsertWithoutLocks.
+ friend class linker::OatWriter; // for boot class TableSlot address lookup.
};
} // namespace art
diff --git a/runtime/dex_instruction.cc b/runtime/dex_instruction.cc
index b2267e5573..99fe53bb71 100644
--- a/runtime/dex_instruction.cc
+++ b/runtime/dex_instruction.cc
@@ -349,17 +349,19 @@ std::string Instruction::DumpString(const DexFile* file) const {
case k35c: {
uint32_t arg[kMaxVarArgRegs];
GetVarArgs(arg);
+ auto DumpArgs = [&](size_t count) {
+ for (size_t i = 0; i < count; ++i) {
+ if (i != 0) {
+ os << ", ";
+ }
+ os << "v" << arg[i];
+ }
+ };
switch (Opcode()) {
case FILLED_NEW_ARRAY:
{
- const int32_t a = VRegA_35c();
os << opcode << " {";
- for (int i = 0; i < a; ++i) {
- if (i > 0) {
- os << ", ";
- }
- os << "v" << arg[i];
- }
+ DumpArgs(VRegA_35c());
os << "}, type@" << VRegB_35c();
}
break;
@@ -372,12 +374,7 @@ std::string Instruction::DumpString(const DexFile* file) const {
if (file != nullptr) {
os << opcode << " {";
uint32_t method_idx = VRegB_35c();
- for (size_t i = 0; i < VRegA_35c(); ++i) {
- if (i != 0) {
- os << ", ";
- }
- os << "v" << arg[i];
- }
+ DumpArgs(VRegA_35c());
os << "}, " << file->PrettyMethod(method_idx) << " // method@" << method_idx;
break;
}
@@ -386,12 +383,7 @@ std::string Instruction::DumpString(const DexFile* file) const {
if (file != nullptr) {
os << opcode << " {";
uint32_t method_idx = VRegB_35c();
- for (size_t i = 0; i < VRegA_35c(); ++i) {
- if (i != 0) {
- os << ", ";
- }
- os << "v" << arg[i];
- }
+ DumpArgs(VRegA_35c());
os << "}, // vtable@" << method_idx;
break;
}
@@ -400,19 +392,15 @@ std::string Instruction::DumpString(const DexFile* file) const {
if (file != nullptr) {
os << opcode << " {";
uint32_t call_site_idx = VRegB_35c();
- for (size_t i = 0; i < VRegA_35c(); ++i) {
- if (i != 0) {
- os << ", ";
- }
- os << "v" << arg[i];
- }
+ DumpArgs(VRegA_35c());
os << "}, // call_site@" << call_site_idx;
break;
}
FALLTHROUGH_INTENDED;
default:
- os << opcode << " {v" << arg[0] << ", v" << arg[1] << ", v" << arg[2]
- << ", v" << arg[3] << ", v" << arg[4] << "}, thing@" << VRegB_35c();
+ os << opcode << " {";
+ DumpArgs(VRegA_35c());
+ os << "}, thing@" << VRegB_35c();
break;
}
break;
diff --git a/runtime/dex_instruction_test.cc b/runtime/dex_instruction_test.cc
index 95e4181a8e..3f7ac57cef 100644
--- a/runtime/dex_instruction_test.cc
+++ b/runtime/dex_instruction_test.cc
@@ -131,4 +131,41 @@ TEST(Instruction, PropertiesOf4rcc) {
ASSERT_FALSE(ins->HasVarArgs());
}
+static void Build35c(uint16_t* out,
+ Instruction::Code code,
+ uint16_t method_idx,
+ std::vector<uint16_t> args) {
+ out[0] = 0;
+ out[0] |= (args.size() << 12);
+ out[0] |= static_cast<uint16_t>(code);
+ out[1] = method_idx;
+ size_t i = 0;
+ out[2] = 0;
+ for (; i < 4 && i < args.size(); ++i) {
+ out[2] |= args[i] << (i * 4);
+ }
+ if (args.size() == 5) {
+ out[0] |= args[4] << 8;
+ }
+}
+
+static std::string DumpInst35c(Instruction::Code code,
+ uint16_t method_idx,
+ std::vector<uint16_t> args) {
+ uint16_t inst[6] = {};
+ Build35c(inst, code, method_idx, args);
+ return Instruction::At(inst)->DumpString(nullptr);
+}
+
+TEST(Instruction, DumpString) {
+ EXPECT_EQ(DumpInst35c(Instruction::FILLED_NEW_ARRAY, 1234, {3, 2}),
+ "filled-new-array {v3, v2}, type@1234");
+ EXPECT_EQ(DumpInst35c(Instruction::INVOKE_VIRTUAL, 1234, {3, 2, 1, 5, 6}),
+ "invoke-virtual {v3, v2, v1, v5, v6}, thing@1234");
+ EXPECT_EQ(DumpInst35c(Instruction::INVOKE_VIRTUAL_QUICK, 1234, {3, 2, 1, 5}),
+ "invoke-virtual-quick {v3, v2, v1, v5}, thing@1234");
+ EXPECT_EQ(DumpInst35c(Instruction::INVOKE_CUSTOM, 1234, {3, 2, 1}),
+ "invoke-custom {v3, v2, v1}, thing@1234");
+}
+
} // namespace art
diff --git a/runtime/globals.h b/runtime/globals.h
index f10c7805c5..53932fd8cd 100644
--- a/runtime/globals.h
+++ b/runtime/globals.h
@@ -20,8 +20,6 @@
#include <stddef.h>
#include <stdint.h>
-#include "heap_poisoning.h"
-
namespace art {
static constexpr size_t KB = 1024;
diff --git a/runtime/image.h b/runtime/image.h
index da043335ff..3844186a9b 100644
--- a/runtime/image.h
+++ b/runtime/image.h
@@ -29,6 +29,10 @@ namespace art {
class ArtField;
class ArtMethod;
+namespace linker {
+class ImageWriter;
+} // namespace linker
+
class ObjectVisitor {
public:
virtual ~ObjectVisitor() {}
@@ -442,7 +446,7 @@ class PACKED(4) ImageHeader {
// is the compressed size in the file.
uint32_t data_size_;
- friend class ImageWriter;
+ friend class linker::ImageWriter;
};
std::ostream& operator<<(std::ostream& os, const ImageHeader::ImageMethod& policy);
diff --git a/runtime/intern_table.h b/runtime/intern_table.h
index 3e3abbdda2..05f2794b38 100644
--- a/runtime/intern_table.h
+++ b/runtime/intern_table.h
@@ -38,6 +38,10 @@ class ImageSpace;
enum VisitRootFlags : uint8_t;
+namespace linker {
+class OatWriter;
+} // namespace linker
+
namespace mirror {
class String;
} // namespace mirror
@@ -223,7 +227,7 @@ class InternTable {
// modifying the zygote intern table. The back of table is modified when strings are interned.
std::vector<UnorderedSet> tables_;
- friend class OatWriter; // for boot image string table slot address lookup.
+ friend class linker::OatWriter; // for boot image string table slot address lookup.
ART_FRIEND_TEST(InternTableTest, CrossHash);
};
@@ -283,7 +287,7 @@ class InternTable {
// Weak root state, used for concurrent system weak processing and more.
gc::WeakRootState weak_root_state_ GUARDED_BY(Locks::intern_table_lock_);
- friend class OatWriter; // for boot image string table slot address lookup.
+ friend class linker::OatWriter; // for boot image string table slot address lookup.
friend class Transaction;
ART_FRIEND_TEST(InternTableTest, CrossHash);
DISALLOW_COPY_AND_ASSIGN(InternTable);
diff --git a/runtime/java_vm_ext.cc b/runtime/java_vm_ext.cc
index 267f9fdc99..1593577625 100644
--- a/runtime/java_vm_ext.cc
+++ b/runtime/java_vm_ext.cc
@@ -836,7 +836,7 @@ bool JavaVMExt::LoadNativeLibrary(JNIEnv* env,
StringAppendF(error_msg, "Shared library \"%s\" already opened by "
"ClassLoader %p; can't open in ClassLoader %p",
path.c_str(), library->GetClassLoader(), class_loader);
- LOG(WARNING) << error_msg;
+ LOG(WARNING) << *error_msg;
return false;
}
VLOG(jni) << "[Shared library \"" << path << "\" already loaded in "
diff --git a/runtime/jit/profile_compilation_info.cc b/runtime/jit/profile_compilation_info.cc
index 57fc4976f7..12fa49ea79 100644
--- a/runtime/jit/profile_compilation_info.cc
+++ b/runtime/jit/profile_compilation_info.cc
@@ -143,8 +143,7 @@ bool ProfileCompilationInfo::AddMethodIndex(MethodHotness::Flag flags, const Met
if (data == nullptr) {
return false;
}
- data->AddMethod(flags, ref.index);
- return true;
+ return data->AddMethod(flags, ref.index);
}
bool ProfileCompilationInfo::AddMethodIndex(MethodHotness::Flag flags,
@@ -158,8 +157,7 @@ bool ProfileCompilationInfo::AddMethodIndex(MethodHotness::Flag flags,
if (data == nullptr) {
return false;
}
- data->AddMethod(flags, method_idx);
- return true;
+ return data->AddMethod(flags, method_idx);
}
bool ProfileCompilationInfo::AddMethods(const std::vector<ProfileMethodInfo>& methods) {
@@ -592,7 +590,14 @@ ProfileCompilationInfo::DexFileData* ProfileCompilationInfo::GetOrAddDexFileData
// This should always be the case since since the cache map is managed by ProfileCompilationInfo.
DCHECK_EQ(profile_key, result->profile_key);
DCHECK_EQ(profile_index, result->profile_index);
- DCHECK_EQ(num_method_ids, result->num_method_ids);
+
+ if (num_method_ids != result->num_method_ids) {
+ // This should not happen... added to help investigating b/65812889.
+ LOG(ERROR) << "num_method_ids mismatch for dex " << profile_key
+ << ", expected=" << num_method_ids
+ << ", actual=" << result->num_method_ids;
+ return nullptr;
+ }
return result;
}
@@ -1342,8 +1347,8 @@ bool ProfileCompilationInfo::AddMethodHotness(const MethodReference& method_ref,
DexFileData* dex_data = GetOrAddDexFileData(method_ref.dex_file);
if (dex_data != nullptr) {
// TODO: Add inline caches.
- dex_data->AddMethod(static_cast<MethodHotness::Flag>(hotness.GetFlags()), method_ref.index);
- return true;
+ return dex_data->AddMethod(
+ static_cast<MethodHotness::Flag>(hotness.GetFlags()), method_ref.index);
}
return false;
}
@@ -1727,7 +1732,12 @@ ProfileCompilationInfo::DexFileData::FindOrAddMethod(uint16_t method_index) {
}
// Mark a method as executed at least once.
-void ProfileCompilationInfo::DexFileData::AddMethod(MethodHotness::Flag flags, size_t index) {
+bool ProfileCompilationInfo::DexFileData::AddMethod(MethodHotness::Flag flags, size_t index) {
+ if (index >= num_method_ids) {
+ LOG(ERROR) << "Invalid method index " << index << ". num_method_ids=" << num_method_ids;
+ return false;
+ }
+
if ((flags & MethodHotness::kFlagStartup) != 0) {
method_bitmap.StoreBit(MethodBitIndex(/*startup*/ true, index), /*value*/ true);
}
@@ -1739,6 +1749,7 @@ void ProfileCompilationInfo::DexFileData::AddMethod(MethodHotness::Flag flags, s
index,
InlineCacheMap(std::less<uint16_t>(), arena_->Adapter(kArenaAllocProfile)));
}
+ return true;
}
ProfileCompilationInfo::MethodHotness ProfileCompilationInfo::DexFileData::GetHotnessInfo(
diff --git a/runtime/jit/profile_compilation_info.h b/runtime/jit/profile_compilation_info.h
index 5c7448fe63..009554c7ca 100644
--- a/runtime/jit/profile_compilation_info.h
+++ b/runtime/jit/profile_compilation_info.h
@@ -290,7 +290,9 @@ class ProfileCompilationInfo {
}
for (Iterator it = index_begin; it != index_end; ++it) {
DCHECK_LT(*it, data->num_method_ids);
- data->AddMethod(flags, *it);
+ if (!data->AddMethod(flags, *it)) {
+ return false;
+ }
}
return true;
}
@@ -444,7 +446,7 @@ class ProfileCompilationInfo {
}
// Mark a method as executed at least once.
- void AddMethod(MethodHotness::Flag flags, size_t index);
+ bool AddMethod(MethodHotness::Flag flags, size_t index);
void MergeBitmap(const DexFileData& other) {
DCHECK_EQ(bitmap_storage.size(), other.bitmap_storage.size());
diff --git a/runtime/mirror/object-inl.h b/runtime/mirror/object-inl.h
index 6eb200d0d3..f1a86e5353 100644
--- a/runtime/mirror/object-inl.h
+++ b/runtime/mirror/object-inl.h
@@ -27,6 +27,7 @@
#include "class_flags.h"
#include "class_linker.h"
#include "dex_cache.h"
+#include "heap_poisoning.h"
#include "lock_word-inl.h"
#include "monitor.h"
#include "obj_ptr-inl.h"
diff --git a/runtime/mirror/object-readbarrier-inl.h b/runtime/mirror/object-readbarrier-inl.h
index f0769409d4..0a956633d4 100644
--- a/runtime/mirror/object-readbarrier-inl.h
+++ b/runtime/mirror/object-readbarrier-inl.h
@@ -20,6 +20,7 @@
#include "object.h"
#include "atomic.h"
+#include "heap_poisoning.h"
#include "lock_word-inl.h"
#include "object_reference-inl.h"
#include "read_barrier.h"
diff --git a/runtime/mirror/object_reference.h b/runtime/mirror/object_reference.h
index c62ee6cb61..7fd9c71b24 100644
--- a/runtime/mirror/object_reference.h
+++ b/runtime/mirror/object_reference.h
@@ -20,6 +20,7 @@
#include "atomic.h"
#include "base/mutex.h" // For Locks::mutator_lock_.
#include "globals.h"
+#include "heap_poisoning.h"
#include "obj_ptr.h"
namespace art {
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index 791af94bd3..e4ad55dda1 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -4007,13 +4007,10 @@ ArtMethod* MethodVerifier::VerifyInvocationArgsFromIterator(
/* caught by static verifier */
DCHECK(is_range || expected_args <= 5);
- // TODO(oth): Enable this path for invoke-polymorphic when b/33099829 is resolved.
- if (method_type != METHOD_POLYMORPHIC) {
- if (expected_args > code_item_->outs_size_) {
- Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "invalid argument count (" << expected_args
- << ") exceeds outsSize (" << code_item_->outs_size_ << ")";
- return nullptr;
- }
+ if (expected_args > code_item_->outs_size_) {
+ Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "invalid argument count (" << expected_args
+ << ") exceeds outsSize (" << code_item_->outs_size_ << ")";
+ return nullptr;
}
/*