From 4cdf4508903d13fd0f9fba5690aeac1b368db81b Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Tue, 25 Nov 2014 11:20:28 -0800 Subject: [PATCH] Fix oatwriter code deduping 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 | 2 +- compiler/oat_writer.h | 3 +++ runtime/mirror/art_method.h | 4 ---- runtime/oat.cc | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc index b59ab1322..00245c47b 100644 --- a/compiler/common_compiler_test.cc +++ b/compiler/common_compiler_test.cc @@ -146,7 +146,7 @@ OatFile::OatMethod CommonCompilerTest::CreateOatMethod(const void* code) { CHECK(code != nullptr); const byte* base = reinterpret_cast(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); } diff --git a/compiler/oat_writer.h b/compiler/oat_writer.h index 945048ecb..bd7bbc635 100644 --- a/compiler/oat_writer.h +++ b/compiler/oat_writer.h @@ -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; } }; diff --git a/runtime/mirror/art_method.h b/runtime/mirror/art_method.h index 1fa42c6dd..02399b169 100644 --- a/runtime/mirror/art_method.h +++ b/runtime/mirror/art_method.h @@ -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 uint32_t GetFrameSizeInBytes() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { uint32_t result = GetQuickFrameInfo().FrameSizeInBytes(); diff --git a/runtime/oat.cc b/runtime/oat.cc index a8fd25026..34c136249 100644 --- a/runtime/oat.cc +++ b/runtime/oat.cc @@ -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* variable_data) { size_t estimate = 0U; -- 2.11.0