From 28bd2e4f151267b34b8e1eb19c489d8d547bbf5c Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Tue, 4 Oct 2016 13:54:57 -0700 Subject: 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 --- runtime/class_linker.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'runtime/class_linker.cc') diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 48d31a4c3e..14cbf24feb 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -2218,7 +2218,7 @@ mirror::DexCache* ClassLinker::AllocDexCache(mirror::String** out_location, const DexFile& dex_file) { StackHandleScope<1> hs(self); DCHECK(out_location != nullptr); - auto dex_cache(hs.NewHandle(down_cast( + auto dex_cache(hs.NewHandle(ObjPtr::DownCast( GetClassRoot(kJavaLangDexCache)->AllocObject(self)))); if (dex_cache.Get() == nullptr) { self->AssertPendingOOMException(); @@ -4749,7 +4749,7 @@ bool ClassLinker::InitializeDefaultInterfaceRecursive(Thread* self, MutableHandle handle_super_iface(hs.NewHandle(nullptr)); // First we initialize all of iface's super-interfaces recursively. for (size_t i = 0; i < num_direct_ifaces; i++) { - mirror::Class* super_iface = mirror::Class::GetDirectInterface(self, iface, i); + ObjPtr super_iface = mirror::Class::GetDirectInterface(self, iface, i); if (!super_iface->HasBeenRecursivelyInitialized()) { // Recursive step handle_super_iface.Assign(super_iface); @@ -6493,7 +6493,7 @@ bool ClassLinker::SetupInterfaceLookupTable(Thread* self, Handle size_t ifcount = super_ifcount + num_interfaces; // Check that every class being implemented is an interface. for (size_t i = 0; i < num_interfaces; i++) { - mirror::Class* interface = have_interfaces + ObjPtr interface = have_interfaces ? interfaces->GetWithoutChecks(i) : mirror::Class::GetDirectInterface(self, klass, i); DCHECK(interface != nullptr); @@ -6532,9 +6532,9 @@ bool ClassLinker::SetupInterfaceLookupTable(Thread* self, Handle ScopedAssertNoThreadSuspension nts("Copying mirror::Class*'s for FillIfTable"); std::vector to_add; for (size_t i = 0; i < num_interfaces; i++) { - mirror::Class* interface = have_interfaces ? interfaces->Get(i) : + ObjPtr interface = have_interfaces ? interfaces->Get(i) : mirror::Class::GetDirectInterface(self, klass, i); - to_add.push_back(interface); + to_add.push_back(interface.Ptr()); } new_ifcount = FillIfTable(iftable.Get(), super_ifcount, std::move(to_add)); @@ -8298,7 +8298,7 @@ jobject ClassLinker::CreatePathClassLoader(Thread* self, mirror::Class::FindField(self, hs.NewHandle(h_path_class_loader->GetClass()), "parent", "Ljava/lang/ClassLoader;"); DCHECK(parent_field != nullptr); - mirror::Object* boot_cl = + ObjPtr boot_cl = soa.Decode(WellKnownClasses::java_lang_BootClassLoader)->AllocObject(self); parent_field->SetObject(h_path_class_loader.Get(), boot_cl); -- cgit v1.2.3-59-g8ed1b