summaryrefslogtreecommitdiff
path: root/runtime/handle_scope-inl.h
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2023-01-30 14:29:11 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2023-02-01 09:52:45 +0000
commit0f6af5e3b51a7f5905d09a98ec8d531541666015 (patch)
tree7ed720cc521bb7f6e3b092cf6900a34d050c3aba /runtime/handle_scope-inl.h
parentd04ed700190056ecd367ee41e6b7f3b87dc7f901 (diff)
Reland "Write classes in runtime-generated app image."
This reverts commit 24b3d648ff6c2c200003f55ac63fc910d7bfd40f. Bug: 260557058 Reason for revert: - Encode class loader context in image, and check it at load time. - Set nterp entrypoint to methods that can. Test: test.py Test: atest com.android.bluetooth.opp.BluetoothOppObexServerSessionTest#onPut_withUnsupportedMimeTypeInHeader_returnsHttpBadRequest Change-Id: Ibf4a8604c4a226d1acc021103668e211446bb53c
Diffstat (limited to 'runtime/handle_scope-inl.h')
-rw-r--r--runtime/handle_scope-inl.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/runtime/handle_scope-inl.h b/runtime/handle_scope-inl.h
index 3aa9e5221d..60a82a29ae 100644
--- a/runtime/handle_scope-inl.h
+++ b/runtime/handle_scope-inl.h
@@ -121,6 +121,15 @@ inline void HandleScope::VisitRoots(Visitor& visitor) {
}
}
+template <typename Visitor>
+inline void HandleScope::VisitHandles(Visitor& visitor) {
+ for (size_t i = 0, count = NumberOfReferences(); i < count; ++i) {
+ if (GetHandle(i) != nullptr) {
+ visitor.Visit(GetHandle(i));
+ }
+ }
+}
+
template<size_t kNumReferences> template<class T>
inline MutableHandle<T> FixedSizeHandleScope<kNumReferences>::NewHandle(T* object) {
return NewHandle(ObjPtr<T>(object));
@@ -179,6 +188,15 @@ inline void BaseHandleScope::VisitRoots(Visitor& visitor) {
}
}
+template <typename Visitor>
+inline void BaseHandleScope::VisitHandles(Visitor& visitor) {
+ if (LIKELY(!IsVariableSized())) {
+ AsHandleScope()->VisitHandles(visitor);
+ } else {
+ AsVariableSized()->VisitHandles(visitor);
+ }
+}
+
inline VariableSizedHandleScope* BaseHandleScope::AsVariableSized() {
DCHECK(IsVariableSized());
return down_cast<VariableSizedHandleScope*>(this);
@@ -269,6 +287,15 @@ inline void VariableSizedHandleScope::VisitRoots(Visitor& visitor) {
}
}
+template <typename Visitor>
+inline void VariableSizedHandleScope::VisitHandles(Visitor& visitor) {
+ LocalScopeType* cur = current_scope_;
+ while (cur != nullptr) {
+ cur->VisitHandles(visitor);
+ cur = reinterpret_cast<LocalScopeType*>(cur->GetLink());
+ }
+}
+
} // namespace art
#endif // ART_RUNTIME_HANDLE_SCOPE_INL_H_