diff options
| author | 2016-09-13 15:57:37 -0700 | |
|---|---|---|
| committer | 2016-09-21 13:32:00 -0700 | |
| commit | 06a04e0e776875303577c2d871b53a53c78da1b5 (patch) | |
| tree | 6f8b38fa918f49cc502b573c96d9a6338ad343df /compiler/jni/jni_compiler_test.cc | |
| parent | 48d10ee126838f060aa6dcd304fc161b57bc14af (diff) | |
jni: Implement generic JNI support for @CriticalNative/@FastNative
Also:
* Extend existing test cases to check generic JNI for the above.
* Re-enable previously blacklisted @CriticalNative JNI run-tests.
Bug: 31400248
Change-Id: I436ed00c8b8880e936a0c3483bc0dc251f0c0ce2
Diffstat (limited to 'compiler/jni/jni_compiler_test.cc')
| -rw-r--r-- | compiler/jni/jni_compiler_test.cc | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/compiler/jni/jni_compiler_test.cc b/compiler/jni/jni_compiler_test.cc index cdd4c68470..b692c6d9ad 100644 --- a/compiler/jni/jni_compiler_test.cc +++ b/compiler/jni/jni_compiler_test.cc @@ -391,12 +391,12 @@ jobject JniCompilerTest::class_loader_; // 3) synchronized keyword // -- TODO: We can support (1) if we remove the mutator lock assert during stub lookup. # define JNI_TEST_NORMAL_ONLY(TestName) \ - TEST_F(JniCompilerTest, TestName ## Default) { \ + TEST_F(JniCompilerTest, TestName ## NormalCompiler) { \ SCOPED_TRACE("Normal JNI with compiler"); \ gCurrentJni = static_cast<uint32_t>(JniKind::kNormal); \ TestName ## Impl(); \ } \ - TEST_F(JniCompilerTest, TestName ## Generic) { \ + TEST_F(JniCompilerTest, TestName ## NormalGeneric) { \ SCOPED_TRACE("Normal JNI with generic"); \ gCurrentJni = static_cast<uint32_t>(JniKind::kNormal); \ TEST_DISABLED_FOR_MIPS(); \ @@ -404,46 +404,41 @@ jobject JniCompilerTest::class_loader_; TestName ## Impl(); \ } -// Test normal compiler, @FastNative compiler, and normal/@FastNative generic for normal natives. +// Test (normal, @FastNative) x (compiler, generic). #define JNI_TEST(TestName) \ JNI_TEST_NORMAL_ONLY(TestName) \ - TEST_F(JniCompilerTest, TestName ## Fast) { \ + TEST_F(JniCompilerTest, TestName ## FastCompiler) { \ SCOPED_TRACE("@FastNative JNI with compiler"); \ gCurrentJni = static_cast<uint32_t>(JniKind::kFast); \ TestName ## Impl(); \ } \ - \ - -// TODO: maybe. @FastNative generic JNI support? -#if 0 + \ TEST_F(JniCompilerTest, TestName ## FastGeneric) { \ + SCOPED_TRACE("@FastNative JNI with generic"); \ gCurrentJni = static_cast<uint32_t>(JniKind::kFast); \ TEST_DISABLED_FOR_MIPS(); \ SetCheckGenericJni(true); \ TestName ## Impl(); \ } -#endif +// Test (@CriticalNative) x (compiler, generic) only. #define JNI_TEST_CRITICAL_ONLY(TestName) \ - TEST_F(JniCompilerTest, TestName ## DefaultCritical) { \ + TEST_F(JniCompilerTest, TestName ## CriticalCompiler) { \ SCOPED_TRACE("@CriticalNative JNI with compiler"); \ gCurrentJni = static_cast<uint32_t>(JniKind::kCritical); \ TestName ## Impl(); \ + } \ + TEST_F(JniCompilerTest, TestName ## CriticalGeneric) { \ + SCOPED_TRACE("@CriticalNative JNI with generic"); \ + gCurrentJni = static_cast<uint32_t>(JniKind::kCritical); \ + TestName ## Impl(); \ } -// Test everything above and also the @CriticalNative compiler, and @CriticalNative generic JNI. +// Test everything: (normal, @FastNative, @CriticalNative) x (compiler, generic). #define JNI_TEST_CRITICAL(TestName) \ JNI_TEST(TestName) \ JNI_TEST_CRITICAL_ONLY(TestName) \ -// TODO: maybe, more likely since calling convention changed. @Criticalnative generic JNI support? -#if 0 - TEST_F(JniCompilerTest, TestName ## GenericCritical) { \ - gCurrentJni = static_cast<uint32_t>(JniKind::kCritical); \ - TestName ## Impl(); \ - } -#endif - static void expectValidThreadState() { // Normal JNI always transitions to "Native". Other JNIs stay in the "Runnable" state. if (IsCurrentJniNormal()) { @@ -506,6 +501,7 @@ static void expectValidJniEnvAndClass(JNIEnv* env, jclass kls) { // Temporarily disable the EXPECT_NUM_STACK_REFERENCES check (for a single test). struct ScopedDisableCheckNumStackReferences { ScopedDisableCheckNumStackReferences() { + CHECK(sCheckNumStackReferences); // No nested support. sCheckNumStackReferences = false; } |