Fix FieldGap priority queue ordering bug.
The priority queue for keeping track of gaps when packing fields in a
class object had the order reversed, giving priority to smaller gaps
instead of priority to larger gaps. This led to cases where fields
were not placed in gaps when they could be.
Bug: 22460222
Change-Id: I062e772e030c034adc227d75deed31c3322e203e
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 0694227..fbb2796 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -194,7 +194,9 @@
bool operator() (const FieldGap& lhs, const FieldGap& rhs)
NO_THREAD_SAFETY_ANALYSIS {
// Sort by gap size, largest first. Secondary sort by starting offset.
- return lhs.size > rhs.size || (lhs.size == rhs.size && lhs.start_offset < rhs.start_offset);
+ // Note that the priority queue returns the largest element, so operator()
+ // should return true if lhs is less than rhs.
+ return lhs.size < rhs.size || (lhs.size == rhs.size && lhs.start_offset > rhs.start_offset);
}
};
typedef std::priority_queue<FieldGap, std::vector<FieldGap>, FieldGapsComparator> FieldGaps;
diff --git a/runtime/mirror/abstract_method.h b/runtime/mirror/abstract_method.h
index 99d697a..6240b3b 100644
--- a/runtime/mirror/abstract_method.h
+++ b/runtime/mirror/abstract_method.h
@@ -60,9 +60,8 @@
HeapReference<mirror::Class> declaring_class_;
HeapReference<mirror::Class> declaring_class_of_overridden_method_;
- uint32_t padding_;
- uint64_t art_method_;
uint32_t access_flags_;
+ uint64_t art_method_;
uint32_t dex_method_index_;
friend struct art::AbstractMethodOffsets; // for verifying offset information
diff --git a/runtime/oat.h b/runtime/oat.h
index 3451d0f..ee2f3f6 100644
--- a/runtime/oat.h
+++ b/runtime/oat.h
@@ -32,7 +32,7 @@
class PACKED(4) OatHeader {
public:
static constexpr uint8_t kOatMagic[] = { 'o', 'a', 't', '\n' };
- static constexpr uint8_t kOatVersion[] = { '0', '6', '6', '\0' };
+ static constexpr uint8_t kOatVersion[] = { '0', '6', '7', '\0' };
static constexpr const char* kImageLocationKey = "image-location";
static constexpr const char* kDex2OatCmdLineKey = "dex2oat-cmdline";