diff options
Diffstat (limited to 'compiler/oat_writer.cc')
| -rw-r--r-- | compiler/oat_writer.cc | 45 | 
1 files changed, 16 insertions, 29 deletions
diff --git a/compiler/oat_writer.cc b/compiler/oat_writer.cc index 63a3c8ccdc..1ba5d3218e 100644 --- a/compiler/oat_writer.cc +++ b/compiler/oat_writer.cc @@ -50,6 +50,7 @@ namespace art {  OatWriter::OatWriter(const std::vector<const DexFile*>& dex_files,                       uint32_t image_file_location_oat_checksum,                       uintptr_t image_file_location_oat_begin, +                     int32_t image_patch_delta,                       const CompilerDriver* compiler,                       TimingLogger* timings,                       SafeMap<std::string, std::string>* key_value_store) @@ -57,6 +58,7 @@ OatWriter::OatWriter(const std::vector<const DexFile*>& dex_files,      dex_files_(&dex_files),      image_file_location_oat_checksum_(image_file_location_oat_checksum),      image_file_location_oat_begin_(image_file_location_oat_begin), +    image_patch_delta_(image_patch_delta),      key_value_store_(key_value_store),      oat_header_(NULL),      size_dex_file_alignment_(0), @@ -126,6 +128,7 @@ OatWriter::OatWriter(const std::vector<const DexFile*>& dex_files,    CHECK_EQ(dex_files_->size(), oat_dex_files_.size());    CHECK_EQ(compiler->IsImage(),             key_value_store_->find(OatHeader::kImageLocationKey) == key_value_store_->end()); +  CHECK_ALIGNED(image_patch_delta_, kPageSize);  }  OatWriter::~OatWriter() { @@ -354,7 +357,6 @@ class OatWriter::InitCodeMethodVisitor : public OatDexMethodVisitor {          uint32_t thumb_offset = compiled_method->CodeDelta();          quick_code_offset = offset_ + sizeof(OatQuickMethodHeader) + thumb_offset; -        bool force_debug_capture = false;          bool deduped = false;          // Deduplicate code arrays. @@ -397,39 +399,22 @@ class OatWriter::InitCodeMethodVisitor : public OatDexMethodVisitor {            offset_ += code_size;          } -        uint32_t quick_code_start = quick_code_offset - writer_->oat_header_->GetExecutableOffset(); -        std::vector<uint8_t>* cfi_info = writer_->compiler_driver_->GetCallFrameInformation(); -        if (cfi_info != nullptr) { -          // Copy in the FDE, if present -          const std::vector<uint8_t>* fde = compiled_method->GetCFIInfo(); -          if (fde != nullptr) { -            // Copy the information into cfi_info and then fix the address in the new copy. -            int cur_offset = cfi_info->size(); -            cfi_info->insert(cfi_info->end(), fde->begin(), fde->end()); - -            // Set the 'initial_location' field to address the start of the method. -            uint32_t offset_to_update = cur_offset + 2*sizeof(uint32_t); -            (*cfi_info)[offset_to_update+0] = quick_code_start; -            (*cfi_info)[offset_to_update+1] = quick_code_start >> 8; -            (*cfi_info)[offset_to_update+2] = quick_code_start >> 16; -            (*cfi_info)[offset_to_update+3] = quick_code_start >> 24; -            force_debug_capture = true; -          } -        } +        if (writer_->compiler_driver_->GetCompilerOptions().GetIncludeDebugSymbols()) { +          // Record debug information for this function if we are doing that. - -        if (writer_->compiler_driver_->DidIncludeDebugSymbols() || force_debug_capture) { -          // Record debug information for this function if we are doing that or -          // we have CFI and so need it.            std::string name = PrettyMethod(it.GetMemberIndex(), *dex_file_, true);            if (deduped) { -            // TODO We should place the DEDUPED tag on the first instance of a -            // deduplicated symbol so that it will show up in a debuggerd crash -            // report. +            // TODO We should place the DEDUPED tag on the first instance of a deduplicated symbol +            // so that it will show up in a debuggerd crash report.              name += " [ DEDUPED ]";            } -          writer_->method_info_.push_back(DebugInfo(name, quick_code_start, -                                                    quick_code_start + code_size)); + +          const uint32_t quick_code_start = quick_code_offset - +              writer_->oat_header_->GetExecutableOffset(); +          writer_->method_info_.push_back(DebugInfo(name, +                                                    quick_code_start, +                                                    quick_code_start + code_size, +                                                    compiled_method));          }        } @@ -808,6 +793,7 @@ size_t OatWriter::InitOatCode(size_t offset) {    oat_header_->SetExecutableOffset(offset);    size_executable_offset_alignment_ = offset - old_offset;    if (compiler_driver_->IsImage()) { +    CHECK_EQ(image_patch_delta_, 0);      InstructionSet instruction_set = compiler_driver_->GetInstructionSet();      #define DO_TRAMPOLINE(field, fn_name) \ @@ -840,6 +826,7 @@ size_t OatWriter::InitOatCode(size_t offset) {      oat_header_->SetQuickImtConflictTrampolineOffset(0);      oat_header_->SetQuickResolutionTrampolineOffset(0);      oat_header_->SetQuickToInterpreterBridgeOffset(0); +    oat_header_->SetImagePatchDelta(image_patch_delta_);    }    return offset;  }  |