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/class_linker.h b/runtime/class_linker.h
index 4ebce3e..88a2501 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -454,6 +454,11 @@
bool MayBeCalledWithDirectCodePointer(mirror::ArtMethod* m)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ // Creates a GlobalRef PathClassLoader that can be used to load classes from the given dex files.
+ // Note: the objects are not completely set up. Do not use this outside of tests and the compiler.
+ jobject CreatePathClassLoader(Thread* self, std::vector<const DexFile*>& dex_files)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
private:
static void InitFromImageInterpretOnlyCallback(mirror::Object* obj, void* arg)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);