diff options
author | 2021-11-23 11:57:23 +0000 | |
---|---|---|
committer | 2021-11-23 12:00:45 +0000 | |
commit | 02e0eb7eef35b03ae9eed60f02c889a6be400de9 (patch) | |
tree | ab577696a461f10f1b9c810bbfe87fdba1c1059f /runtime/entrypoints/entrypoint_utils-inl.h | |
parent | bd2394b704c8cf17eba9833272657495f9c146f6 (diff) |
Revert "JNI: Rewrite locking for synchronized methods."
This reverts commit c17656bcf477e57d59ff051037c96994fd0ac8f2.
Reason for revert: Broke tests.
At least the arm64 macro UNLOCK_OBJECT_FAST_PATH uses
an incorrect label for one branch to slow path.
Bug: 172332525
Bug: 207408813
Change-Id: I6764dcfcba3b3d780fc13a66d6e676a3e3946a0f
Diffstat (limited to 'runtime/entrypoints/entrypoint_utils-inl.h')
-rw-r--r-- | runtime/entrypoints/entrypoint_utils-inl.h | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h index a160a7baf0..6e78b53ff8 100644 --- a/runtime/entrypoints/entrypoint_utils-inl.h +++ b/runtime/entrypoints/entrypoint_utils-inl.h @@ -805,27 +805,23 @@ inline bool NeedsClinitCheckBeforeCall(ArtMethod* method) { return method->IsStatic() && !method->IsConstructor(); } -inline ObjPtr<mirror::Object> GetGenericJniSynchronizationObject(Thread* self, ArtMethod* called) +inline jobject GetGenericJniSynchronizationObject(Thread* self, ArtMethod* called) REQUIRES_SHARED(Locks::mutator_lock_) { DCHECK(!called->IsCriticalNative()); DCHECK(!called->IsFastNative()); DCHECK(self->GetManagedStack()->GetTopQuickFrame() != nullptr); DCHECK_EQ(*self->GetManagedStack()->GetTopQuickFrame(), called); - // We do not need read barriers here. - // On method entry, all reference arguments are to-space references and we mark the - // declaring class of a static native method if needed. When visiting thread roots at - // the start of a GC, we visit all these references to ensure they point to the to-space. if (called->IsStatic()) { // Static methods synchronize on the declaring class object. - return called->GetDeclaringClass<kWithoutReadBarrier>(); + // The `jclass` is a pointer to the method's declaring class. + return reinterpret_cast<jobject>(called->GetDeclaringClassAddressWithoutBarrier()); } else { // Instance methods synchronize on the `this` object. // The `this` reference is stored in the first out vreg in the caller's frame. + // The `jobject` is a pointer to the spill slot. uint8_t* sp = reinterpret_cast<uint8_t*>(self->GetManagedStack()->GetTopQuickFrame()); size_t frame_size = RuntimeCalleeSaveFrame::GetFrameSize(CalleeSaveType::kSaveRefsAndArgs); - StackReference<mirror::Object>* this_ref = reinterpret_cast<StackReference<mirror::Object>*>( - sp + frame_size + static_cast<size_t>(kRuntimePointerSize)); - return this_ref->AsMirrorPtr(); + return reinterpret_cast<jobject>(sp + frame_size + static_cast<size_t>(kRuntimePointerSize)); } } |