summaryrefslogtreecommitdiff
path: root/compiler/driver/compiler_driver.cc
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2018-01-24 18:17:55 -0800
committer Mathieu Chartier <mathieuc@google.com> 2018-02-05 13:38:20 -0800
commit279e3a3499d208daf467a1690b111dfb06f3e96e (patch)
tree74c7d6d860bea25aabae47dc0ca95bafb0571f8e /compiler/driver/compiler_driver.cc
parentca6f1c0cb7655e90237583c1b6b771d3c8aae95d (diff)
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
Diffstat (limited to 'compiler/driver/compiler_driver.cc')
-rw-r--r--compiler/driver/compiler_driver.cc13
1 files changed, 10 insertions, 3 deletions
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<const DexFile*>& 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<const DexFile*>& dex_files) {