JNI/x86: Fix art_jni_unlock_object_no_inline.
Fix a small issue from
https://android-review.googlesource.com/1903379
for x86. (The same was done correctly for x86-64.)
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 172332525
Change-Id: Ib8be2de88035d4d39738ca3076902a2e2b7d4461
diff --git a/compiler/jni/jni_compiler_test.cc b/compiler/jni/jni_compiler_test.cc
index abff4b6..0a1f017 100644
--- a/compiler/jni/jni_compiler_test.cc
+++ b/compiler/jni/jni_compiler_test.cc
@@ -845,6 +845,10 @@
return x | y;
}
+void InitEntryPoints(JniEntryPoints* jpoints,
+ QuickEntryPoints* qpoints,
+ bool monitor_jni_entry_exit);
+
void JniCompilerTest::CompileAndRun_fooJJ_synchronizedImpl() {
SetUpForTest(false, "fooJJ_synchronized", "(JJ)J",
CURRENT_JNI_WRAPPER(Java_MyClassNatives_fooJJ_synchronized));
@@ -898,6 +902,22 @@
lock_word = GetLockWord(jobj_);
ASSERT_EQ(lock_word.GetState(), LockWord::kFatLocked);
+ // Exercise locking/unocking for "fat-locked" through the "no_inline" path.
+ // These entrypoints are selected with verbose "systrace_lock_logging".
+ Thread* self = Thread::Current();
+ ASSERT_FALSE(gLogVerbosity.systrace_lock_logging);
+ gLogVerbosity.systrace_lock_logging = true;
+ InitEntryPoints(&self->tlsPtr_.jni_entrypoints,
+ &self->tlsPtr_.quick_entrypoints,
+ self->ReadFlag(ThreadFlag::kMonitorJniEntryExit));
+ result = env_->CallNonvirtualLongMethod(jobj_, jklass_, jmethod_, a, b);
+ EXPECT_EQ(a | b, result);
+ EXPECT_EQ(5, gJava_MyClassNatives_fooJJ_synchronized_calls[gCurrentJni]);
+ gLogVerbosity.systrace_lock_logging = false;
+ InitEntryPoints(&self->tlsPtr_.jni_entrypoints,
+ &self->tlsPtr_.quick_entrypoints,
+ self->ReadFlag(ThreadFlag::kMonitorJniEntryExit));
+
gJava_MyClassNatives_fooJJ_synchronized_calls[gCurrentJni] = 0;
}
diff --git a/runtime/arch/x86/jni_entrypoints_x86.S b/runtime/arch/x86/jni_entrypoints_x86.S
index bf09980..d1d0f41 100644
--- a/runtime/arch/x86/jni_entrypoints_x86.S
+++ b/runtime/arch/x86/jni_entrypoints_x86.S
@@ -350,7 +350,7 @@
// This is also the slow path for art_jni_unlock_object.
// Save return registers.
PUSH_ARG edx
- PUSH_ARG edi // Original contents of EAX.
+ PUSH_ARG eax
INCREASE_FRAME /*mmx0*/ 8 + /*padding*/ 4
movsd %xmm0, 0(%esp)
// Note: The stack is not 16-byte aligned here but it shall be after pushing args for the call.