ART: Swap-space in the compiler
Introduce a swap-space and corresponding allocator to transparently
switch native allocations to memory backed by a file.
Bug: 18596910
(cherry picked from commit 62746d8d9c4400e4764f162b22bfb1a32be287a9)
Change-Id: I131448f3907115054a592af73db86d2b9257ea33
diff --git a/compiler/dex/quick/codegen_util.cc b/compiler/dex/quick/codegen_util.cc
index cc61e93..67ea897 100644
--- a/compiler/dex/quick/codegen_util.cc
+++ b/compiler/dex/quick/codegen_util.cc
@@ -1086,12 +1086,20 @@
});
std::unique_ptr<std::vector<uint8_t>> cfi_info(ReturnFrameDescriptionEntry());
- CompiledMethod* result =
- new CompiledMethod(cu_->compiler_driver, cu_->instruction_set, code_buffer_, frame_size_,
- core_spill_mask_, fp_spill_mask_, &src_mapping_table_, encoded_mapping_table_,
- vmap_encoder.GetData(), native_gc_map_, cfi_info.get(),
- ArrayRef<LinkerPatch>(patches_));
- return result;
+ ArrayRef<const uint8_t> cfi_ref;
+ if (cfi_info.get() != nullptr) {
+ cfi_ref = ArrayRef<const uint8_t>(*cfi_info);
+ }
+ return CompiledMethod::SwapAllocCompiledMethod(
+ cu_->compiler_driver, cu_->instruction_set,
+ ArrayRef<const uint8_t>(code_buffer_),
+ frame_size_, core_spill_mask_, fp_spill_mask_,
+ &src_mapping_table_,
+ ArrayRef<const uint8_t>(encoded_mapping_table_),
+ ArrayRef<const uint8_t>(vmap_encoder.GetData()),
+ ArrayRef<const uint8_t>(native_gc_map_),
+ cfi_ref,
+ ArrayRef<LinkerPatch>(patches_));
}
size_t Mir2Lir::GetMaxPossibleCompilerTemps() const {
diff --git a/compiler/dex/quick/mir_to_lir.h b/compiler/dex/quick/mir_to_lir.h
index a2b85ff..19e7bf3 100644
--- a/compiler/dex/quick/mir_to_lir.h
+++ b/compiler/dex/quick/mir_to_lir.h
@@ -1741,7 +1741,7 @@
int live_sreg_;
CodeBuffer code_buffer_;
// The source mapping table data (pc -> dex). More entries than in encoded_mapping_table_
- SrcMap src_mapping_table_;
+ DefaultSrcMap src_mapping_table_;
// The encoding mapping table data (dex -> pc offset and pc offset -> dex) with a size prefix.
std::vector<uint8_t> encoded_mapping_table_;
ArenaVector<uint32_t> core_vmap_table_;