Reduced memory usage of primitive fields smaller than 4-bytes

Reduced memory used by byte and boolean fields from 4 bytes down to a
single byte and shorts and chars down to two bytes. Fields are now
arranged as Reference followed by decreasing component sizes, with
fields shuffled forward as needed.

Bug: 8135266
Change-Id: I65eaf31ed27e5bd5ba0c7d4606454b720b074752
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 14a9e4a..67a7b23 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -17,6 +17,7 @@
 #ifndef ART_RUNTIME_CLASS_LINKER_H_
 #define ART_RUNTIME_CLASS_LINKER_H_
 
+#include <deque>
 #include <string>
 #include <utility>
 #include <vector>
@@ -531,6 +532,18 @@
   void LinkCode(ConstHandle<mirror::ArtMethod> method, const OatFile::OatClass* oat_class,
                 const DexFile& dex_file, uint32_t dex_method_index, uint32_t method_index)
       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+  template<int n>
+  void AlignFields(size_t& current_field, const size_t num_fields,
+                   MemberOffset& field_offset,
+                   mirror::ObjectArray<mirror::ArtField>* fields,
+                   std::deque<mirror::ArtField*>& grouped_and_sorted_fields)
+      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+  template<int n>
+  void ShuffleForward(size_t& current_field, const size_t num_fields,
+                      MemberOffset& field_offset,
+                      mirror::ObjectArray<mirror::ArtField>* fields,
+                      std::deque<mirror::ArtField*>& grouped_and_sorted_fields)
+      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
 
   void CreateReferenceInstanceOffsets(ConstHandle<mirror::Class> klass)
       SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);