From 0733dc87518d2c8fc1ba2196c9f5cc9729de7c20 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Mon, 17 Jul 2017 14:05:28 -0700 Subject: Avoid creating verification_results_ unnecessarily For compiler filters that don't quicken or compile, avoid creating the verification results. This avoids creating some arrays that were using a few MB of RAM in some cases. For a large app verify compile: Maximum resident set size (kbytes): 258948 -> 254300 Bug: 63467744 Test: test-art-host Change-Id: I1d0536b2a6a5c301396641371915394cf4c0e5f3 --- compiler/driver/compiler_driver.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'compiler/driver/compiler_driver.cc') diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index c04e45d334..00a852fddf 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -514,8 +514,9 @@ static void CompileMethod(Thread* self, // TODO: Refactor the compilation to avoid having to distinguish the two passes // here. That should be done on a higher level. http://b/29089975 if (driver->GetCurrentDexToDexMethods()->IsBitSet(method_idx)) { - const VerifiedMethod* verified_method = - driver->GetVerificationResults()->GetVerifiedMethod(method_ref); + VerificationResults* results = driver->GetVerificationResults(); + DCHECK(results != nullptr); + const VerifiedMethod* verified_method = results->GetVerifiedMethod(method_ref); // Do not optimize if a VerifiedMethod is missing. SafeCast elision, // for example, relies on it. compiled_method = optimizer::ArtCompileDEX( @@ -576,12 +577,12 @@ static void CompileMethod(Thread* self, } else if ((access_flags & kAccAbstract) != 0) { // Abstract methods don't have code. } else { - const VerifiedMethod* verified_method = - driver->GetVerificationResults()->GetVerifiedMethod(method_ref); + VerificationResults* results = driver->GetVerificationResults(); + DCHECK(results != nullptr); + const VerifiedMethod* verified_method = results->GetVerifiedMethod(method_ref); bool compile = compilation_enabled && // Basic checks, e.g., not . - driver->GetVerificationResults() - ->IsCandidateForCompilation(method_ref, access_flags) && + results->IsCandidateForCompilation(method_ref, access_flags) && // Did not fail to create VerifiedMethod metadata. verified_method != nullptr && // Do not have failures that should punt to the interpreter. -- cgit v1.2.3-59-g8ed1b