diff options
author | Dmitry Petrochenko <dmitry.petrochenko@intel.com> | 2014-04-03 14:35:54 +0700 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2014-04-10 09:20:42 -0700 |
commit | 135016a1feee5576014f377e8006057837ee73a2 (patch) | |
tree | 900578418eea8094513d6e22ab0bb9f616334fd7 /runtime/stack_indirect_reference_table.h | |
parent | 22839a631bb3591a1c0037c388d51a4f18b5fb5e (diff) | |
download | art-135016a1feee5576014f377e8006057837ee73a2.zip art-135016a1feee5576014f377e8006057837ee73a2.tar.gz art-135016a1feee5576014f377e8006057837ee73a2.tar.bz2 |
art: Use SIRT::GetAlignedSirtSizeTarget in calling convention
Calculate frame size based on SIRT::GetAlignedSirtSizeTarget existing method.
Make offset functions pointer-size-dependent for cross-compiling. Add
a test to check whether our computations are correct.
Change-Id: Ic66daf6f9908890eda906bdcbbc4444c4fef614f
Signed-off-by: Dmitry Petrochenko <dmitry.petrochenko@intel.com>
Diffstat (limited to 'runtime/stack_indirect_reference_table.h')
-rw-r--r-- | runtime/stack_indirect_reference_table.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/runtime/stack_indirect_reference_table.h b/runtime/stack_indirect_reference_table.h index 6049e06..b113129 100644 --- a/runtime/stack_indirect_reference_table.h +++ b/runtime/stack_indirect_reference_table.h @@ -44,6 +44,10 @@ class StackIndirectReferenceTable { return number_of_references_; } + // We have versions with and without explicit pointer size of the following. The first two are + // used at runtime, so OFFSETOF_MEMBER computes the right offsets automatically. The last one + // takes the pointer size explicitly so that at compile time we can cross-compile correctly. + // Returns the size of a StackIndirectReferenceTable containing num_references sirts. static size_t SizeOf(uint32_t num_references) { size_t header_size = OFFSETOF_MEMBER(StackIndirectReferenceTable, references_); @@ -60,7 +64,7 @@ class StackIndirectReferenceTable { // Get the size of the SIRT for the number of entries, with padding added for potential alignment. static size_t GetAlignedSirtSizeTarget(size_t pointer_size, uint32_t num_references) { // Assume that the layout is packed. - size_t header_size = pointer_size + sizeof(uint32_t); + size_t header_size = pointer_size + sizeof(number_of_references_); // This assumes there is no layout change between 32 and 64b. size_t data_size = sizeof(StackReference<mirror::Object>) * num_references; size_t sirt_size = header_size + data_size; @@ -109,18 +113,18 @@ class StackIndirectReferenceTable { } // Offset of link within SIRT, used by generated code - static size_t LinkOffset() { - return OFFSETOF_MEMBER(StackIndirectReferenceTable, link_); + static size_t LinkOffset(size_t pointer_size) { + return 0; } // Offset of length within SIRT, used by generated code - static uint32_t NumberOfReferencesOffset() { - return OFFSETOF_MEMBER(StackIndirectReferenceTable, number_of_references_); + static size_t NumberOfReferencesOffset(size_t pointer_size) { + return pointer_size; } // Offset of link within SIRT, used by generated code - static size_t ReferencesOffset() { - return OFFSETOF_MEMBER(StackIndirectReferenceTable, references_); + static size_t ReferencesOffset(size_t pointer_size) { + return pointer_size + sizeof(number_of_references_); } private: |