Revert "Create parent class loader for dex2oat"
Bug: 22858531
This reverts commit d37d364c27e74a7b49970a8c970482e273aa7b1a.
Change-Id: Id71a6f3bb9a29c04a5c13210633674e05d798114
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 3d06295..ddd285a 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -6901,9 +6901,7 @@
}
}
-jobject ClassLinker::CreatePathClassLoader(Thread* self,
- std::vector<const DexFile*>& dex_files,
- jobject parent_loader) {
+jobject ClassLinker::CreatePathClassLoader(Thread* self, std::vector<const DexFile*>& dex_files) {
// SOAAlreadyRunnable is protected, and we need something to add a global reference.
// We could move the jobject to the callers, but all call-sites do this...
ScopedObjectAccessUnchecked soa(self);
@@ -6934,8 +6932,8 @@
for (const DexFile* dex_file : dex_files) {
StackHandleScope<3> hs2(self);
- // CreatePathClassLoader is only used by gtests and dex2oat. Index 0 of h_long_array is
- // supposed to be the oat file but we can leave it null.
+ // CreatePathClassLoader is only used by gtests. Index 0 of h_long_array is supposed to be the
+ // oat file but we can leave it null.
Handle<mirror::LongArray> h_long_array = hs2.NewHandle(mirror::LongArray::Alloc(
self,
kDexFileIndexStart + 1));
@@ -6981,10 +6979,9 @@
mirror::Class::FindField(self, hs.NewHandle(h_path_class_loader->GetClass()), "parent",
"Ljava/lang/ClassLoader;");
DCHECK(parent_field != nullptr);
- mirror::Object* parent = (parent_loader != nullptr)
- ? soa.Decode<mirror::ClassLoader*>(parent_loader)
- : soa.Decode<mirror::Class*>(WellKnownClasses::java_lang_BootClassLoader)->AllocObject(self);
- parent_field->SetObject<false>(h_path_class_loader.Get(), parent);
+ mirror::Object* boot_cl =
+ soa.Decode<mirror::Class*>(WellKnownClasses::java_lang_BootClassLoader)->AllocObject(self);
+ parent_field->SetObject<false>(h_path_class_loader.Get(), boot_cl);
// Make it a global ref and return.
ScopedLocalRef<jobject> local_ref(