summaryrefslogtreecommitdiff
path: root/compiler/driver/compiler_driver.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/driver/compiler_driver.cc')
-rw-r--r--compiler/driver/compiler_driver.cc29
1 files changed, 22 insertions, 7 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index e9a3d550d9..1c9830bd94 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -1784,7 +1784,13 @@ bool CompilerDriver::FastVerify(jobject jclass_loader,
hs.NewHandle(soa.Decode<mirror::ClassLoader>(jclass_loader)));
std::string error_msg;
- if (!verifier_deps->ValidateDependencies(class_loader, soa.Self(), &error_msg)) {
+ if (!verifier_deps->ValidateDependencies(
+ soa.Self(),
+ class_loader,
+ // This returns classpath dex files in no particular order but VerifierDeps
+ // does not care about the order.
+ classpath_classes_.GetDexFiles(),
+ &error_msg)) {
LOG(WARNING) << "Fast verification failed: " << error_msg;
return false;
}
@@ -1797,11 +1803,11 @@ bool CompilerDriver::FastVerify(jobject jclass_loader,
// time. So instead we assume these classes still need to be verified at
// runtime.
for (const DexFile* dex_file : dex_files) {
- // Fetch the list of unverified classes.
- const std::set<dex::TypeIndex>& unverified_classes =
- verifier_deps->GetUnverifiedClasses(*dex_file);
+ // Fetch the list of verified classes.
+ const std::vector<bool>& verified_classes = verifier_deps->GetVerifiedClasses(*dex_file);
+ DCHECK_EQ(verified_classes.size(), dex_file->NumClassDefs());
for (ClassAccessor accessor : dex_file->GetClasses()) {
- if (unverified_classes.find(accessor.GetClassIdx()) == unverified_classes.end()) {
+ if (verified_classes[accessor.GetClassDefIndex()]) {
if (compiler_only_verifies) {
// Just update the compiled_classes_ map. The compiler doesn't need to resolve
// the type.
@@ -1951,6 +1957,16 @@ class VerifyClassVisitor : public CompilationVisitor {
}
} else if (&klass->GetDexFile() != &dex_file) {
// Skip a duplicate class (as the resolved class is from another, earlier dex file).
+ // Record the information that we skipped this class in the vdex.
+ // If the class resolved to a dex file not covered by the vdex, e.g. boot class path,
+ // it is considered external, dependencies on it will be recorded and the vdex will
+ // remain usable regardless of whether the class remains redefined or not (in the
+ // latter case, this class will be verify-at-runtime).
+ // On the other hand, if the class resolved to a dex file covered by the vdex, i.e.
+ // a different dex file within the same APK, this class will always be eclipsed by it.
+ // Recording that it was redefined is not necessary but will save class resolution
+ // time during fast-verify.
+ verifier::VerifierDeps::MaybeRecordClassRedefinition(dex_file, class_def);
return; // Do not update state.
} else if (!SkipClass(jclass_loader, dex_file, klass.Get())) {
CHECK(klass->IsResolved()) << klass->PrettyClass();
@@ -1999,8 +2015,7 @@ class VerifyClassVisitor : public CompilationVisitor {
// Make the skip a soft failure, essentially being considered as verify at runtime.
failure_kind = verifier::FailureKind::kSoftFailure;
}
- verifier::VerifierDeps::MaybeRecordVerificationStatus(
- dex_file, class_def.class_idx_, failure_kind);
+ verifier::VerifierDeps::MaybeRecordVerificationStatus(dex_file, class_def, failure_kind);
soa.Self()->AssertNoPendingException();
}