summaryrefslogtreecommitdiff
path: root/runtime/class_linker.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r--runtime/class_linker.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index b61fb4afe9..e7ee9f2826 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -4252,17 +4252,16 @@ bool ClassLinker::VerifyClassUsingOatFile(const DexFile& dex_file,
ClassStatus& oat_file_class_status) {
// If we're compiling, we can only verify the class using the oat file if
// we are not compiling the image or if the class we're verifying is not part of
- // the app. In other words, we will only check for preverification of bootclasspath
- // classes.
+ // the compilation unit (app - dependencies). We will let the compiler callback
+ // tell us about the latter.
if (Runtime::Current()->IsAotCompiler()) {
+ CompilerCallbacks* callbacks = Runtime::Current()->GetCompilerCallbacks();
// Are we compiling the bootclasspath?
- if (Runtime::Current()->GetCompilerCallbacks()->IsBootImage()) {
+ if (callbacks->IsBootImage()) {
return false;
}
// We are compiling an app (not the image).
-
- // Is this an app class? (I.e. not a bootclasspath class)
- if (klass->GetClassLoader() != nullptr) {
+ if (!callbacks->CanUseOatStatusForVerification(klass.Ptr())) {
return false;
}
}
@@ -4483,6 +4482,14 @@ mirror::Class* ClassLinker::CreateProxyClass(ScopedObjectAccessAlreadyRunnable&
Runtime::Current()->GetRuntimeCallbacks()->ClassPrepare(temp_klass, klass);
+ // SubtypeCheckInfo::Initialized must happen-before any new-instance for that type.
+ // See also ClassLinker::EnsureInitialized().
+ {
+ MutexLock subtype_check_lock(Thread::Current(), *Locks::subtype_check_lock_);
+ SubtypeCheck<ObjPtr<mirror::Class>>::EnsureInitialized(klass.Get());
+ // TODO: Avoid taking subtype_check_lock_ if SubtypeCheck for j.l.r.Proxy is already assigned.
+ }
+
{
// Lock on klass is released. Lock new class object.
ObjectLock<mirror::Class> initialization_lock(self, klass);