ObjPtr<>-ify mirror::ObjectArray.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 31113334
Change-Id: I611b3e49d3feed306f6cd35d2b662a1e727e24c6
diff --git a/compiler/jni/jni_compiler_test.cc b/compiler/jni/jni_compiler_test.cc
index c316499..cbd2031 100644
--- a/compiler/jni/jni_compiler_test.cc
+++ b/compiler/jni/jni_compiler_test.cc
@@ -1188,7 +1188,7 @@
// Check stack trace entries have expected values
for (int32_t j = 0; j < trace_array->GetLength(); ++j) {
EXPECT_EQ(-2, trace_array->Get(j)->GetLineNumber());
- mirror::StackTraceElement* ste = trace_array->Get(j);
+ ObjPtr<mirror::StackTraceElement> ste = trace_array->Get(j);
EXPECT_STREQ("MyClassNatives.java", ste->GetFileName()->ToModifiedUtf8().c_str());
EXPECT_STREQ("MyClassNatives", ste->GetDeclaringClass()->ToModifiedUtf8().c_str());
EXPECT_EQ(("fooI" + CurrentJniStringSuffix()), ste->GetMethodName()->ToModifiedUtf8());
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index e7d45a9..205077f 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -289,7 +289,7 @@
}
}
-static dex::TypeIndex FindClassIndexIn(mirror::Class* cls,
+static dex::TypeIndex FindClassIndexIn(ObjPtr<mirror::Class> cls,
const DexCompilationUnit& compilation_unit)
REQUIRES_SHARED(Locks::mutator_lock_) {
const DexFile& dex_file = *compilation_unit.GetDexFile();
@@ -368,7 +368,7 @@
}
}
-static mirror::Class* GetMonomorphicType(Handle<mirror::ObjectArray<mirror::Class>> classes)
+static ObjPtr<mirror::Class> GetMonomorphicType(Handle<mirror::ObjectArray<mirror::Class>> classes)
REQUIRES_SHARED(Locks::mutator_lock_) {
DCHECK(classes->Get(0) != nullptr);
return classes->Get(0);
diff --git a/libartbase/base/common_art_test.h b/libartbase/base/common_art_test.h
index dfe6eb8..bfb03c8 100644
--- a/libartbase/base/common_art_test.h
+++ b/libartbase/base/common_art_test.h
@@ -39,10 +39,10 @@
using ScopedLogSeverity = android::base::ScopedLogSeverity;
// OBJ pointer helpers to avoid needing .Decode everywhere.
-#define EXPECT_OBJ_PTR_EQ(a, b) EXPECT_EQ(MakeObjPtr(a).Ptr(), MakeObjPtr(b).Ptr());
-#define ASSERT_OBJ_PTR_EQ(a, b) ASSERT_EQ(MakeObjPtr(a).Ptr(), MakeObjPtr(b).Ptr());
-#define EXPECT_OBJ_PTR_NE(a, b) EXPECT_NE(MakeObjPtr(a).Ptr(), MakeObjPtr(b).Ptr());
-#define ASSERT_OBJ_PTR_NE(a, b) ASSERT_NE(MakeObjPtr(a).Ptr(), MakeObjPtr(b).Ptr());
+#define EXPECT_OBJ_PTR_EQ(a, b) EXPECT_EQ(MakeObjPtr(a).Ptr(), MakeObjPtr(b).Ptr())
+#define ASSERT_OBJ_PTR_EQ(a, b) ASSERT_EQ(MakeObjPtr(a).Ptr(), MakeObjPtr(b).Ptr())
+#define EXPECT_OBJ_PTR_NE(a, b) EXPECT_NE(MakeObjPtr(a).Ptr(), MakeObjPtr(b).Ptr())
+#define ASSERT_OBJ_PTR_NE(a, b) ASSERT_NE(MakeObjPtr(a).Ptr(), MakeObjPtr(b).Ptr())
class DexFile;
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index b4bc024..633297e 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -1819,7 +1819,7 @@
= image_root_object->AsObjectArray<mirror::Object>();
ScopedIndentation indent2(&vios_);
for (int j = 0; j < image_root_object_array->GetLength(); j++) {
- mirror::Object* value = image_root_object_array->Get(j);
+ ObjPtr<mirror::Object> value = image_root_object_array->Get(j);
size_t run = 0;
for (int32_t k = j + 1; k < image_root_object_array->GetLength(); k++) {
if (value == image_root_object_array->Get(k)) {
@@ -2177,7 +2177,7 @@
if (obj->IsObjectArray()) {
auto* obj_array = obj->AsObjectArray<mirror::Object>();
for (int32_t i = 0, length = obj_array->GetLength(); i < length; i++) {
- mirror::Object* value = obj_array->Get(i);
+ ObjPtr<mirror::Object> value = obj_array->Get(i);
size_t run = 0;
for (int32_t j = i + 1; j < length; j++) {
if (value == obj_array->Get(j)) {
diff --git a/openjdkjvmti/ti_heap.cc b/openjdkjvmti/ti_heap.cc
index 60cb004..7f71954 100644
--- a/openjdkjvmti/ti_heap.cc
+++ b/openjdkjvmti/ti_heap.cc
@@ -1142,14 +1142,14 @@
array->AsObjectArray<art::mirror::Object>();
int32_t length = obj_array->GetLength();
for (int32_t i = 0; i != length; ++i) {
- art::mirror::Object* elem = obj_array->GetWithoutChecks(i);
+ art::ObjPtr<art::mirror::Object> elem = obj_array->GetWithoutChecks(i);
if (elem != nullptr) {
jvmtiHeapReferenceInfo reference_info;
reference_info.array.index = i;
stop_reports_ = !ReportReferenceMaybeEnqueue(JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT,
&reference_info,
array,
- elem);
+ elem.Ptr());
if (stop_reports_) {
break;
}
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 16f6383..6837c7f 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -2120,7 +2120,7 @@
if (kSanityCheckObjects) {
for (int32_t i = 0; i < dex_caches->GetLength(); i++) {
- auto* dex_cache = dex_caches->Get(i);
+ ObjPtr<mirror::DexCache> dex_cache = dex_caches->Get(i);
for (size_t j = 0; j < dex_cache->NumResolvedFields(); ++j) {
auto* field = dex_cache->GetResolvedField(j, image_pointer_size_);
if (field != nullptr) {
diff --git a/runtime/class_loader_context.cc b/runtime/class_loader_context.cc
index 165b42d..e811afd 100644
--- a/runtime/class_loader_context.cc
+++ b/runtime/class_loader_context.cc
@@ -927,7 +927,7 @@
Handle<mirror::ObjectArray<mirror::Object>> dex_elements(
hs.NewHandle(dex_elements_obj->AsObjectArray<mirror::Object>()));
for (int32_t i = 0; i < dex_elements->GetLength(); ++i) {
- mirror::Object* element = dex_elements->GetWithoutChecks(i);
+ ObjPtr<mirror::Object> element = dex_elements->GetWithoutChecks(i);
if (element == nullptr) {
// Should never happen, log an error and break.
// TODO(calin): It's unclear if we should just assert here.
@@ -962,7 +962,7 @@
WellKnownClasses::dalvik_system_DexFile);
for (int32_t i = 0; i < dex_elements->GetLength(); ++i) {
- mirror::Object* element = dex_elements->GetWithoutChecks(i);
+ ObjPtr<mirror::Object> element = dex_elements->GetWithoutChecks(i);
// We can hit a null element here because this is invoked with a partially filled dex_elements
// array from DexPathList. DexPathList will open each dex sequentially, each time passing the
// list of dex files which were opened before.
diff --git a/runtime/class_loader_context_test.cc b/runtime/class_loader_context_test.cc
index 7fba830..8452675 100644
--- a/runtime/class_loader_context_test.cc
+++ b/runtime/class_loader_context_test.cc
@@ -1051,7 +1051,7 @@
Handle<mirror::ObjectArray<mirror::ClassLoader>> shared_libraries_2(
hs.NewHandle(raw_shared_libraries->AsObjectArray<mirror::ClassLoader>()));
ASSERT_EQ(shared_libraries_2->GetLength(), 1);
- ASSERT_EQ(shared_libraries_2->Get(0), class_loader_2.Get());
+ ASSERT_OBJ_PTR_EQ(shared_libraries_2->Get(0), class_loader_2.Get());
// Class loaders should have the BootClassLoader as a parent.
ASSERT_TRUE(class_loader_2->GetParent()->GetClass() ==
diff --git a/runtime/common_runtime_test.h b/runtime/common_runtime_test.h
index b3d7883..fb3eae7 100644
--- a/runtime/common_runtime_test.h
+++ b/runtime/common_runtime_test.h
@@ -41,12 +41,6 @@
using LogSeverity = android::base::LogSeverity;
using ScopedLogSeverity = android::base::ScopedLogSeverity;
-// OBJ pointer helpers to avoid needing .Decode everywhere.
-#define EXPECT_OBJ_PTR_EQ(a, b) EXPECT_EQ(MakeObjPtr(a).Ptr(), MakeObjPtr(b).Ptr());
-#define ASSERT_OBJ_PTR_EQ(a, b) ASSERT_EQ(MakeObjPtr(a).Ptr(), MakeObjPtr(b).Ptr());
-#define EXPECT_OBJ_PTR_NE(a, b) EXPECT_NE(MakeObjPtr(a).Ptr(), MakeObjPtr(b).Ptr());
-#define ASSERT_OBJ_PTR_NE(a, b) ASSERT_NE(MakeObjPtr(a).Ptr(), MakeObjPtr(b).Ptr());
-
class ClassLinker;
class CompilerCallbacks;
class DexFile;
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 9c9fdbb..26ae38a 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -527,7 +527,7 @@
*
* Null objects are tagged JT_OBJECT.
*/
-JDWP::JdwpTag Dbg::TagFromObject(const ScopedObjectAccessUnchecked& soa, mirror::Object* o) {
+JDWP::JdwpTag Dbg::TagFromObject(const ScopedObjectAccessUnchecked& soa, ObjPtr<mirror::Object> o) {
return (o == nullptr) ? JDWP::JT_OBJECT : TagFromClass(soa, o->GetClass());
}
@@ -1277,7 +1277,7 @@
ScopedObjectAccessUnchecked soa(Thread::Current());
mirror::ObjectArray<mirror::Object>* oa = a->AsObjectArray<mirror::Object>();
for (int i = 0; i < count; ++i) {
- mirror::Object* element = oa->Get(offset + i);
+ ObjPtr<mirror::Object> element = oa->Get(offset + i);
JDWP::JdwpTag specific_tag = (element != nullptr) ? TagFromObject(soa, element)
: element_tag;
expandBufAdd1(pReply, specific_tag);
diff --git a/runtime/debugger.h b/runtime/debugger.h
index 33444f8..1dbf8be 100644
--- a/runtime/debugger.h
+++ b/runtime/debugger.h
@@ -709,7 +709,8 @@
return gRegistry;
}
- static JDWP::JdwpTag TagFromObject(const ScopedObjectAccessUnchecked& soa, mirror::Object* o)
+ static JDWP::JdwpTag TagFromObject(const ScopedObjectAccessUnchecked& soa,
+ ObjPtr<mirror::Object> o)
REQUIRES_SHARED(Locks::mutator_lock_);
static JDWP::JdwpTypeTag GetTypeTag(ObjPtr<mirror::Class> klass)
diff --git a/runtime/entrypoints/entrypoint_utils.cc b/runtime/entrypoints/entrypoint_utils.cc
index ad97c31..11365cb 100644
--- a/runtime/entrypoints/entrypoint_utils.cc
+++ b/runtime/entrypoints/entrypoint_utils.cc
@@ -123,13 +123,13 @@
} else {
// In the case of checked exceptions that aren't declared, the exception must be wrapped by
// a UndeclaredThrowableException.
- mirror::Throwable* exception = soa.Self()->GetException();
+ ObjPtr<mirror::Throwable> exception = soa.Self()->GetException();
if (exception->IsCheckedException()) {
bool declares_exception = false;
{
ScopedAssertNoThreadSuspension ants(__FUNCTION__);
ObjPtr<mirror::Object> rcvr = soa.Decode<mirror::Object>(rcvr_jobj);
- mirror::Class* proxy_class = rcvr->GetClass();
+ ObjPtr<mirror::Class> proxy_class = rcvr->GetClass();
ObjPtr<mirror::Method> interface_method = soa.Decode<mirror::Method>(interface_method_jobj);
ArtMethod* proxy_method = rcvr->GetClass()->FindVirtualMethodForInterface(
interface_method->GetArtMethod(), kRuntimePointerSize);
@@ -141,11 +141,11 @@
int throws_index = (reinterpret_cast<uintptr_t>(proxy_method) -
reinterpret_cast<uintptr_t>(&virtual_methods[0])) / method_size;
CHECK_LT(throws_index, static_cast<int>(num_virtuals));
- mirror::ObjectArray<mirror::Class>* declared_exceptions =
+ ObjPtr<mirror::ObjectArray<mirror::Class>> declared_exceptions =
proxy_class->GetProxyThrows()->Get(throws_index);
- mirror::Class* exception_class = exception->GetClass();
+ ObjPtr<mirror::Class> exception_class = exception->GetClass();
for (int32_t i = 0; i < declared_exceptions->GetLength() && !declares_exception; i++) {
- mirror::Class* declared_exception = declared_exceptions->Get(i);
+ ObjPtr<mirror::Class> declared_exception = declared_exceptions->Get(i);
declares_exception = declared_exception->IsAssignableFrom(exception_class);
}
}
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index 9b5b73c..e488175 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -505,7 +505,8 @@
const {}
void VisitRoot(mirror::CompressedReference<mirror::Object>* root ATTRIBUTE_UNUSED) const {}
- void VisitDexCacheArrays(mirror::DexCache* dex_cache) REQUIRES_SHARED(Locks::mutator_lock_) {
+ void VisitDexCacheArrays(ObjPtr<mirror::DexCache> dex_cache)
+ REQUIRES_SHARED(Locks::mutator_lock_) {
FixupDexCacheArray<mirror::StringDexCacheType>(dex_cache,
mirror::DexCache::StringsOffset(),
dex_cache->NumStrings<kVerifyNone>());
@@ -611,7 +612,7 @@
}
template <typename EntryType>
- void FixupDexCacheArray(mirror::DexCache* dex_cache,
+ void FixupDexCacheArray(ObjPtr<mirror::DexCache> dex_cache,
MemberOffset array_offset,
uint32_t size) REQUIRES_SHARED(Locks::mutator_lock_) {
EntryType* old_array =
@@ -1262,7 +1263,7 @@
auto* dex_caches = image_header.GetImageRoot<kWithoutReadBarrier>(ImageHeader::kDexCaches)->
AsObjectArray<mirror::DexCache, kVerifyNone>();
for (int32_t i = 0, count = dex_caches->GetLength(); i < count; ++i) {
- mirror::DexCache* dex_cache = dex_caches->Get<kVerifyNone, kWithoutReadBarrier>(i);
+ ObjPtr<mirror::DexCache> dex_cache = dex_caches->Get<kVerifyNone, kWithoutReadBarrier>(i);
CHECK(dex_cache != nullptr);
patch_object_visitor.VisitDexCacheArrays(dex_cache);
}
diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc
index f5ac43b..b89ece3 100644
--- a/runtime/hprof/hprof.cc
+++ b/runtime/hprof/hprof.cc
@@ -250,7 +250,7 @@
REQUIRES_SHARED(Locks::mutator_lock_) {
const int32_t length = values->GetLength();
for (int32_t i = 0; i < length; ++i) {
- AddObjectId(values->GetWithoutChecks(i));
+ AddObjectId(values->GetWithoutChecks(i).Ptr());
}
}
diff --git a/runtime/interpreter/mterp/mterp.cc b/runtime/interpreter/mterp/mterp.cc
index 73c2cfe..8c372d4 100644
--- a/runtime/interpreter/mterp/mterp.cc
+++ b/runtime/interpreter/mterp/mterp.cc
@@ -857,9 +857,9 @@
ThrowNullPointerExceptionFromInterpreter();
return nullptr;
}
- mirror::ObjectArray<mirror::Object>* array = arr->AsObjectArray<mirror::Object>();
+ ObjPtr<mirror::ObjectArray<mirror::Object>> array = arr->AsObjectArray<mirror::Object>();
if (LIKELY(array->CheckIsValidIndex(index))) {
- return array->GetWithoutChecks(index);
+ return array->GetWithoutChecks(index).Ptr();
} else {
return nullptr;
}
diff --git a/runtime/interpreter/unstarted_runtime_test.cc b/runtime/interpreter/unstarted_runtime_test.cc
index a8ee23a..495039c 100644
--- a/runtime/interpreter/unstarted_runtime_test.cc
+++ b/runtime/interpreter/unstarted_runtime_test.cc
@@ -132,7 +132,7 @@
CHECK_EQ(array->GetLength(), 3);
CHECK_EQ(data.NumberOfReferences(), 3U);
for (size_t i = 0; i < 3; ++i) {
- EXPECT_EQ(data.GetReference(i), array->Get(static_cast<int32_t>(i))) << i;
+ EXPECT_OBJ_PTR_EQ(data.GetReference(i), array->Get(static_cast<int32_t>(i))) << i;
}
}
diff --git a/runtime/method_handles.cc b/runtime/method_handles.cc
index 15e3a4b..aeeb05b 100644
--- a/runtime/method_handles.cc
+++ b/runtime/method_handles.cc
@@ -23,7 +23,7 @@
#include "interpreter/shadow_frame-inl.h"
#include "jvalue-inl.h"
#include "mirror/class-inl.h"
-#include "mirror/emulated_stack_frame.h"
+#include "mirror/emulated_stack_frame-inl.h"
#include "mirror/method_handle_impl-inl.h"
#include "mirror/method_type.h"
#include "mirror/var_handle.h"
diff --git a/runtime/mirror/emulated_stack_frame-inl.h b/runtime/mirror/emulated_stack_frame-inl.h
new file mode 100644
index 0000000..8dc4c70
--- /dev/null
+++ b/runtime/mirror/emulated_stack_frame-inl.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ART_RUNTIME_MIRROR_EMULATED_STACK_FRAME_INL_H_
+#define ART_RUNTIME_MIRROR_EMULATED_STACK_FRAME_INL_H_
+
+#include "emulated_stack_frame.h"
+
+#include "obj_ptr-inl.h"
+#include "object-inl.h"
+#include "object_array-inl.h"
+
+namespace art {
+namespace mirror {
+
+inline ObjPtr<mirror::MethodType> EmulatedStackFrame::GetType() {
+ return GetFieldObject<MethodType>(OFFSET_OF_OBJECT_MEMBER(EmulatedStackFrame, type_));
+}
+
+inline ObjPtr<mirror::Object> EmulatedStackFrame::GetReceiver() {
+ return GetReferences()->Get(0);
+}
+
+inline ObjPtr<mirror::ObjectArray<mirror::Object>> EmulatedStackFrame::GetReferences() {
+ return GetFieldObject<mirror::ObjectArray<mirror::Object>>(
+ OFFSET_OF_OBJECT_MEMBER(EmulatedStackFrame, references_));
+}
+
+inline ObjPtr<mirror::ByteArray> EmulatedStackFrame::GetStackFrame() {
+ return GetFieldObject<mirror::ByteArray>(
+ OFFSET_OF_OBJECT_MEMBER(EmulatedStackFrame, stack_frame_));
+}
+
+} // namespace mirror
+} // namespace art
+
+#endif // ART_RUNTIME_MIRROR_EMULATED_STACK_FRAME_INL_H_
diff --git a/runtime/mirror/emulated_stack_frame.cc b/runtime/mirror/emulated_stack_frame.cc
index 001469c..6ae577c 100644
--- a/runtime/mirror/emulated_stack_frame.cc
+++ b/runtime/mirror/emulated_stack_frame.cc
@@ -14,15 +14,17 @@
* limitations under the License.
*/
-#include "emulated_stack_frame.h"
+#include "emulated_stack_frame-inl.h"
#include "array-alloc-inl.h"
#include "array-inl.h"
#include "class-alloc-inl.h"
#include "class_root.h"
+#include "handle.h"
#include "jvalue-inl.h"
#include "method_handles-inl.h"
#include "method_handles.h"
+#include "method_type.h"
#include "object_array-alloc-inl.h"
#include "object_array-inl.h"
#include "reflection-inl.h"
@@ -141,7 +143,7 @@
DISALLOW_COPY_AND_ASSIGN(EmulatedStackFrameAccessor);
};
-mirror::EmulatedStackFrame* EmulatedStackFrame::CreateFromShadowFrameAndArgs(
+ObjPtr<mirror::EmulatedStackFrame> EmulatedStackFrame::CreateFromShadowFrameAndArgs(
Thread* self,
Handle<mirror::MethodType> caller_type,
Handle<mirror::MethodType> callee_type,
diff --git a/runtime/mirror/emulated_stack_frame.h b/runtime/mirror/emulated_stack_frame.h
index ec45f57..626215e 100644
--- a/runtime/mirror/emulated_stack_frame.h
+++ b/runtime/mirror/emulated_stack_frame.h
@@ -19,10 +19,9 @@
#include "base/utils.h"
#include "dex/dex_instruction.h"
-#include "method_type.h"
+#include "handle.h"
#include "object.h"
#include "stack.h"
-#include "string.h"
namespace art {
@@ -30,12 +29,14 @@
namespace mirror {
+class MethodType;
+
// C++ mirror of dalvik.system.EmulatedStackFrame
class MANAGED EmulatedStackFrame : public Object {
public:
// Creates an emulated stack frame whose type is |frame_type| from
// a shadow frame.
- static mirror::EmulatedStackFrame* CreateFromShadowFrameAndArgs(
+ static ObjPtr<mirror::EmulatedStackFrame> CreateFromShadowFrameAndArgs(
Thread* self,
Handle<mirror::MethodType> args_type,
Handle<mirror::MethodType> frame_type,
@@ -56,24 +57,14 @@
// Sets the return value slot of this emulated stack frame to |value|.
void SetReturnValue(Thread* self, const JValue& value) REQUIRES_SHARED(Locks::mutator_lock_);
- mirror::MethodType* GetType() REQUIRES_SHARED(Locks::mutator_lock_) {
- return GetFieldObject<MethodType>(OFFSET_OF_OBJECT_MEMBER(EmulatedStackFrame, type_));
- }
+ ObjPtr<mirror::MethodType> GetType() REQUIRES_SHARED(Locks::mutator_lock_);
- mirror::Object* GetReceiver() REQUIRES_SHARED(Locks::mutator_lock_) {
- return GetReferences()->Get(0);
- }
+ ObjPtr<mirror::Object> GetReceiver() REQUIRES_SHARED(Locks::mutator_lock_);
private:
- mirror::ObjectArray<mirror::Object>* GetReferences() REQUIRES_SHARED(Locks::mutator_lock_) {
- return GetFieldObject<mirror::ObjectArray<mirror::Object>>(
- OFFSET_OF_OBJECT_MEMBER(EmulatedStackFrame, references_));
- }
+ ObjPtr<mirror::ObjectArray<mirror::Object>> GetReferences() REQUIRES_SHARED(Locks::mutator_lock_);
- mirror::ByteArray* GetStackFrame() REQUIRES_SHARED(Locks::mutator_lock_) {
- return GetFieldObject<mirror::ByteArray>(
- OFFSET_OF_OBJECT_MEMBER(EmulatedStackFrame, stack_frame_));
- }
+ ObjPtr<mirror::ByteArray> GetStackFrame() REQUIRES_SHARED(Locks::mutator_lock_);
static MemberOffset CallsiteTypeOffset() {
return MemberOffset(OFFSETOF_MEMBER(EmulatedStackFrame, callsite_type_));
diff --git a/runtime/mirror/iftable-inl.h b/runtime/mirror/iftable-inl.h
index 225a36d..b9bd21c 100644
--- a/runtime/mirror/iftable-inl.h
+++ b/runtime/mirror/iftable-inl.h
@@ -44,7 +44,7 @@
template<VerifyObjectFlags kVerifyFlags,
ReadBarrierOption kReadBarrierOption>
inline ObjPtr<PointerArray> IfTable::GetMethodArrayOrNull(int32_t i) {
- return down_cast<PointerArray*>(
+ return ObjPtr<PointerArray>::DownCast(
Get<kVerifyFlags, kReadBarrierOption>((i * kMax) + kMethodArray));
}
diff --git a/runtime/mirror/method_type.cc b/runtime/mirror/method_type.cc
index 6533656..11d7756 100644
--- a/runtime/mirror/method_type.cc
+++ b/runtime/mirror/method_type.cc
@@ -102,7 +102,7 @@
// types requiring a second vreg.
size_t num_vregs = static_cast<size_t>(p_types_length);
for (int32_t i = 0; i < p_types_length; ++i) {
- Class* klass = p_types->GetWithoutChecks(i);
+ ObjPtr<Class> klass = p_types->GetWithoutChecks(i);
if (klass->IsPrimitiveLong() || klass->IsPrimitiveDouble()) {
++num_vregs;
}
diff --git a/runtime/mirror/object_array-inl.h b/runtime/mirror/object_array-inl.h
index d318887..42cabab 100644
--- a/runtime/mirror/object_array-inl.h
+++ b/runtime/mirror/object_array-inl.h
@@ -36,7 +36,7 @@
namespace mirror {
template<class T> template<VerifyObjectFlags kVerifyFlags, ReadBarrierOption kReadBarrierOption>
-inline T* ObjectArray<T>::Get(int32_t i) {
+inline ObjPtr<T> ObjectArray<T>::Get(int32_t i) {
if (!CheckIsValidIndex<kVerifyFlags>(i)) {
DCHECK(Thread::Current()->IsExceptionPending());
return nullptr;
@@ -94,7 +94,7 @@
}
template<class T> template<VerifyObjectFlags kVerifyFlags, ReadBarrierOption kReadBarrierOption>
-inline T* ObjectArray<T>::GetWithoutChecks(int32_t i) {
+inline ObjPtr<T> ObjectArray<T>::GetWithoutChecks(int32_t i) {
DCHECK(CheckIsValidIndex(i));
return GetFieldObject<T, kVerifyFlags, kReadBarrierOption>(OffsetOfElement(i));
}
@@ -129,7 +129,7 @@
reinterpret_cast<uintptr_t>(src.Ptr()) | fake_address_dependency));
for (int i = 0; i < count; ++i) {
// We can skip the RB here because 'src' isn't gray.
- T* obj = src->template GetWithoutChecks<kDefaultVerifyFlags, kWithoutReadBarrier>(
+ ObjPtr<T> obj = src->template GetWithoutChecks<kDefaultVerifyFlags, kWithoutReadBarrier>(
src_pos + i);
SetWithoutChecksAndWriteBarrier<false>(dst_pos + i, obj);
}
@@ -138,7 +138,7 @@
if (!baker_non_gray_case) {
for (int i = 0; i < count; ++i) {
// We need a RB here. ObjectArray::GetWithoutChecks() contains a RB.
- T* obj = src->GetWithoutChecks(src_pos + i);
+ ObjPtr<T> obj = src->GetWithoutChecks(src_pos + i);
SetWithoutChecksAndWriteBarrier<false>(dst_pos + i, obj);
}
}
@@ -154,7 +154,7 @@
reinterpret_cast<uintptr_t>(src.Ptr()) | fake_address_dependency));
for (int i = count - 1; i >= 0; --i) {
// We can skip the RB here because 'src' isn't gray.
- T* obj = src->template GetWithoutChecks<kDefaultVerifyFlags, kWithoutReadBarrier>(
+ ObjPtr<T> obj = src->template GetWithoutChecks<kDefaultVerifyFlags, kWithoutReadBarrier>(
src_pos + i);
SetWithoutChecksAndWriteBarrier<false>(dst_pos + i, obj);
}
@@ -163,7 +163,7 @@
if (!baker_non_gray_case) {
for (int i = count - 1; i >= 0; --i) {
// We need a RB here. ObjectArray::GetWithoutChecks() contains a RB.
- T* obj = src->GetWithoutChecks(src_pos + i);
+ ObjPtr<T> obj = src->GetWithoutChecks(src_pos + i);
SetWithoutChecksAndWriteBarrier<false>(dst_pos + i, obj);
}
}
@@ -204,8 +204,8 @@
reinterpret_cast<uintptr_t>(src.Ptr()) | fake_address_dependency));
for (int i = 0; i < count; ++i) {
// We can skip the RB here because 'src' isn't gray.
- Object* obj = src->template GetWithoutChecks<kDefaultVerifyFlags, kWithoutReadBarrier>(
- src_pos + i);
+ ObjPtr<Object> obj =
+ src->template GetWithoutChecks<kDefaultVerifyFlags, kWithoutReadBarrier>(src_pos + i);
SetWithoutChecksAndWriteBarrier<false>(dst_pos + i, obj);
}
}
@@ -213,7 +213,7 @@
if (!baker_non_gray_case) {
for (int i = 0; i < count; ++i) {
// We need a RB here. ObjectArray::GetWithoutChecks() contains a RB.
- T* obj = src->GetWithoutChecks(src_pos + i);
+ ObjPtr<T> obj = src->GetWithoutChecks(src_pos + i);
SetWithoutChecksAndWriteBarrier<false>(dst_pos + i, obj);
}
}
diff --git a/runtime/mirror/object_array.h b/runtime/mirror/object_array.h
index 6506f6e..f7046d1 100644
--- a/runtime/mirror/object_array.h
+++ b/runtime/mirror/object_array.h
@@ -44,7 +44,7 @@
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags,
ReadBarrierOption kReadBarrierOption = kWithReadBarrier>
- ALWAYS_INLINE T* Get(int32_t i) REQUIRES_SHARED(Locks::mutator_lock_);
+ ALWAYS_INLINE ObjPtr<T> Get(int32_t i) REQUIRES_SHARED(Locks::mutator_lock_);
// Returns true if the object can be stored into the array. If not, throws
// an ArrayStoreException and returns false.
@@ -74,7 +74,7 @@
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags,
ReadBarrierOption kReadBarrierOption = kWithReadBarrier>
- ALWAYS_INLINE T* GetWithoutChecks(int32_t i) REQUIRES_SHARED(Locks::mutator_lock_);
+ ALWAYS_INLINE ObjPtr<T> GetWithoutChecks(int32_t i) REQUIRES_SHARED(Locks::mutator_lock_);
// Copy src into this array (dealing with overlaps as memmove does) without assignability checks.
void AssignableMemmove(int32_t dst_pos,
diff --git a/runtime/mirror/throwable.cc b/runtime/mirror/throwable.cc
index 82e295a..2d6a9eb 100644
--- a/runtime/mirror/throwable.cc
+++ b/runtime/mirror/throwable.cc
@@ -134,7 +134,7 @@
result += "(Throwable with empty stack trace)\n";
} else {
for (int32_t i = 0; i < ste_array->GetLength(); ++i) {
- StackTraceElement* ste = ste_array->Get(i);
+ ObjPtr<StackTraceElement> ste = ste_array->Get(i);
DCHECK(ste != nullptr);
auto* method_name = ste->GetMethodName();
auto* file_name = ste->GetFileName();
diff --git a/runtime/native/java_lang_reflect_Method.cc b/runtime/native/java_lang_reflect_Method.cc
index c65541d..4525157 100644
--- a/runtime/native/java_lang_reflect_Method.cc
+++ b/runtime/native/java_lang_reflect_Method.cc
@@ -59,7 +59,7 @@
++i;
}
CHECK_NE(throws_index, -1);
- mirror::ObjectArray<mirror::Class>* declared_exceptions =
+ ObjPtr<mirror::ObjectArray<mirror::Class>> declared_exceptions =
klass->GetProxyThrows()->Get(throws_index);
return soa.AddLocalReference<jobjectArray>(declared_exceptions->Clone(soa.Self()));
} else {