diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-02-06 11:22:17 -0800 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2014-02-06 11:25:49 -0800 |
commit | 055d46c479369ea825712834353660b45215c195 (patch) | |
tree | 8d8074b21603975548118e06f1525e3c12d14f6a /compiler/jni/jni_compiler_test.cc | |
parent | 4c4f90c2d1776137e249c6720b83c81c09961dda (diff) | |
download | art-055d46c479369ea825712834353660b45215c195.tar.gz art-055d46c479369ea825712834353660b45215c195.tar.bz2 art-055d46c479369ea825712834353660b45215c195.zip |
Add missing SIRT to LoadNativeLibrary.
When we transition to kWaitingForJniOnLoad, we are suspended and
a GC can occur. This caused issues since classloaders are movable.
Change-Id: Iae59019c22ac64322a82300107d06a4323ee602b
Diffstat (limited to 'compiler/jni/jni_compiler_test.cc')
-rw-r--r-- | compiler/jni/jni_compiler_test.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/jni/jni_compiler_test.cc b/compiler/jni/jni_compiler_test.cc index 21dd11ef20..1c8714a6c3 100644 --- a/compiler/jni/jni_compiler_test.cc +++ b/compiler/jni/jni_compiler_test.cc @@ -150,9 +150,10 @@ TEST_F(JniCompilerTest, CompileAndRunIntMethodThroughStub) { ScopedObjectAccess soa(Thread::Current()); std::string reason; + SirtRef<mirror::ClassLoader> class_loader(soa.Self(), + soa.Decode<mirror::ClassLoader*>(class_loader_)); ASSERT_TRUE( - Runtime::Current()->GetJavaVM()->LoadNativeLibrary("", soa.Decode<mirror::ClassLoader*>(class_loader_), - &reason)) << reason; + Runtime::Current()->GetJavaVM()->LoadNativeLibrary("", class_loader, &reason)) << reason; jint result = env_->CallNonvirtualIntMethod(jobj_, jklass_, jmethod_, 24); EXPECT_EQ(25, result); @@ -165,9 +166,10 @@ TEST_F(JniCompilerTest, CompileAndRunStaticIntMethodThroughStub) { ScopedObjectAccess soa(Thread::Current()); std::string reason; + SirtRef<mirror::ClassLoader> class_loader(soa.Self(), + soa.Decode<mirror::ClassLoader*>(class_loader_)); ASSERT_TRUE( - Runtime::Current()->GetJavaVM()->LoadNativeLibrary("", soa.Decode<mirror::ClassLoader*>(class_loader_), - &reason)) << reason; + Runtime::Current()->GetJavaVM()->LoadNativeLibrary("", class_loader, &reason)) << reason; jint result = env_->CallStaticIntMethod(jklass_, jmethod_, 42); EXPECT_EQ(43, result); |