From 279e3a3499d208daf467a1690b111dfb06f3e96e Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Wed, 24 Jan 2018 18:17:55 -0800 Subject: Enable code item deduping Dedupe code items if they have the same contents, this is safe because of the fixed quickening logic. Removed duplicate code items in ManyMethods that caused the startup methods section to be empty in dex2oat_test. To avoid errors related to quickening and compilation of shared code items, quickening is currently disabled for shared code items. Bug: 63756964 Test: test-art-host Change-Id: I7c62eb746785d787c5269effd396f7be4859d3a6 --- compiler/driver/compiler_driver.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'compiler/driver/compiler_driver.cc') diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index b3adf10aea..fb428b8d9a 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -656,7 +656,7 @@ static void CompileMethodQuick( optimizer::DexToDexCompiler::CompilationLevel::kDontDexToDexCompile) { DCHECK(!Runtime::Current()->UseJitCompilation()); // TODO: add a command-line option to disable DEX-to-DEX compilation ? - driver->GetDexToDexCompiler().MarkForCompilation(self, method_ref, code_item); + driver->GetDexToDexCompiler().MarkForCompilation(self, method_ref); } } return compiled_method; @@ -730,7 +730,7 @@ void CompilerDriver::CompileOne(Thread* self, ArtMethod* method, TimingLogger* t true, dex_cache); - const size_t num_methods = dex_to_dex_compiler_.NumUniqueCodeItems(self); + const size_t num_methods = dex_to_dex_compiler_.NumCodeItemsToQuicken(self); if (num_methods != 0) { DCHECK_EQ(num_methods, 1u); CompileMethodDex2Dex(self, @@ -2808,7 +2808,7 @@ void CompilerDriver::Compile(jobject class_loader, Runtime::Current()->ReclaimArenaPoolMemory(); } - if (dex_to_dex_compiler_.NumUniqueCodeItems(Thread::Current()) > 0u) { + if (dex_to_dex_compiler_.NumCodeItemsToQuicken(Thread::Current()) > 0u) { // TODO: Not visit all of the dex files, its probably rare that only one would have quickened // methods though. for (const DexFile* dex_file : dex_files) { @@ -2840,6 +2840,12 @@ void CompilerDriver::AddCompiledMethod(const MethodReference& method_ref, DCHECK(GetCompiledMethod(method_ref) != nullptr) << method_ref.PrettyMethod(); } +CompiledMethod* CompilerDriver::RemoveCompiledMethod(const MethodReference& method_ref) { + CompiledMethod* ret = nullptr; + CHECK(compiled_methods_.Remove(method_ref, &ret)); + return ret; +} + bool CompilerDriver::GetCompiledClass(const ClassReference& ref, ClassStatus* status) const { DCHECK(status != nullptr); // The table doesn't know if something wasn't inserted. For this case it will return @@ -3013,6 +3019,7 @@ void CompilerDriver::FreeThreadPools() { void CompilerDriver::SetDexFilesForOatFile(const std::vector& dex_files) { dex_files_for_oat_file_ = dex_files; compiled_classes_.AddDexFiles(dex_files); + dex_to_dex_compiler_.SetDexFiles(dex_files); } void CompilerDriver::SetClasspathDexFiles(const std::vector& dex_files) { -- cgit v1.2.3-59-g8ed1b