art: Make calling convention immune to SIRT structure change

Introduce stack_indirect_reference_table::referencesOffset and
rely on it in calling convention to avoid issues if SIRT structure
change.

Change-Id: Icc0c5c5b1313173df2ee519ab8934183074fdfb6
Signed-off-by: Dmitry Petrochenko <dmitry.petrochenko@intel.com>
diff --git a/compiler/jni/quick/calling_convention.h b/compiler/jni/quick/calling_convention.h
index fe3d1cd..4950905 100644
--- a/compiler/jni/quick/calling_convention.h
+++ b/compiler/jni/quick/calling_convention.h
@@ -298,9 +298,8 @@
   }
 
   FrameOffset SirtReferencesOffset() const {
-    // The StackIndirectReferenceTable::number_of_references_ type is uint32_t
-    return FrameOffset(SirtNumRefsOffset().Int32Value() +
-                       sizeof(uint32_t));
+    return FrameOffset(SirtOffset().Int32Value() +
+                       StackIndirectReferenceTable::ReferencesOffset());
   }
 
   virtual ~JniCallingConvention() {}
diff --git a/runtime/stack_indirect_reference_table.h b/runtime/stack_indirect_reference_table.h
index e6dda85..daef3ff 100644
--- a/runtime/stack_indirect_reference_table.h
+++ b/runtime/stack_indirect_reference_table.h
@@ -98,14 +98,19 @@
             && (sirt_entry <= (&references_[number_of_references_ - 1])));
   }
 
+  // Offset of link within SIRT, used by generated code
+  static size_t LinkOffset() {
+    return OFFSETOF_MEMBER(StackIndirectReferenceTable, link_);
+  }
+
   // Offset of length within SIRT, used by generated code
   static uint32_t NumberOfReferencesOffset() {
     return OFFSETOF_MEMBER(StackIndirectReferenceTable, number_of_references_);
   }
 
   // Offset of link within SIRT, used by generated code
-  static size_t LinkOffset() {
-    return OFFSETOF_MEMBER(StackIndirectReferenceTable, link_);
+  static size_t ReferencesOffset() {
+    return OFFSETOF_MEMBER(StackIndirectReferenceTable, references_);
   }
 
  private: