ART: Ensure order of field gaps

Disambiguate field gaps of same size by starting offset. That will
make the priority queue stable.

Bug: 19413180
Change-Id: I6302a8bbdc590af7e9ec4f332c386c375fa8d8cd
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 8609807..d8166e2 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -157,8 +157,8 @@
   }
   bool operator() (const FieldGap& lhs, const FieldGap& rhs)
       NO_THREAD_SAFETY_ANALYSIS {
-    // Sort by gap size, largest first.
-    return lhs.size > rhs.size;
+    // 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);
   }
 };
 typedef std::priority_queue<FieldGap, std::vector<FieldGap>, FieldGapsComparator> FieldGaps;
diff --git a/runtime/image.cc b/runtime/image.cc
index 269a07d..3cb2580 100644
--- a/runtime/image.cc
+++ b/runtime/image.cc
@@ -24,7 +24,7 @@
 namespace art {
 
 const uint8_t ImageHeader::kImageMagic[] = { 'a', 'r', 't', '\n' };
-const uint8_t ImageHeader::kImageVersion[] = { '0', '1', '3', '\0' };
+const uint8_t ImageHeader::kImageVersion[] = { '0', '1', '4', '\0' };
 
 ImageHeader::ImageHeader(uint32_t image_begin,
                          uint32_t image_size,