diff options
-rw-r--r-- | runtime/class_linker.cc | 33 | ||||
-rw-r--r-- | runtime/entrypoints/quick/quick_trampoline_entrypoints.cc | 6 |
2 files changed, 20 insertions, 19 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 79a5d28..7a54bb1 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -1828,31 +1828,28 @@ static void LinkCode(const SirtRef<mirror::ArtMethod>& method, const OatFile::Oa // trampoline as entrypoint (non-static), or the Resolution trampoline (static). DCHECK(method->GetEntryPointFromQuickCompiledCode() == GetQuickResolutionTrampoline(runtime->GetClassLinker()) - || - method->GetEntryPointFromQuickCompiledCode() == GetQuickGenericJniTrampoline()); + || method->GetEntryPointFromQuickCompiledCode() == GetQuickGenericJniTrampoline()); DCHECK_EQ(method->GetFrameSizeInBytes<false>(), 0U); // Fix up method metadata if necessary. - if (method->GetFrameSizeInBytes<false>() == 0) { - uint32_t s_len; - const char* shorty = dex_file.GetMethodShorty(dex_file.GetMethodId(dex_method_index), &s_len); - uint32_t refs = 1; // Native method always has "this" or class. - for (uint32_t i = 1; i < s_len; ++i) { - if (shorty[i] == 'L') { - refs++; - } + uint32_t s_len; + const char* shorty = dex_file.GetMethodShorty(dex_file.GetMethodId(dex_method_index), &s_len); + uint32_t refs = 1; // Native method always has "this" or class. + for (uint32_t i = 1; i < s_len; ++i) { + if (shorty[i] == 'L') { + refs++; } - size_t sirt_size = StackIndirectReferenceTable::GetAlignedSirtSize(refs); + } + size_t sirt_size = StackIndirectReferenceTable::GetAlignedSirtSize(refs); - // Get the generic spill masks and base frame size. - mirror::ArtMethod* callee_save_method = - Runtime::Current()->GetCalleeSaveMethod(Runtime::kRefsAndArgs); + // Get the generic spill masks and base frame size. + mirror::ArtMethod* callee_save_method = + Runtime::Current()->GetCalleeSaveMethod(Runtime::kRefsAndArgs); - method->SetFrameSizeInBytes(callee_save_method->GetFrameSizeInBytes() + sirt_size); - method->SetCoreSpillMask(callee_save_method->GetCoreSpillMask()); - method->SetFpSpillMask(callee_save_method->GetFpSpillMask()); - } + method->SetFrameSizeInBytes(callee_save_method->GetFrameSizeInBytes() + sirt_size); + method->SetCoreSpillMask(callee_save_method->GetCoreSpillMask()); + method->SetFpSpillMask(callee_save_method->GetFpSpillMask()); } } diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc index a4491d4..36dc1cb 100644 --- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc @@ -1498,7 +1498,11 @@ extern "C" ssize_t artQuickGenericJniTrampoline(Thread* self, mirror::ArtMethod* // Retrieve the stored native code. const void* nativeCode = called->GetNativeMethod(); - // Check whether it's the stub to retrieve the native code, we should call that directly. + // There are two cases for the content of nativeCode: + // 1) Pointer to the native function. + // 2) Pointer to the trampoline for native code binding. + // In the second case, we need to execute the binding and continue with the actual native function + // pointer. DCHECK(nativeCode != nullptr); if (nativeCode == GetJniDlsymLookupStub()) { nativeCode = artFindNativeMethod(); |