diff options
author | Andreas Gampe <agampe@google.com> | 2014-03-05 16:11:04 -0800 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2014-03-05 22:32:53 -0800 |
commit | bf6b92a158053c98b15f4393abb3b86344ec9a20 (patch) | |
tree | 93a28d1e01b045a8df23fe5279601496b62af3dd /runtime/stack_indirect_reference_table.h | |
parent | 359597ee8c0667a7d2c0b74dcbb0f90bb6059bae (diff) | |
download | art-bf6b92a158053c98b15f4393abb3b86344ec9a20.zip art-bf6b92a158053c98b15f4393abb3b86344ec9a20.tar.gz art-bf6b92a158053c98b15f4393abb3b86344ec9a20.tar.bz2 |
Generic JNI implementation for x86_64
Starting implementation for generic JNI on x86_64. Frames are of
large static size (>4K) right now, should be compacted later. Passes
the whole of jni_compiler_test.
Change-Id: I88ac3e13a534afe7568d62a1ef97cb766e8260e4
Diffstat (limited to 'runtime/stack_indirect_reference_table.h')
-rw-r--r-- | runtime/stack_indirect_reference_table.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/runtime/stack_indirect_reference_table.h b/runtime/stack_indirect_reference_table.h index d22650b..c2d6a59 100644 --- a/runtime/stack_indirect_reference_table.h +++ b/runtime/stack_indirect_reference_table.h @@ -33,17 +33,24 @@ class Thread; class StackIndirectReferenceTable { public: explicit StackIndirectReferenceTable(mirror::Object* object) : - number_of_references_(1), link_(NULL) { + link_(NULL), number_of_references_(1) { references_[0].Assign(object); } ~StackIndirectReferenceTable() {} // Number of references contained within this SIRT - size_t NumberOfReferences() const { + uint32_t NumberOfReferences() const { return number_of_references_; } + // 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_); + size_t data_size = sizeof(StackReference<mirror::Object>) * num_references; + return header_size + data_size; + } + // Link to previous SIRT or NULL StackIndirectReferenceTable* GetLink() const { return link_; @@ -54,6 +61,12 @@ class StackIndirectReferenceTable { link_ = sirt; } + // Sets the number_of_references_ field for constructing tables out of raw memory. Warning: will + // not resize anything. + void SetNumberOfReferences(uint32_t num_references) { + number_of_references_ = num_references; + } + mirror::Object* GetReference(size_t i) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { DCHECK_LT(i, number_of_references_); return references_[i].AsMirrorPtr(); @@ -74,7 +87,7 @@ class StackIndirectReferenceTable { } // Offset of length within SIRT, used by generated code - static size_t NumberOfReferencesOffset() { + static uint32_t NumberOfReferencesOffset() { return OFFSETOF_MEMBER(StackIndirectReferenceTable, number_of_references_); } @@ -86,8 +99,8 @@ class StackIndirectReferenceTable { private: StackIndirectReferenceTable() {} - size_t number_of_references_; StackIndirectReferenceTable* link_; + uint32_t number_of_references_; // number_of_references_ are available if this is allocated and filled in by jni_compiler. StackReference<mirror::Object> references_[1]; |