jni: Fast path for @FastNative annotated java methods
Adds a faster path for java methods annotated with
dalvik.annotation.optimization.FastNative .
Intended to replace usage of fast JNI (registering with "!(FOO)BAR" descriptors).
Performance Microbenchmark Results (Angler):
* Regular JNI cost in nanoseconds: 115
* Fast JNI cost in nanoseconds: 60
* @FastNative cost in nanoseconds: 36
Summary: Up to 67% faster (vs fast jni) JNI transition cost
Change-Id: Ic23823ae0f232270c068ec999fd89aa993894b0e
diff --git a/compiler/compiler.h b/compiler/compiler.h
index 487a27f..a955f3c 100644
--- a/compiler/compiler.h
+++ b/compiler/compiler.h
@@ -38,6 +38,11 @@
kOptimizing
};
+ enum JniOptimizationFlags {
+ kNone,
+ kFastNative,
+ };
+
static Compiler* Create(CompilerDriver* driver, Kind kind);
virtual void Init() = 0;
@@ -57,7 +62,8 @@
virtual CompiledMethod* JniCompile(uint32_t access_flags,
uint32_t method_idx,
- const DexFile& dex_file) const = 0;
+ const DexFile& dex_file,
+ JniOptimizationFlags optimization_flags) const = 0;
virtual bool JitCompile(Thread* self ATTRIBUTE_UNUSED,
jit::JitCodeCache* code_cache ATTRIBUTE_UNUSED,