summaryrefslogtreecommitdiff
path: root/runtime/class_linker.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2021-03-15 18:33:23 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2021-03-23 15:31:45 +0000
commit40cd07c3e6717b28c0137e8d72a067a9f8663ec6 (patch)
tree45cced150c54d6798805882c10607f11b1be9b36 /runtime/class_linker.cc
parent4924ea9ad98832f0ec7db841defca82331ee1b13 (diff)
Add a fast path for nterp entrypoint to avoid fetching the shorty.
When all parameters are references, we don't need to look at the shorty. Use the 0x00100000 flag in the modifiers which is free for non-native methods. Test: test.py Bug: 112676029 Change-Id: Ied9a253f7f7230045dd13188a5b806fb1d6d019d
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r--runtime/class_linker.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index e894037ae3..2040263cc6 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -3838,6 +3838,17 @@ void ClassLinker::LoadMethod(const DexFile& dex_file,
} else {
dst->SetCodeItem(dst->GetDexFile()->GetCodeItem(method.GetCodeItemOffset()));
}
+ bool has_all_references = true;
+ const char* shorty = dst->GetShorty();
+ for (size_t i = 1, e = strlen(shorty); i < e; ++i) {
+ if (shorty[i] != 'L') {
+ has_all_references = false;
+ break;
+ }
+ }
+ if (has_all_references) {
+ dst->SetNterpEntryPointFastPathFlag();
+ }
} else {
dst->SetDataPtrSize(nullptr, image_pointer_size_);
DCHECK_EQ(method.GetCodeItemOffset(), 0u);