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
diff --git a/compiler/compiled_method.cc b/compiler/compiled_method.cc
index 29ff390..f6d724a 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 @@
   // 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 @@
   }
 }
 
-#if defined(ART_USE_PORTABLE_COMPILER)
 const std::string& CompiledCode::GetSymbol() const {
   CHECK_NE(0U, symbol_.size());
   return symbol_;
@@ -114,18 +144,17 @@
 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)),