Remove small duplicate code in Generic JNI handling, add comments
Change-Id: Ib276fa63b6a00480eaaff6c352d37917c61e966c
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 @@
// 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);
-
- // 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());
}
+ 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);
+
+ method->SetFrameSizeInBytes(callee_save_method->GetFrameSizeInBytes() + sirt_size);
+ method->SetCoreSpillMask(callee_save_method->GetCoreSpillMask());
+ method->SetFpSpillMask(callee_save_method->GetFpSpillMask());
}
}