diff options
| author | 2016-12-21 12:17:42 +0000 | |
|---|---|---|
| committer | 2016-12-21 12:17:43 +0000 | |
| commit | 56e2f9369988407ac8ede94dc342297bd97e75a0 (patch) | |
| tree | 5e94e7758b14464732c1b65a2860984a8ec9f4ad /compiler/driver/compiler_driver.cc | |
| parent | 294e107e8947224ea6540af5068bce2492ee8d5b (diff) | |
| parent | c1a42cf3873be202c8c0ca3c4e67500b470ab075 (diff) | |
Merge "Remove soon to be obsolete call kinds for direct calls."
Diffstat (limited to 'compiler/driver/compiler_driver.cc')
| -rw-r--r-- | compiler/driver/compiler_driver.cc | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index ec1642e370..37fa92e1b7 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -1537,90 +1537,6 @@ bool CompilerDriver::ComputeInstanceFieldInfo(uint32_t field_idx, const DexCompi } } -void CompilerDriver::GetCodeAndMethodForDirectCall(const mirror::Class* referrer_class, - ArtMethod* method, - uintptr_t* direct_code, - uintptr_t* direct_method) { - // For direct and static methods compute possible direct_code and direct_method values, ie - // an address for the Method* being invoked and an address of the code for that Method*. - // For interface calls compute a value for direct_method that is the interface method being - // invoked, so this can be passed to the out-of-line runtime support code. - *direct_code = 0; - *direct_method = 0; - Runtime* const runtime = Runtime::Current(); - gc::Heap* const heap = runtime->GetHeap(); - auto* cl = runtime->GetClassLinker(); - bool use_dex_cache = GetCompilerOptions().GetCompilePic(); // Off by default - const bool compiling_boot = heap->IsCompilingBoot(); - // TODO This is somewhat hacky. We should refactor all of this invoke codepath. - const bool force_relocations = (compiling_boot || - GetCompilerOptions().GetIncludePatchInformation()); - // TODO: support patching on all architectures. - use_dex_cache = use_dex_cache || (force_relocations && !support_boot_image_fixup_); - mirror::Class* declaring_class = method->GetDeclaringClass(); - bool method_code_in_boot = declaring_class->GetClassLoader() == nullptr; - if (!use_dex_cache) { - if (!method_code_in_boot) { - use_dex_cache = true; - } else if (method->IsStatic() && - declaring_class != referrer_class && - !declaring_class->IsInitialized()) { - // Ensure we run the clinit trampoline unless we are invoking a static method in the same - // class. - use_dex_cache = true; - } - } - if (runtime->UseJitCompilation()) { - // If we are the JIT, then don't allow a direct call to the interpreter bridge since this will - // never be updated even after we compile the method. - if (cl->IsQuickToInterpreterBridge( - reinterpret_cast<const void*>(compiler_->GetEntryPointOf(method)))) { - use_dex_cache = true; - } - } - - if (!use_dex_cache && force_relocations) { - bool is_in_image; - if (GetCompilerOptions().IsBootImage()) { - is_in_image = IsImageClass(method->GetDeclaringClassDescriptor()); - } else { - is_in_image = instruction_set_ != kX86 && instruction_set_ != kX86_64 && - heap->FindSpaceFromObject(method->GetDeclaringClass(), false)->IsImageSpace() && - !cl->IsQuickToInterpreterBridge( - reinterpret_cast<const void*>(compiler_->GetEntryPointOf(method))); - } - if (!is_in_image) { - // We can only branch directly to Methods that are resolved in the DexCache. - // Otherwise we won't invoke the resolution trampoline. - use_dex_cache = true; - } - } - - if (!use_dex_cache) { - bool method_in_image = false; - const std::vector<gc::space::ImageSpace*>& image_spaces = heap->GetBootImageSpaces(); - for (gc::space::ImageSpace* image_space : image_spaces) { - const auto& method_section = image_space->GetImageHeader().GetMethodsSection(); - if (method_section.Contains(reinterpret_cast<uint8_t*>(method) - image_space->Begin())) { - method_in_image = true; - break; - } - } - if (method_in_image || compiling_boot || runtime->UseJitCompilation()) { - // We know we must be able to get to the method in the image, so use that pointer. - // In the case where we are the JIT, we can always use direct pointers since we know where - // the method and its code are / will be. We don't sharpen to interpreter bridge since we - // check IsQuickToInterpreterBridge above. - CHECK(!method->IsAbstract()); - *direct_method = force_relocations ? -1 : reinterpret_cast<uintptr_t>(method); - *direct_code = force_relocations ? -1 : compiler_->GetEntryPointOf(method); - } else { - // Set the code and rely on the dex cache for the method. - *direct_code = force_relocations ? -1 : compiler_->GetEntryPointOf(method); - } - } -} - const VerifiedMethod* CompilerDriver::GetVerifiedMethod(const DexFile* dex_file, uint32_t method_idx) const { MethodReference ref(dex_file, method_idx); |