diff options
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/debug/elf_debug_frame_writer.h | 6 | ||||
| -rw-r--r-- | compiler/debug/elf_debug_writer.cc | 10 | ||||
| -rw-r--r-- | compiler/debug/elf_debug_writer.h | 1 |
3 files changed, 12 insertions, 5 deletions
diff --git a/compiler/debug/elf_debug_frame_writer.h b/compiler/debug/elf_debug_frame_writer.h index 44b70ff930..f1a4f95d16 100644 --- a/compiler/debug/elf_debug_frame_writer.h +++ b/compiler/debug/elf_debug_frame_writer.h @@ -29,6 +29,10 @@ namespace art { namespace debug { +// Binary search table is not useful if the number of entries is small. +// In particular, this avoids it for the in-memory JIT mini-debug-info. +static constexpr size_t kMinDebugFrameHdrEntries = 100; + static void WriteCIE(InstructionSet isa, /*inout*/ std::vector<uint8_t>* buffer) { using Reg = dwarf::Reg; // Scratch registers should be marked as undefined. This tells the @@ -224,7 +228,7 @@ void WriteCFISection(ElfBuilder<ElfTypes>* builder, cfi_section->End(); } - if (method_infos.size() > 1) { + if (method_infos.size() > kMinDebugFrameHdrEntries) { std::sort(binary_search_table.begin(), binary_search_table.end()); // Custom Android section. It is very similar to the official .eh_frame_hdr format. diff --git a/compiler/debug/elf_debug_writer.cc b/compiler/debug/elf_debug_writer.cc index 10f673b2d6..da3230f8ce 100644 --- a/compiler/debug/elf_debug_writer.cc +++ b/compiler/debug/elf_debug_writer.cc @@ -231,6 +231,7 @@ std::vector<uint8_t> PackElfFileForJIT( const InstructionSetFeatures* features ATTRIBUTE_UNUSED, std::vector<ArrayRef<const uint8_t>>& added_elf_files, std::vector<const void*>& removed_symbols, + bool compress, /*out*/ size_t* num_symbols) { using ElfTypes = ElfRuntimeTypes; using Elf_Addr = typename ElfTypes::Addr; @@ -318,8 +319,8 @@ std::vector<uint8_t> PackElfFileForJIT( // Produce the outer ELF file. // It contains only the inner ELF file compressed as .gnu_debugdata section. // This extra wrapping is not necessary but the compression saves space. - std::vector<uint8_t> outer_elf_file; - { + if (compress) { + std::vector<uint8_t> outer_elf_file; std::vector<uint8_t> gnu_debugdata; gnu_debugdata.reserve(inner_elf_file.size() / 4); XzCompress(ArrayRef<const uint8_t>(inner_elf_file), &gnu_debugdata); @@ -334,9 +335,10 @@ std::vector<uint8_t> PackElfFileForJIT( builder->WriteSection(".gnu_debugdata", &gnu_debugdata); builder->End(); CHECK(builder->Good()); + return outer_elf_file; + } else { + return inner_elf_file; } - - return outer_elf_file; } std::vector<uint8_t> WriteDebugElfFileForClasses( diff --git a/compiler/debug/elf_debug_writer.h b/compiler/debug/elf_debug_writer.h index 14a5edbace..32b2f67f10 100644 --- a/compiler/debug/elf_debug_writer.h +++ b/compiler/debug/elf_debug_writer.h @@ -60,6 +60,7 @@ std::vector<uint8_t> PackElfFileForJIT( const InstructionSetFeatures* features, std::vector<ArrayRef<const uint8_t>>& added_elf_files, std::vector<const void*>& removed_symbols, + bool compress, /*out*/ size_t* num_symbols); std::vector<uint8_t> WriteDebugElfFileForClasses( |