Move ArtField to ObjPtr
Added EXPECT_OBJ_PTR_EQ and variants to gtests.
Fixed moving GC bugs in:
ClassLinker::CreatePathClassLoader
ClassLinkerTest: StaticFields
ObjPtr Decode call sites: 186 -> 181.
Some tests fail due to ResolvedFieldAccessTest, will fix in follow
up CL.
Bug: 31113334
Test: test-art-host CC baker
Change-Id: I8b266ad00f3c20c8cbe7cfdf280d175083df0b88
diff --git a/runtime/art_field.cc b/runtime/art_field.cc
index 3b4db0b..78c62d6 100644
--- a/runtime/art_field.cc
+++ b/runtime/art_field.cc
@@ -30,10 +30,6 @@
namespace art {
-ArtField::ArtField() : access_flags_(0), field_dex_idx_(0), offset_(0) {
- declaring_class_ = GcRoot<mirror::Class>(nullptr);
-}
-
void ArtField::SetOffset(MemberOffset num_bytes) {
DCHECK(GetDeclaringClass()->IsLoaded() || GetDeclaringClass()->IsErroneous());
if (kIsDebugBuild && Runtime::Current()->IsAotCompiler() &&
@@ -47,20 +43,23 @@
offset_ = num_bytes.Uint32Value();
}
-mirror::Class* ArtField::ProxyFindSystemClass(const char* descriptor) {
+ObjPtr<mirror::Class> ArtField::ProxyFindSystemClass(const char* descriptor) {
DCHECK(GetDeclaringClass()->IsProxyClass());
return Runtime::Current()->GetClassLinker()->FindSystemClass(Thread::Current(), descriptor);
}
-mirror::Class* ArtField::ResolveGetType(uint32_t type_idx) {
+ObjPtr<mirror::Class> ArtField::ResolveGetType(uint32_t type_idx) {
return Runtime::Current()->GetClassLinker()->ResolveType(type_idx, this);
}
-mirror::String* ArtField::ResolveGetStringName(Thread* self, const DexFile& dex_file,
- uint32_t string_idx, mirror::DexCache* dex_cache) {
+ObjPtr<mirror::String> ArtField::ResolveGetStringName(Thread* self,
+ const DexFile& dex_file,
+ uint32_t string_idx,
+ ObjPtr<mirror::DexCache> dex_cache) {
StackHandleScope<1> hs(self);
- return Runtime::Current()->GetClassLinker()->ResolveString(
- dex_file, string_idx, hs.NewHandle(dex_cache));
+ return Runtime::Current()->GetClassLinker()->ResolveString(dex_file,
+ string_idx,
+ hs.NewHandle(dex_cache));
}
} // namespace art