diff options
| author | 2017-07-17 14:51:53 -0700 | |
|---|---|---|
| committer | 2017-07-17 18:01:17 -0700 | |
| commit | 93764b8ee58d54118904b8f4473628451e568893 (patch) | |
| tree | 729758b4420920b7bb7070dbdac1ecd86810b2a8 /compiler/driver/compiler_driver.cc | |
| parent | d317295ed07384c69d5890d6b17b80d57139a082 (diff) | |
Generalize atomic_method_ref_map to support dex references
Generalize atomic method ref map to support dex references instead
of only method references.
The goal is to use this in a future CL to replace compiled_classes_.
Test: test-art-host
Change-Id: Ic6d1e619584f790eea68f5160fa0fcd664524cd7
Diffstat (limited to 'compiler/driver/compiler_driver.cc')
| -rw-r--r-- | compiler/driver/compiler_driver.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index ff92ac43b8..49a42de5b2 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -71,7 +71,7 @@ #include "thread_pool.h" #include "trampolines/trampoline_compiler.h" #include "transaction.h" -#include "utils/atomic_method_ref_map-inl.h" +#include "utils/atomic_dex_ref_map-inl.h" #include "utils/dex_cache_arrays_layout-inl.h" #include "utils/swap_space.h" #include "vdex_file.h" @@ -321,7 +321,7 @@ CompilerDriver::CompilerDriver( } CompilerDriver::~CompilerDriver() { - compiled_methods_.Visit([this](const MethodReference& ref ATTRIBUTE_UNUSED, + compiled_methods_.Visit([this](const DexFileReference& ref ATTRIBUTE_UNUSED, CompiledMethod* method) { if (method != nullptr) { CompiledMethod::ReleaseSwapAllocatedCompiledMethod(this, method); @@ -899,7 +899,7 @@ void CompilerDriver::PreCompile(jobject class_loader, for (const DexFile* dex_file : dex_files) { // Can be already inserted if the caller is CompileOne. This happens for gtests. if (!compiled_methods_.HaveDexFile(dex_file)) { - compiled_methods_.AddDexFile(dex_file); + compiled_methods_.AddDexFile(dex_file, dex_file->NumMethodIds()); } } // Resolve eagerly to prepare for compilation. @@ -2847,9 +2847,10 @@ void CompilerDriver::AddCompiledMethod(const MethodReference& method_ref, size_t non_relative_linker_patch_count) { DCHECK(GetCompiledMethod(method_ref) == nullptr) << method_ref.dex_file->PrettyMethod(method_ref.dex_method_index); - MethodTable::InsertResult result = compiled_methods_.Insert(method_ref, - /*expected*/ nullptr, - compiled_method); + MethodTable::InsertResult result = compiled_methods_.Insert( + DexFileReference(method_ref.dex_file, method_ref.dex_method_index), + /*expected*/ nullptr, + compiled_method); CHECK(result == MethodTable::kInsertResultSuccess); non_relative_linker_patch_count_.FetchAndAddRelaxed(non_relative_linker_patch_count); DCHECK(GetCompiledMethod(method_ref) != nullptr) @@ -2897,7 +2898,7 @@ void CompilerDriver::RecordClassStatus(ClassReference ref, mirror::Class::Status CompiledMethod* CompilerDriver::GetCompiledMethod(MethodReference ref) const { CompiledMethod* compiled_method = nullptr; - compiled_methods_.Get(ref, &compiled_method); + compiled_methods_.Get(DexFileReference(ref.dex_file, ref.dex_method_index), &compiled_method); return compiled_method; } |