Move mirror::Class to use ObjPtr
Leave the return types as non ObjPtr for now. Fixed moving GC bugs
in tests.
Test: test-art-host
Bug: 31113334
Change-Id: I5da1b5ac55dfbc5cc97a64be2c870ba9f512d9b0
diff --git a/runtime/mirror/method.cc b/runtime/mirror/method.cc
index 71bac7e..7ddadda 100644
--- a/runtime/mirror/method.cc
+++ b/runtime/mirror/method.cc
@@ -54,12 +54,12 @@
template <PointerSize kPointerSize, bool kTransactionActive>
Method* Method::CreateFromArtMethod(Thread* self, ArtMethod* method) {
DCHECK(!method->IsConstructor()) << PrettyMethod(method);
- auto* ret = down_cast<Method*>(StaticClass()->AllocObject(self));
+ ObjPtr<Method> ret = ObjPtr<Method>::DownCast(StaticClass()->AllocObject(self));
if (LIKELY(ret != nullptr)) {
- static_cast<Executable*>(ret)->
+ ObjPtr<Executable>(ret)->
CreateFromArtMethod<kPointerSize, kTransactionActive>(method);
}
- return ret;
+ return ret.Ptr();
}
template Method* Method::CreateFromArtMethod<PointerSize::k32, false>(Thread* self,
@@ -106,12 +106,12 @@
template <PointerSize kPointerSize, bool kTransactionActive>
Constructor* Constructor::CreateFromArtMethod(Thread* self, ArtMethod* method) {
DCHECK(method->IsConstructor()) << PrettyMethod(method);
- auto* ret = down_cast<Constructor*>(StaticClass()->AllocObject(self));
+ ObjPtr<Constructor> ret = ObjPtr<Constructor>::DownCast(StaticClass()->AllocObject(self));
if (LIKELY(ret != nullptr)) {
- static_cast<Executable*>(ret)->
+ ObjPtr<Executable>(ret)->
CreateFromArtMethod<kPointerSize, kTransactionActive>(method);
}
- return ret;
+ return ret.Ptr();
}
template Constructor* Constructor::CreateFromArtMethod<PointerSize::k32, false>(