From eb8167a4f4d27fce0530f6724ab8032610cd146b Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Wed, 7 May 2014 15:43:14 -0700 Subject: Add Handle/HandleScope and delete SirtRef. Delete SirtRef and replaced it with Handle. Handles are value types which wrap around StackReference*. Renamed StackIndirectReferenceTable to HandleScope. Added a scoped handle wrapper which wraps around an Object** and restores it in its destructor. Renamed Handle::get -> Get. Bug: 8473721 Change-Id: Idbfebd4f35af629f0f43931b7c5184b334822c7a --- runtime/mirror/object_array-inl.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'runtime/mirror/object_array-inl.h') diff --git a/runtime/mirror/object_array-inl.h b/runtime/mirror/object_array-inl.h index 203a6b2510..942a2713d2 100644 --- a/runtime/mirror/object_array-inl.h +++ b/runtime/mirror/object_array-inl.h @@ -23,7 +23,7 @@ #include "mirror/art_field.h" #include "mirror/class.h" #include "runtime.h" -#include "sirt_ref.h" +#include "handle_scope-inl.h" #include "thread.h" #include @@ -118,7 +118,7 @@ inline void ObjectArray::AssignableMemmove(int32_t dst_pos, ObjectArray* s int32_t src_pos, int32_t count) { if (kIsDebugBuild) { for (int i = 0; i < count; ++i) { - // The Get will perform the VerifyObject. + // The get will perform the VerifyObject. src->GetWithoutChecks(src_pos + i); } } @@ -150,7 +150,7 @@ inline void ObjectArray::AssignableMemmove(int32_t dst_pos, ObjectArray* s Runtime::Current()->GetHeap()->WriteBarrierArray(this, dst_pos, count); if (kIsDebugBuild) { for (int i = 0; i < count; ++i) { - // The Get will perform the VerifyObject. + // The get will perform the VerifyObject. GetWithoutChecks(dst_pos + i); } } @@ -161,7 +161,7 @@ inline void ObjectArray::AssignableMemcpy(int32_t dst_pos, ObjectArray* sr int32_t src_pos, int32_t count) { if (kIsDebugBuild) { for (int i = 0; i < count; ++i) { - // The Get will perform the VerifyObject. + // The get will perform the VerifyObject. src->GetWithoutChecks(src_pos + i); } } @@ -182,7 +182,7 @@ inline void ObjectArray::AssignableMemcpy(int32_t dst_pos, ObjectArray* sr Runtime::Current()->GetHeap()->WriteBarrierArray(this, dst_pos, count); if (kIsDebugBuild) { for (int i = 0; i < count; ++i) { - // The Get will perform the VerifyObject. + // The get will perform the VerifyObject. GetWithoutChecks(dst_pos + i); } } @@ -244,13 +244,14 @@ template inline ObjectArray* ObjectArray::CopyOf(Thread* self, int32_t new_length) { DCHECK_GE(new_length, 0); // We may get copied by a compacting GC. - SirtRef > sirt_this(self, this); + StackHandleScope<1> hs(self); + Handle > h_this(hs.NewHandle(this)); gc::Heap* heap = Runtime::Current()->GetHeap(); gc::AllocatorType allocator_type = heap->IsMovableObject(this) ? heap->GetCurrentAllocator() : heap->GetCurrentNonMovingAllocator(); ObjectArray* new_array = Alloc(self, GetClass(), new_length, allocator_type); if (LIKELY(new_array != nullptr)) { - new_array->AssignableMemcpy(0, sirt_this.get(), 0, std::min(sirt_this->GetLength(), new_length)); + new_array->AssignableMemcpy(0, h_this.Get(), 0, std::min(h_this->GetLength(), new_length)); } return new_array; } -- cgit v1.2.3-59-g8ed1b