summaryrefslogtreecommitdiff
path: root/runtime/indirect_reference_table-inl.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2022-11-21 16:50:32 +0100
committer VladimĂ­r Marko <vmarko@google.com> 2022-12-08 13:28:57 +0000
commit849d09a81907f16d8ccc6019b8baf86a304b730c (patch)
tree9f85c789e9ac154a3363bcd7a5c0230e8b5fee3d /runtime/indirect_reference_table-inl.h
parent01b7cad2a160e9d192eb7ddd5303255ab4c15278 (diff)
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
Diffstat (limited to 'runtime/indirect_reference_table-inl.h')
-rw-r--r--runtime/indirect_reference_table-inl.h6
1 files changed, 3 insertions, 3 deletions
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<ReadBarrierOption kReadBarrierOption>
inline ObjPtr<mirror::Object> 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<uintptr_t>(iref)), table_[idx].GetSerial());
DCHECK(!table_[idx].GetReference()->IsNull());
ObjPtr<mirror::Object> obj = table_[idx].GetReference()->Read<kReadBarrierOption>();
@@ -93,7 +93,7 @@ inline ObjPtr<mirror::Object> IndirectReferenceTable::Get(IndirectRef iref) cons
inline void IndirectReferenceTable::Update(IndirectRef iref, ObjPtr<mirror::Object> 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<uintptr_t>(iref)), table_[idx].GetSerial());
DCHECK(!table_[idx].GetReference()->IsNull());
table_[idx].SetReference(obj);