summaryrefslogtreecommitdiff
path: root/runtime/mirror/object.h
diff options
context:
space:
mode:
author Hans Boehm <hboehm@google.com> 2023-12-19 20:35:24 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2023-12-20 10:14:19 +0000
commit17195424dd56070a773e82ab5430c788e54a78c6 (patch)
treebbec51d0943d516ded7928fbdb6f9618282ea694 /runtime/mirror/object.h
parentc0a7565637b4513f312da0015fc59b8dc83aeb34 (diff)
Revert^18 "Thread suspension cleanup and deadlock fix"
This reverts commit 8bc6a58df7046b4d6f4b51eb274c7e60fea396ff. PS1 is identical to https://android-review.git.corp.google.com/c/platform/art/+/2746640 PS2 makes the following changes: - Remove one DCHECK each from the two WaitForFlipFunction variants. The DCHECK could fail if another GC was started in the interim. - Break up the WaitForSuspendBarrier timeout into shorter ones. so we don't time out as easily if our process is frozen. - Include the thread name for ThreadSuspendByThreadIdWarning, since we don't get complete tombstones for some failures. Test: Treehugger, host tests. Bug: 240742796 Bug: 203363895 Bug: 238032384 Bug: 253671779 Bug: 276660630 Bug: 295880862 Bug: 294334417 Bug: 301090887 Bug: 313347640 (and more) Change-Id: I12c5c01b1e006baab4ee4148aadbc721723fb89e
Diffstat (limited to 'runtime/mirror/object.h')
-rw-r--r--runtime/mirror/object.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/mirror/object.h b/runtime/mirror/object.h
index 54a17b1d4e..ecd8a48a96 100644
--- a/runtime/mirror/object.h
+++ b/runtime/mirror/object.h
@@ -138,11 +138,16 @@ class MANAGED LOCKABLE Object {
REQUIRES_SHARED(Locks::mutator_lock_)
REQUIRES(!Roles::uninterruptible_);
+ // Returns a nonzero value that fits into lockword slot.
int32_t IdentityHashCode()
REQUIRES_SHARED(Locks::mutator_lock_)
REQUIRES(!Locks::thread_list_lock_,
!Locks::thread_suspend_count_lock_);
+ // Identical to the above, but returns 0 if monitor inflation would otherwise be needed.
+ int32_t IdentityHashCodeNoInflation() REQUIRES_SHARED(Locks::mutator_lock_)
+ REQUIRES(!Locks::thread_list_lock_, !Locks::thread_suspend_count_lock_);
+
static constexpr MemberOffset MonitorOffset() {
return OFFSET_OF_OBJECT_MEMBER(Object, monitor_);
}
@@ -727,6 +732,10 @@ class MANAGED LOCKABLE Object {
REQUIRES_SHARED(Locks::mutator_lock_);
private:
+ template <bool kAllowInflation>
+ int32_t IdentityHashCodeHelper() REQUIRES_SHARED(Locks::mutator_lock_)
+ REQUIRES(!Locks::thread_list_lock_, !Locks::thread_suspend_count_lock_);
+
// Get a field with acquire semantics.
template<typename kSize>
ALWAYS_INLINE kSize GetFieldAcquire(MemberOffset field_offset)