From eda46e9cad4271af7188fe0f542cbe88679f4c6e Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Mon, 18 Feb 2019 12:38:19 +0000 Subject: Fix vdex fast-verify performance regression Recent CL I0d06b82e31088c58d4493723a5435309740f1d0c generalized the fast-verify class redefinition check by checking that all vdex-verified classes resolve to dex files covered by the vdex and are not duplicates of classes in parent class loaders. This introduced a performance and allocated memory regression for dex2oat invoked with compiler-filter=verify(-profile). This patch removes the regression by acquiring a list of classpath dex files from the compiler driver and boot classpath dex files from the class linker, avoiding class resolution altogether. A small performance overhead remains as previously only boot classpath was being searched. Test: run `dex2oat filter=interpret-only; dex2oat filter=verify` compare time and allocated memory numbers before CL and after Change-Id: Ifd690cdafdc99d3eafb9847d67775fc11a5b5023 --- compiler/driver/compiler_driver.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'compiler/driver/compiler_driver.cc') diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index 54e94d0ba2..33201cf476 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -1786,7 +1786,13 @@ bool CompilerDriver::FastVerify(jobject jclass_loader, hs.NewHandle(soa.Decode(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; } -- cgit v1.2.3-59-g8ed1b