From ef7d42fca18c16fbaf103822ad16f23246e2905d Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Mon, 6 Jan 2014 12:55:46 -0800 Subject: Object model changes to support 64bit. Modify mirror objects so that references between them use an ObjectReference value type rather than an Object* so that functionality to compress larger references can be captured in the ObjectRefererence implementation. ObjectReferences are 32bit and all other aspects of object layout remain as they are currently. Expand fields in objects holding pointers so they can hold 64bit pointers. Its expected the size of these will come down by improving where we hold compiler meta-data. Stub out x86_64 architecture specific runtime implementation. Modify OutputStream so that reads and writes are of unsigned quantities. Make the use of portable or quick code more explicit. Templatize AtomicInteger to support more than just int32_t as a type. Add missing, and fix issues relating to, missing annotalysis information on the mutator lock. Refactor and share implementations for array copy between System and uses elsewhere in the runtime. Fix numerous 64bit build issues. Change-Id: I1a5694c251a42c9eff71084dfdd4b51fff716822 --- compiler/compiled_method.cc | 53 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 12 deletions(-) (limited to 'compiler/compiled_method.cc') 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& code) - : compiler_driver_(compiler_driver), instruction_set_(instruction_set), code_(nullptr) { - SetCode(code); + const std::vector& 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 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& code) { - CHECK(!code.empty()); - code_ = compiler_driver_->DeduplicateCode(code); +void CompiledCode::SetCode(const std::vector* quick_code, + const std::vector* 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& 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& code, + const std::vector& quick_code, const size_t frame_size_in_bytes, const uint32_t core_spill_mask, const uint32_t fp_spill_mask, const std::vector& mapping_table, const std::vector& vmap_table, const std::vector& 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)), -- cgit v1.2.3