summaryrefslogtreecommitdiff
path: root/runtime/class_loader_utils.h
diff options
context:
space:
mode:
author David Brazdil <dbrazdil@google.com> 2018-12-06 16:25:16 +0000
committer David Brazdil <dbrazdil@google.com> 2018-12-06 19:34:02 +0000
commit05909d81d322c0b20445e672c338c626e43f650d (patch)
tree3a8edef57fce12fa3d69a783f6b9523b203c85e6 /runtime/class_loader_utils.h
parent69431d3ba1c560f0b23bd2ad6257949deb679aa7 (diff)
Support class lookup for InMemoryDexClassLoader
Setting up InMemoryDexClassLoader with 'null' as parent results in the class loader not being able to load any boot classpath classes. This is due to the fact that InMemoryDexClassLoader inherits class lookup from BaseDexClassLoader which delegates it to ART, but ART rejects InMemoryDexClassLoader as not supported. Bug: 120603906 Bug: 120613979 Test: InMemoryDexClassLoaderTest Change-Id: I3139b1bb343b5fc722bcf06f89a6f6a21a3c7c54
Diffstat (limited to 'runtime/class_loader_utils.h')
-rw-r--r--runtime/class_loader_utils.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/runtime/class_loader_utils.h b/runtime/class_loader_utils.h
index 945d659396..ab28cf8c7d 100644
--- a/runtime/class_loader_utils.h
+++ b/runtime/class_loader_utils.h
@@ -29,7 +29,7 @@
namespace art {
// Returns true if the given class loader is either a PathClassLoader or a DexClassLoader.
-// (they both have the same behaviour with respect to class lockup order)
+// (they both have the same behaviour with respect to class lookup order)
inline bool IsPathOrDexClassLoader(ScopedObjectAccessAlreadyRunnable& soa,
Handle<mirror::ClassLoader> class_loader)
REQUIRES_SHARED(Locks::mutator_lock_) {
@@ -41,6 +41,15 @@ inline bool IsPathOrDexClassLoader(ScopedObjectAccessAlreadyRunnable& soa,
soa.Decode<mirror::Class>(WellKnownClasses::dalvik_system_DexClassLoader));
}
+// Returns true if the given class loader is an InMemoryDexClassLoader.
+inline bool IsInMemoryDexClassLoader(ScopedObjectAccessAlreadyRunnable& soa,
+ Handle<mirror::ClassLoader> class_loader)
+ REQUIRES_SHARED(Locks::mutator_lock_) {
+ mirror::Class* class_loader_class = class_loader->GetClass();
+ return (class_loader_class ==
+ soa.Decode<mirror::Class>(WellKnownClasses::dalvik_system_InMemoryDexClassLoader));
+}
+
inline bool IsDelegateLastClassLoader(ScopedObjectAccessAlreadyRunnable& soa,
Handle<mirror::ClassLoader> class_loader)
REQUIRES_SHARED(Locks::mutator_lock_) {