From 849d09a81907f16d8ccc6019b8baf86a304b730c Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Mon, 21 Nov 2022 16:50:32 +0100 Subject: Split local reference table out of `IndirectReferenceTable`. In preparation for rewriting the representation of local JNI references, split their implementation out of the shared `IndirectReferenceTable` which shall be used only for global and weak global references going forward. Make the new `LocalReferenceTable` always resizable (remove the enum `ResizableCapacity`) and rename the memory mappings for LRT to "local ref table". Remove `IndirectReferenceTable` code that was needed only for local references, make these tables non-resizable. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 172332525 Change-Id: I87f02c93694577d1b577c4114fa86c2cd23b4c97 --- runtime/indirect_reference_table-inl.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime/indirect_reference_table-inl.h') diff --git a/runtime/indirect_reference_table-inl.h b/runtime/indirect_reference_table-inl.h index 6ea035b22d..23df2c8901 100644 --- a/runtime/indirect_reference_table-inl.h +++ b/runtime/indirect_reference_table-inl.h @@ -37,7 +37,7 @@ inline bool IndirectReferenceTable::IsValidReference(IndirectRef iref, /*out*/std::string* error_msg) const { DCHECK(iref != nullptr); DCHECK_EQ(GetIndirectRefKind(iref), kind_); - const uint32_t top_index = segment_state_.top_index; + const uint32_t top_index = top_index_; uint32_t idx = ExtractIndex(iref); if (UNLIKELY(idx >= top_index)) { *error_msg = android::base::StringPrintf("deleted reference at index %u in a table of size %u", @@ -82,7 +82,7 @@ template inline ObjPtr IndirectReferenceTable::Get(IndirectRef iref) const { DCHECK_EQ(GetIndirectRefKind(iref), kind_); uint32_t idx = ExtractIndex(iref); - DCHECK_LT(idx, segment_state_.top_index); + DCHECK_LT(idx, top_index_); DCHECK_EQ(DecodeSerial(reinterpret_cast(iref)), table_[idx].GetSerial()); DCHECK(!table_[idx].GetReference()->IsNull()); ObjPtr obj = table_[idx].GetReference()->Read(); @@ -93,7 +93,7 @@ inline ObjPtr IndirectReferenceTable::Get(IndirectRef iref) cons inline void IndirectReferenceTable::Update(IndirectRef iref, ObjPtr obj) { DCHECK_EQ(GetIndirectRefKind(iref), kind_); uint32_t idx = ExtractIndex(iref); - DCHECK_LT(idx, segment_state_.top_index); + DCHECK_LT(idx, top_index_); DCHECK_EQ(DecodeSerial(reinterpret_cast(iref)), table_[idx].GetSerial()); DCHECK(!table_[idx].GetReference()->IsNull()); table_[idx].SetReference(obj); -- cgit v1.2.3-59-g8ed1b