summaryrefslogtreecommitdiffstats
path: root/compiler/compiled_method.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/compiled_method.cc')
-rw-r--r--compiler/compiled_method.cc53
1 files changed, 41 insertions, 12 deletions
diff --git a/compiler/compiled_method.cc b/compiler/compiled_method.cc
index 29ff390678..f6d724ab56 100644
--- a/compiler/compiled_method.cc
+++ b/compiler/compiled_method.cc
@@ -20,14 +20,16 @@
namespace art {
CompiledCode::CompiledCode(CompilerDriver* compiler_driver, InstructionSet instruction_set,
- const std::vector<uint8_t>& code)
- : compiler_driver_(compiler_driver), instruction_set_(instruction_set), code_(nullptr) {
- SetCode(code);
+ const std::vector<uint8_t>& quick_code)
+ : compiler_driver_(compiler_driver), instruction_set_(instruction_set),
+ portable_code_(nullptr), quick_code_(nullptr) {
+ SetCode(&quick_code, nullptr);
}
CompiledCode::CompiledCode(CompilerDriver* compiler_driver, InstructionSet instruction_set,
const std::string& elf_object, const std::string& symbol)
- : compiler_driver_(compiler_driver), instruction_set_(instruction_set), symbol_(symbol) {
+ : compiler_driver_(compiler_driver), instruction_set_(instruction_set),
+ portable_code_(nullptr), quick_code_(nullptr), symbol_(symbol) {
CHECK_NE(elf_object.size(), 0U);
CHECK_NE(symbol.size(), 0U);
std::vector<uint8_t> temp_code(elf_object.size());
@@ -38,12 +40,41 @@ CompiledCode::CompiledCode(CompilerDriver* compiler_driver, InstructionSet instr
// change to have different kinds of compiled methods. This is
// being deferred until we work on hybrid execution or at least
// until we work on batch compilation.
- SetCode(temp_code);
+ SetCode(nullptr, &temp_code);
}
-void CompiledCode::SetCode(const std::vector<uint8_t>& code) {
- CHECK(!code.empty());
- code_ = compiler_driver_->DeduplicateCode(code);
+void CompiledCode::SetCode(const std::vector<uint8_t>* quick_code,
+ const std::vector<uint8_t>* portable_code) {
+ if (portable_code != nullptr) {
+ CHECK(!portable_code->empty());
+ portable_code_ = compiler_driver_->DeduplicateCode(*portable_code);
+ }
+ if (quick_code != nullptr) {
+ CHECK(!quick_code->empty());
+ quick_code_ = compiler_driver_->DeduplicateCode(*quick_code);
+ }
+}
+
+bool CompiledCode::operator==(const CompiledCode& rhs) const {
+ if (quick_code_ != nullptr) {
+ if (rhs.quick_code_ == nullptr) {
+ return false;
+ } else if (quick_code_->size() != rhs.quick_code_->size()) {
+ return false;
+ } else {
+ return std::equal(quick_code_->begin(), quick_code_->end(), rhs.quick_code_->begin());
+ }
+ } else if (portable_code_ != nullptr) {
+ if (rhs.portable_code_ == nullptr) {
+ return false;
+ } else if (portable_code_->size() != rhs.portable_code_->size()) {
+ return false;
+ } else {
+ return std::equal(portable_code_->begin(), portable_code_->end(),
+ rhs.portable_code_->begin());
+ }
+ }
+ return (rhs.quick_code_ == nullptr) && (rhs.portable_code_ == nullptr);
}
uint32_t CompiledCode::AlignCode(uint32_t offset) const {
@@ -100,7 +131,6 @@ const void* CompiledCode::CodePointer(const void* code_pointer,
}
}
-#if defined(ART_USE_PORTABLE_COMPILER)
const std::string& CompiledCode::GetSymbol() const {
CHECK_NE(0U, symbol_.size());
return symbol_;
@@ -114,18 +144,17 @@ const std::vector<uint32_t>& CompiledCode::GetOatdataOffsetsToCompliledCodeOffse
void CompiledCode::AddOatdataOffsetToCompliledCodeOffset(uint32_t offset) {
oatdata_offsets_to_compiled_code_offset_.push_back(offset);
}
-#endif
CompiledMethod::CompiledMethod(CompilerDriver& driver,
InstructionSet instruction_set,
- const std::vector<uint8_t>& code,
+ const std::vector<uint8_t>& quick_code,
const size_t frame_size_in_bytes,
const uint32_t core_spill_mask,
const uint32_t fp_spill_mask,
const std::vector<uint8_t>& mapping_table,
const std::vector<uint8_t>& vmap_table,
const std::vector<uint8_t>& native_gc_map)
- : CompiledCode(&driver, instruction_set, code), frame_size_in_bytes_(frame_size_in_bytes),
+ : 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),
mapping_table_(driver.DeduplicateMappingTable(mapping_table)),
vmap_table_(driver.DeduplicateVMapTable(vmap_table)),