Optimize get/set reflection performance
Speedups mostly from reducing how often access checks are needed,
and adding more inlining, and adding templates.
Field_getInt from ~850ns -> 350ns.
Field_setInt from ~900ns -> 370ns.
Bug: 14063288
(cherry picked from commit ffc788cb7b5b9f53734d7bb8af2d5e45d885546b)
Change-Id: I2441581ff3478c6ae43b6aa49939ff3f07555ec8
diff --git a/runtime/utils.cc b/runtime/utils.cc
index 9157f6c..dbd2213 100644
--- a/runtime/utils.cc
+++ b/runtime/utils.cc
@@ -315,10 +315,6 @@
return result;
}
-std::string PrettyDescriptor(Primitive::Type type) {
- return PrettyDescriptor(Primitive::Descriptor(type));
-}
-
std::string PrettyField(mirror::ArtField* f, bool with_type) {
if (f == NULL) {
return "null";
@@ -1421,4 +1417,8 @@
buf->push_back((data >> 24) & 0xff);
}
+std::string PrettyDescriptor(Primitive::Type type) {
+ return PrettyDescriptor(Primitive::Descriptor(type));
+}
+
} // namespace art