summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/debug/elf_debug_writer.cc12
-rw-r--r--compiler/debug/elf_debug_writer.h7
-rw-r--r--compiler/jit/jit_compiler.cc24
-rw-r--r--compiler/jit/jit_compiler.h5
-rw-r--r--compiler/optimizing/optimizing_compiler.cc18
5 files changed, 35 insertions, 31 deletions
diff --git a/compiler/debug/elf_debug_writer.cc b/compiler/debug/elf_debug_writer.cc
index da3230f8ce..cf7254b105 100644
--- a/compiler/debug/elf_debug_writer.cc
+++ b/compiler/debug/elf_debug_writer.cc
@@ -34,6 +34,7 @@
#include "elf/elf_debug_reader.h"
#include "elf/elf_utils.h"
#include "elf/xz_utils.h"
+#include "jit/debugger_interface.h"
#include "oat.h"
#include "stream/vector_output_stream.h"
@@ -227,15 +228,14 @@ std::vector<uint8_t> MakeElfFileForJIT(
// Combine several mini-debug-info ELF files into one, while filtering some symbols.
std::vector<uint8_t> PackElfFileForJIT(
- InstructionSet isa,
- const InstructionSetFeatures* features ATTRIBUTE_UNUSED,
- std::vector<ArrayRef<const uint8_t>>& added_elf_files,
- std::vector<const void*>& removed_symbols,
+ ArrayRef<JITCodeEntry*> jit_entries,
+ ArrayRef<const void*> removed_symbols,
bool compress,
/*out*/ size_t* num_symbols) {
using ElfTypes = ElfRuntimeTypes;
using Elf_Addr = typename ElfTypes::Addr;
using Elf_Sym = typename ElfTypes::Sym;
+ const InstructionSet isa = kRuntimeISA;
CHECK_EQ(sizeof(Elf_Addr), static_cast<size_t>(GetInstructionSetPointerSize(isa)));
auto is_removed_symbol = [&removed_symbols](Elf_Addr addr) {
const void* code_ptr = reinterpret_cast<const void*>(addr);
@@ -260,8 +260,8 @@ std::vector<uint8_t> PackElfFileForJIT(
using Reader = ElfDebugReader<ElfTypes>;
std::deque<Reader> readers;
- for (ArrayRef<const uint8_t> added_elf_file : added_elf_files) {
- readers.emplace_back(added_elf_file);
+ for (JITCodeEntry* it : jit_entries) {
+ readers.emplace_back(GetJITCodeEntrySymFile(it));
}
// Write symbols names. All other data is buffered.
diff --git a/compiler/debug/elf_debug_writer.h b/compiler/debug/elf_debug_writer.h
index 32b2f67f10..ed43a0b702 100644
--- a/compiler/debug/elf_debug_writer.h
+++ b/compiler/debug/elf_debug_writer.h
@@ -29,6 +29,7 @@
namespace art {
class OatHeader;
+struct JITCodeEntry;
namespace mirror {
class Class;
} // namespace mirror
@@ -56,10 +57,8 @@ std::vector<uint8_t> MakeElfFileForJIT(
const MethodDebugInfo& method_info);
std::vector<uint8_t> PackElfFileForJIT(
- InstructionSet isa,
- const InstructionSetFeatures* features,
- std::vector<ArrayRef<const uint8_t>>& added_elf_files,
- std::vector<const void*>& removed_symbols,
+ ArrayRef<JITCodeEntry*> jit_entries,
+ ArrayRef<const void*> removed_symbols,
bool compress,
/*out*/ size_t* num_symbols);
diff --git a/compiler/jit/jit_compiler.cc b/compiler/jit/jit_compiler.cc
index d84a132900..f01554a197 100644
--- a/compiler/jit/jit_compiler.cc
+++ b/compiler/jit/jit_compiler.cc
@@ -127,17 +127,14 @@ void JitCompiler::TypesLoaded(mirror::Class** types, size_t count)
REQUIRES_SHARED(Locks::mutator_lock_) {
const CompilerOptions& compiler_options = GetCompilerOptions();
if (compiler_options.GetGenerateDebugInfo()) {
+ InstructionSet isa = compiler_options.GetInstructionSet();
+ const InstructionSetFeatures* features = compiler_options.GetInstructionSetFeatures();
const ArrayRef<mirror::Class*> types_array(types, count);
- std::vector<uint8_t> elf_file = debug::WriteDebugElfFileForClasses(
- kRuntimeISA, compiler_options.GetInstructionSetFeatures(), types_array);
- // We never free debug info for types, so we don't need to provide a handle
- // (which would have been otherwise used as identifier to remove it later).
- AddNativeDebugInfoForJit(Thread::Current(),
- /*code_ptr=*/ nullptr,
- elf_file,
- /*pack*/ nullptr,
- compiler_options.GetInstructionSet(),
- compiler_options.GetInstructionSetFeatures());
+ std::vector<uint8_t> elf_file =
+ debug::WriteDebugElfFileForClasses(isa, features, types_array);
+
+ // NB: Don't allow packing since it would remove non-backtrace data.
+ AddNativeDebugInfoForJit(/*code_ptr=*/ nullptr, elf_file, /*allow_packing=*/ false);
}
}
@@ -145,6 +142,13 @@ bool JitCompiler::GenerateDebugInfo() {
return GetCompilerOptions().GetGenerateDebugInfo();
}
+std::vector<uint8_t> JitCompiler::PackElfFileForJIT(ArrayRef<JITCodeEntry*> elf_files,
+ ArrayRef<const void*> removed_symbols,
+ bool compress,
+ /*out*/ size_t* num_symbols) {
+ return debug::PackElfFileForJIT(elf_files, removed_symbols, compress, num_symbols);
+}
+
JitCompiler::JitCompiler() {
compiler_options_.reset(new CompilerOptions());
ParseCompilerOptions();
diff --git a/compiler/jit/jit_compiler.h b/compiler/jit/jit_compiler.h
index 737771fbf6..c69a376abb 100644
--- a/compiler/jit/jit_compiler.h
+++ b/compiler/jit/jit_compiler.h
@@ -53,6 +53,11 @@ class JitCompiler : public JitCompilerInterface {
void TypesLoaded(mirror::Class**, size_t count) REQUIRES_SHARED(Locks::mutator_lock_) override;
+ std::vector<uint8_t> PackElfFileForJIT(ArrayRef<JITCodeEntry*> elf_files,
+ ArrayRef<const void*> removed_symbols,
+ bool compress,
+ /*out*/ size_t* num_symbols) override;
+
private:
std::unique_ptr<CompilerOptions> compiler_options_;
std::unique_ptr<Compiler> compiler_;
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index b1a3abee2f..5d06969b4e 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -1481,17 +1481,13 @@ void OptimizingCompiler::GenerateJitDebugInfo(ArtMethod* method ATTRIBUTE_UNUSED
const bool mini_debug_info = !compiler_options.GetGenerateDebugInfo();
// Create entry for the single method that we just compiled.
- std::vector<uint8_t> elf_file = debug::MakeElfFileForJIT(
- compiler_options.GetInstructionSet(),
- compiler_options.GetInstructionSetFeatures(),
- mini_debug_info,
- info);
- AddNativeDebugInfoForJit(Thread::Current(),
- reinterpret_cast<const void*>(info.code_address),
- elf_file,
- mini_debug_info ? debug::PackElfFileForJIT : nullptr,
- compiler_options.GetInstructionSet(),
- compiler_options.GetInstructionSetFeatures());
+ InstructionSet isa = compiler_options.GetInstructionSet();
+ const InstructionSetFeatures* features = compiler_options.GetInstructionSetFeatures();
+ std::vector<uint8_t> elf = debug::MakeElfFileForJIT(isa, features, mini_debug_info, info);
+
+ // NB: Don't allow packing of full info since it would remove non-backtrace data.
+ const void* code_ptr = reinterpret_cast<const void*>(info.code_address);
+ AddNativeDebugInfoForJit(code_ptr, elf, /*allow_packing=*/ mini_debug_info);
}
Runtime::Current()->GetJit()->AddTimingLogger(logger);
}