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
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 9ca00b1..ffe3dc6 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -163,7 +163,6 @@
method_trace_(false),
method_trace_file_size_(0),
instrumentation_(),
- use_compile_time_class_path_(false),
main_thread_group_(nullptr),
system_thread_group_(nullptr),
system_class_loader_(nullptr),
@@ -405,9 +404,9 @@
return true;
}
-static jobject CreateSystemClassLoader() {
- if (Runtime::Current()->UseCompileTimeClassPath()) {
- return NULL;
+static jobject CreateSystemClassLoader(Runtime* runtime) {
+ if (runtime->IsAotCompiler() && !runtime->GetCompilerCallbacks()->IsBootImage()) {
+ return nullptr;
}
ScopedObjectAccess soa(Thread::Current());
@@ -505,7 +504,7 @@
Thread::FinishStartup();
- system_class_loader_ = CreateSystemClassLoader();
+ system_class_loader_ = CreateSystemClassLoader(this);
if (is_zygote_) {
if (!InitZygote()) {
@@ -1483,23 +1482,6 @@
callee_save_methods_[type] = GcRoot<mirror::ArtMethod>(method);
}
-const std::vector<const DexFile*>& Runtime::GetCompileTimeClassPath(jobject class_loader) {
- if (class_loader == NULL) {
- return GetClassLinker()->GetBootClassPath();
- }
- CHECK(UseCompileTimeClassPath());
- CompileTimeClassPaths::const_iterator it = compile_time_class_paths_.find(class_loader);
- CHECK(it != compile_time_class_paths_.end());
- return it->second;
-}
-
-void Runtime::SetCompileTimeClassPath(jobject class_loader,
- std::vector<const DexFile*>& class_path) {
- CHECK(!IsStarted());
- use_compile_time_class_path_ = true;
- compile_time_class_paths_.Put(class_loader, class_path);
-}
-
void Runtime::StartProfiler(const char* profile_output_filename) {
profile_output_filename_ = profile_output_filename;
profiler_started_ =