summaryrefslogtreecommitdiffstats
path: root/runtime/reflection.h
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-09-26 14:32:37 -0700
committerMathieu Chartier <mathieuc@google.com>2014-09-26 19:54:39 -0700
commit76433275dbe39e5ced1c223b006d1b900b1937f6 (patch)
treea72c101defa86ceff8b633cf2eaa606c87f783eb /runtime/reflection.h
parent88adf36315237947d3a5d10b28fdf8b9da7794a4 (diff)
downloadandroid_art-76433275dbe39e5ced1c223b006d1b900b1937f6.tar.gz
android_art-76433275dbe39e5ced1c223b006d1b900b1937f6.tar.bz2
android_art-76433275dbe39e5ced1c223b006d1b900b1937f6.zip
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
Diffstat (limited to 'runtime/reflection.h')
-rw-r--r--runtime/reflection.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/runtime/reflection.h b/runtime/reflection.h
index 61370c650e..00f9d09128 100644
--- a/runtime/reflection.h
+++ b/runtime/reflection.h
@@ -43,9 +43,9 @@ bool UnboxPrimitiveForResult(const ThrowLocation& throw_location, mirror::Object
mirror::Class* dst_class, JValue* unboxed_value)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
-bool ConvertPrimitiveValue(const ThrowLocation* throw_location, bool unbox_for_result,
- Primitive::Type src_class, Primitive::Type dst_class,
- const JValue& src, JValue* dst)
+ALWAYS_INLINE bool ConvertPrimitiveValue(const ThrowLocation* throw_location, bool unbox_for_result,
+ Primitive::Type src_class, Primitive::Type dst_class,
+ const JValue& src, JValue* dst)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
JValue InvokeWithVarArgs(const ScopedObjectAccessAlreadyRunnable& soa, jobject obj, jmethodID mid,
@@ -75,7 +75,8 @@ jobject InvokeMethod(const ScopedObjectAccessAlreadyRunnable& soa, jobject metho
bool VerifyObjectIsClass(mirror::Object* o, mirror::Class* c)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
-bool VerifyAccess(mirror::Object* obj, mirror::Class* declaring_class, uint32_t access_flags)
+bool VerifyAccess(Thread* self, mirror::Object* obj, mirror::Class* declaring_class,
+ uint32_t access_flags)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
} // namespace art