diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2015-02-24 08:11:23 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-02-24 08:11:24 +0000 |
commit | f548c54c69443ba94fcee89daca6f5f499d71e9a (patch) | |
tree | aff0f707cb27e303d3b9de53f961bf48e38ad5be /compiler/compiled_method.cc | |
parent | 9e87baff2eee8e8ae0700c7391ca4447dbe142b0 (diff) | |
parent | a5ca888d715cd0c6c421313211caa1928be3e399 (diff) | |
download | android_art-f548c54c69443ba94fcee89daca6f5f499d71e9a.tar.gz android_art-f548c54c69443ba94fcee89daca6f5f499d71e9a.tar.bz2 android_art-f548c54c69443ba94fcee89daca6f5f499d71e9a.zip |
Merge "Revert "Add JIT""
Diffstat (limited to 'compiler/compiled_method.cc')
-rw-r--r-- | compiler/compiled_method.cc | 75 |
1 files changed, 15 insertions, 60 deletions
diff --git a/compiler/compiled_method.cc b/compiler/compiled_method.cc index 1849e7ef64..22be28c4d9 100644 --- a/compiler/compiled_method.cc +++ b/compiler/compiled_method.cc @@ -20,29 +20,16 @@ namespace art { CompiledCode::CompiledCode(CompilerDriver* compiler_driver, InstructionSet instruction_set, - const ArrayRef<const uint8_t>& quick_code, bool owns_code_array) + const ArrayRef<const uint8_t>& quick_code) : compiler_driver_(compiler_driver), instruction_set_(instruction_set), - owns_code_array_(owns_code_array), quick_code_(nullptr) { + quick_code_(nullptr) { SetCode(&quick_code); } void CompiledCode::SetCode(const ArrayRef<const uint8_t>* quick_code) { if (quick_code != nullptr) { CHECK(!quick_code->empty()); - if (owns_code_array_) { - // If we are supposed to own the code, don't deduplicate it. - CHECK(quick_code_ == nullptr); - quick_code_ = new SwapVector<uint8_t>(quick_code->begin(), quick_code->end(), - compiler_driver_->GetSwapSpaceAllocator()); - } else { - quick_code_ = compiler_driver_->DeduplicateCode(*quick_code); - } - } -} - -CompiledCode::~CompiledCode() { - if (owns_code_array_) { - delete quick_code_; + quick_code_ = compiler_driver_->DeduplicateCode(*quick_code); } } @@ -59,11 +46,11 @@ bool CompiledCode::operator==(const CompiledCode& rhs) const { return (rhs.quick_code_ == nullptr); } -size_t CompiledCode::AlignCode(size_t offset) const { +uint32_t CompiledCode::AlignCode(uint32_t offset) const { return AlignCode(offset, instruction_set_); } -size_t CompiledCode::AlignCode(size_t offset, InstructionSet instruction_set) { +uint32_t CompiledCode::AlignCode(uint32_t offset, InstructionSet instruction_set) { return RoundUp(offset, GetInstructionSetAlignment(instruction_set)); } @@ -133,39 +120,17 @@ CompiledMethod::CompiledMethod(CompilerDriver* driver, const ArrayRef<const uint8_t>& native_gc_map, const ArrayRef<const uint8_t>& cfi_info, const ArrayRef<LinkerPatch>& patches) - : CompiledCode(driver, instruction_set, quick_code, !driver->DedupeEnabled()), - owns_arrays_(!driver->DedupeEnabled()), - frame_size_in_bytes_(frame_size_in_bytes), core_spill_mask_(core_spill_mask), - fp_spill_mask_(fp_spill_mask), + : CompiledCode(driver, instruction_set, quick_code), frame_size_in_bytes_(frame_size_in_bytes), + core_spill_mask_(core_spill_mask), fp_spill_mask_(fp_spill_mask), + src_mapping_table_(src_mapping_table == nullptr ? + driver->DeduplicateSrcMappingTable(ArrayRef<SrcMapElem>()) : + driver->DeduplicateSrcMappingTable(ArrayRef<SrcMapElem>(src_mapping_table->Arrange()))), + mapping_table_(mapping_table.data() == nullptr ? + nullptr : driver->DeduplicateMappingTable(mapping_table)), + vmap_table_(driver->DeduplicateVMapTable(vmap_table)), + gc_map_(native_gc_map.data() == nullptr ? nullptr : driver->DeduplicateGCMap(native_gc_map)), + cfi_info_(cfi_info.data() == nullptr ? nullptr : driver->DeduplicateCFIInfo(cfi_info)), patches_(patches.begin(), patches.end(), driver->GetSwapSpaceAllocator()) { - if (owns_arrays_) { - if (src_mapping_table == nullptr) { - src_mapping_table_ = new SwapSrcMap(driver->GetSwapSpaceAllocator()); - } else { - src_mapping_table->Arrange(); - src_mapping_table_ = new SwapSrcMap(src_mapping_table->begin(), src_mapping_table->end(), - driver->GetSwapSpaceAllocator()); - } - mapping_table_ = mapping_table.empty() ? - nullptr : new SwapVector<uint8_t>(mapping_table.begin(), mapping_table.end(), - driver->GetSwapSpaceAllocator()); - vmap_table_ = new SwapVector<uint8_t>(vmap_table.begin(), vmap_table.end(), - driver->GetSwapSpaceAllocator()); - gc_map_ = native_gc_map.empty() ? nullptr : - new SwapVector<uint8_t>(native_gc_map.begin(), native_gc_map.end(), - driver->GetSwapSpaceAllocator()); - cfi_info_ = cfi_info.empty() ? nullptr : - new SwapVector<uint8_t>(cfi_info.begin(), cfi_info.end(), driver->GetSwapSpaceAllocator()); - } else { - src_mapping_table_ = src_mapping_table == nullptr ? - driver->DeduplicateSrcMappingTable(ArrayRef<SrcMapElem>()) : - driver->DeduplicateSrcMappingTable(ArrayRef<SrcMapElem>(src_mapping_table->Arrange())); - mapping_table_ = mapping_table.empty() ? - nullptr : driver->DeduplicateMappingTable(mapping_table); - vmap_table_ = driver->DeduplicateVMapTable(vmap_table); - gc_map_ = native_gc_map.empty() ? nullptr : driver->DeduplicateGCMap(native_gc_map); - cfi_info_ = cfi_info.empty() ? nullptr : driver->DeduplicateCFIInfo(cfi_info); - } } CompiledMethod* CompiledMethod::SwapAllocCompiledMethod( @@ -229,14 +194,4 @@ void CompiledMethod::ReleaseSwapAllocatedCompiledMethod(CompilerDriver* driver, alloc.deallocate(m, 1); } -CompiledMethod::~CompiledMethod() { - if (owns_arrays_) { - delete src_mapping_table_; - delete mapping_table_; - delete vmap_table_; - delete gc_map_; - delete cfi_info_; - } -} - } // namespace art |