OSDN Git Service

Fix oatwriter code deduping
authorMathieu Chartier <mathieuc@google.com>
Tue, 25 Nov 2014 19:20:28 +0000 (11:20 -0800)
committerMathieu Chartier <mathieuc@google.com>
Tue, 25 Nov 2014 21:33:53 +0000 (13:33 -0800)
Now that the GC maps are part of the oat method header they need
to be checked in CodeOffsetsKeyComparator.

Bug: 18523556

Change-Id: I539a6e7216166342b22515c1e2cf831dad32e41e

compiler/common_compiler_test.cc
compiler/oat_writer.h
runtime/mirror/art_method.h
runtime/oat.cc

index b59ab13..00245c4 100644 (file)
@@ -146,7 +146,7 @@ OatFile::OatMethod CommonCompilerTest::CreateOatMethod(const void* code) {
   CHECK(code != nullptr);
   const byte* base = reinterpret_cast<const byte*>(code);  // Base of data points at code.
   base -= kPointerSize;  // Move backward so that code_offset != 0.
-  uint32_t  code_offset = kPointerSize;
+  uint32_t code_offset = kPointerSize;
   return OatFile::OatMethod(base, code_offset);
 }
 
index 945048e..bd7bbc6 100644 (file)
@@ -317,6 +317,9 @@ class OatWriter {
       if (UNLIKELY(&lhs->GetVmapTable() != &rhs->GetVmapTable())) {
         return &lhs->GetVmapTable() < &rhs->GetVmapTable();
       }
+      if (UNLIKELY(&lhs->GetGcMap() != &rhs->GetGcMap())) {
+        return &lhs->GetGcMap() < &rhs->GetGcMap();
+      }
       return false;
     }
   };
index 1fa42c6..02399b1 100644 (file)
@@ -390,10 +390,6 @@ class MANAGED ArtMethod FINAL : public Object {
   const uint8_t* GetNativeGcMap(const void* code_pointer, size_t pointer_size)
       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
 
-  // When building the oat need a convenient place to stuff the offset of the native GC map.
-  // void SetOatNativeGcMapOffset(uint32_t gc_map_offset) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
-  // uint32_t GetOatNativeGcMapOffset() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
-
   template <bool kCheckFrameSize = true>
   uint32_t GetFrameSizeInBytes() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
     uint32_t result = GetQuickFrameInfo().FrameSizeInBytes();
index a8fd250..34c1362 100644 (file)
@@ -23,7 +23,7 @@
 namespace art {
 
 const uint8_t OatHeader::kOatMagic[] = { 'o', 'a', 't', '\n' };
-const uint8_t OatHeader::kOatVersion[] = { '0', '4', '4', '\0' };
+const uint8_t OatHeader::kOatVersion[] = { '0', '4', '5', '\0' };
 
 static size_t ComputeOatHeaderSize(const SafeMap<std::string, std::string>* variable_data) {
   size_t estimate = 0U;