diff options
author | Andreas Gampe <agampe@google.com> | 2015-03-25 17:19:53 -0700 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2015-03-27 21:43:21 -0700 |
commit | 81c6f8db12b203878a7d72444ead2bc7cf5c47ad (patch) | |
tree | 11caae30b75b700ac648356fd30759a6154be997 /dex2oat | |
parent | cac51526bbd03947676a8d49700425b19a57e447 (diff) | |
download | art-81c6f8db12b203878a7d72444ead2bc7cf5c47ad.zip art-81c6f8db12b203878a7d72444ead2bc7cf5c47ad.tar.gz art-81c6f8db12b203878a7d72444ead2bc7cf5c47ad.tar.bz2 |
ART: PathClassLoader for compiler
Use an actual PathClassLoader when compiling apps, instead of a
side structure and cutout.
This CL sets up a minimal object 'cluster' that recreates the Java
side of a regular ClassLoader such that the Class-Linker will
recognize it and use the internal native fast-path.
This CL removes the now unnecessary compile-time-classpath and
replaces it with a single 'compiling-the-boot-image' flag in the
compiler callbacks.
Note: This functionality is *only* intended for the compiler, as
the objects have not been completely initialized.
Bug: 19781184
Change-Id: I7f36af12dd7852d21281110a25c119e8c0669c1d
Diffstat (limited to 'dex2oat')
-rw-r--r-- | dex2oat/dex2oat.cc | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index dfea783..f1cd30a 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -1053,7 +1053,9 @@ class Dex2Oat FINAL { } verification_results_.reset(new VerificationResults(compiler_options_.get())); - callbacks_.reset(new QuickCompilerCallbacks(verification_results_.get(), &method_inliner_map_)); + callbacks_.reset(new QuickCompilerCallbacks(verification_results_.get(), + &method_inliner_map_, + image_)); runtime_options.push_back(std::make_pair("compilercallbacks", callbacks_.get())); runtime_options.push_back( std::make_pair("imageinstructionset", GetInstructionSetString(instruction_set_))); @@ -1224,19 +1226,16 @@ class Dex2Oat FINAL { ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); OpenClassPathFiles(runtime_->GetClassPathString(), dex_files_, &class_path_files_); ScopedObjectAccess soa(self); - std::vector<const DexFile*> class_path_files(dex_files_); + + // Classpath: first the class-path given. + std::vector<const DexFile*> class_path_files; for (auto& class_path_file : class_path_files_) { class_path_files.push_back(class_path_file.get()); } + // Then the dex files we'll compile. Thus we'll resolve the class-path first. + class_path_files.insert(class_path_files.end(), dex_files_.begin(), dex_files_.end()); - for (size_t i = 0; i < class_path_files.size(); i++) { - class_linker->RegisterDexFile(*class_path_files[i]); - } - soa.Env()->AllocObject(WellKnownClasses::dalvik_system_PathClassLoader); - ScopedLocalRef<jobject> class_loader_local(soa.Env(), - soa.Env()->AllocObject(WellKnownClasses::dalvik_system_PathClassLoader)); - class_loader = soa.Env()->NewGlobalRef(class_loader_local.get()); - Runtime::Current()->SetCompileTimeClassPath(class_loader, class_path_files); + class_loader = class_linker->CreatePathClassLoader(self, class_path_files); } driver_.reset(new CompilerDriver(compiler_options_.get(), |