summaryrefslogtreecommitdiff
path: root/runtime/jni/java_vm_ext.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2020-12-01 12:02:29 +0000
committer Vladimir Marko <vmarko@google.com> 2020-12-09 09:29:24 +0000
commit17491ac89fffc79452c4a88b39a9b74f342508d3 (patch)
tree07f6feb62355a281591e62aad6480e68ee2eb326 /runtime/jni/java_vm_ext.h
parent45aa2affa521190d5b619b6a9e3b3d20b719c076 (diff)
JNI: Faster jobject decoding by avoiding checks.
Avoid costly runtime checks in Thread::DecodeJObject() and IndirectReferenceTable::Get() that it calls and replace them with DCHECK()s and checks in CheckJNI. This improves the performance of JNI interface in release mode for processes that do not use CheckJNI (default for non-debuggable apps). The results for StringToBytesBenchmark on blueline little cores running at fixed frequency 1420800 are approximately (medians from 3 runs) before after timeGetBytesAscii EMPTY 477.70 408.18 timeGetBytesIso88591 EMPTY 473.00 412.15 timeGetBytesUtf8 EMPTY 468.96 402.78 Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: blueline-userdebug boots. Bug: 172332525 Change-Id: Ibea788bb54879d1fca0608c30fde008063aaafcc
Diffstat (limited to 'runtime/jni/java_vm_ext.h')
-rw-r--r--runtime/jni/java_vm_ext.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/jni/java_vm_ext.h b/runtime/jni/java_vm_ext.h
index 6f7e546de5..015f85cba9 100644
--- a/runtime/jni/java_vm_ext.h
+++ b/runtime/jni/java_vm_ext.h
@@ -37,6 +37,7 @@ class Libraries;
class ParsedOptions;
class Runtime;
struct RuntimeArgumentMap;
+class ScopedObjectAccess;
class JavaVMExt;
// Hook definition for runtime plugins.
@@ -263,6 +264,9 @@ class JavaVMExt : public JavaVM {
std::atomic<bool> allocation_tracking_enabled_;
std::atomic<bool> old_allocation_tracking_state_;
+ friend IndirectReferenceTable* GetIndirectReferenceTable(ScopedObjectAccess& soa,
+ IndirectRefKind kind);
+
DISALLOW_COPY_AND_ASSIGN(JavaVMExt);
};