From 48699fb0b0662d9a4fa593d0bd2a7d5ace83e34e Mon Sep 17 00:00:00 2001 From: Jeff Hao Date: Mon, 6 Apr 2015 14:21:37 -0700 Subject: [PATCH] Prevent verified method from being deleted by compiler driver. The results of it will be needed by future optimizing compiler changes. Change-Id: Ifbdf47e7564906b74193f80a4ba0459eed87c0f7 --- compiler/driver/compiler_driver.cc | 8 ++++++-- compiler/driver/compiler_driver.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index f52f50eda..01465f08e 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -350,6 +350,7 @@ CompilerDriver::CompilerDriver(const CompilerOptions* compiler_options, verification_results_(verification_results), method_inliner_map_(method_inliner_map), compiler_(Compiler::Create(this, compiler_kind)), + compiler_kind_(compiler_kind), instruction_set_(instruction_set), instruction_set_features_(instruction_set_features), freezing_constructor_lock_("freezing constructor lock"), @@ -2272,8 +2273,11 @@ void CompilerDriver::CompileMethod(Thread* self, const DexFile::CodeItem* code_i DCHECK(GetCompiledMethod(method_ref) != nullptr) << PrettyMethod(method_idx, dex_file); } - // Done compiling, delete the verified method to reduce native memory usage. - verification_results_->RemoveVerifiedMethod(method_ref); + // Done compiling, delete the verified method to reduce native memory usage. Do not delete in + // optimizing compiler, which may need the verified method again for inlining. + if (compiler_kind_ != Compiler::kOptimizing) { + verification_results_->RemoveVerifiedMethod(method_ref); + } if (self->IsExceptionPending()) { ScopedObjectAccess soa(self); diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h index efcaae4cd..edd1bd263 100644 --- a/compiler/driver/compiler_driver.h +++ b/compiler/driver/compiler_driver.h @@ -557,6 +557,7 @@ class CompilerDriver { DexFileToMethodInlinerMap* const method_inliner_map_; std::unique_ptr compiler_; + Compiler::Kind compiler_kind_; const InstructionSet instruction_set_; const InstructionSetFeatures* const instruction_set_features_; -- 2.11.0