From 8bc6a58df7046b4d6f4b51eb274c7e60fea396ff Mon Sep 17 00:00:00 2001 From: Hans Boehm Date: Tue, 19 Dec 2023 18:48:15 +0000 Subject: Revert^17 "Thread suspension cleanup and deadlock fix" This reverts commit c6371b52df0da31acc174a3526274417b7aac0a7. Reason for revert: This seems to have two remaining issues: 1. The second DCHECK in WaitForFlipFunction is not completely guaranteed to hold, resulting in failures for 658-fp-read-barrier. 2. WaitForSuspendBarrier seems to time out occasionally, possibly spuriously so. We fail when the futex times out once. That's probably incompatible with the app freezer. We should retry a few times. Change-Id: Ibd8909b31083fc29e6d4f1fcde003d08eb16fc0a --- runtime/mirror/object.cc | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'runtime/mirror/object.cc') diff --git a/runtime/mirror/object.cc b/runtime/mirror/object.cc index 995f06e14e..940b82dc0a 100644 --- a/runtime/mirror/object.cc +++ b/runtime/mirror/object.cc @@ -185,8 +185,7 @@ void Object::SetHashCodeSeed(uint32_t new_seed) { hash_code_seed.store(new_seed, std::memory_order_relaxed); } -template -int32_t Object::IdentityHashCodeHelper() { +int32_t Object::IdentityHashCode() { ObjPtr current_this = this; // The this pointer may get invalidated by thread suspension. while (true) { LockWord lw = current_this->GetLockWord(false); @@ -204,9 +203,6 @@ int32_t Object::IdentityHashCodeHelper() { break; } case LockWord::kThinLocked: { - if (!kAllowInflation) { - return 0; - } // Inflate the thin lock to a monitor and stick the hash code inside of the monitor. May // fail spuriously. Thread* self = Thread::Current(); @@ -234,12 +230,6 @@ int32_t Object::IdentityHashCodeHelper() { } } -int32_t Object::IdentityHashCode() { return IdentityHashCodeHelper(); } - -int32_t Object::IdentityHashCodeNoInflation() { - return IdentityHashCodeHelper(); -} - void Object::CheckFieldAssignmentImpl(MemberOffset field_offset, ObjPtr new_value) { ObjPtr c = GetClass(); Runtime* runtime = Runtime::Current(); -- cgit v1.2.3-59-g8ed1b