Avoid redundant strlen for shorty names
As the shorty names are ASCII, we can safely use the UTF16 length as
the byte length. Update several ART files to use the shorty getters
that return the length to avoid redundant strlen calls.
This strlen usage was showing up as a minor part of a recent Play Store
app startup profile.
Bug: 204230974
Test: Manual
Change-Id: I4f5fb100303f465ed50b524ee5e349c8341a05e9
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 9ba3efc..d54330a 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -2555,8 +2555,9 @@
}
current_vreg += 1u;
}
- const char* shorty = m->GetShorty();
- for (size_t i = 1, len = strlen(shorty); i != len; ++i) {
+ uint32_t shorty_length;
+ const char* shorty = m->GetShorty(&shorty_length);
+ for (size_t i = 1; i != shorty_length; ++i) {
switch (shorty[i]) {
case 'D':
case 'J':