Skip to content

Commit

Permalink
8323724: Remove potential re-inflation from FastHashCode under LM_LIG…
Browse files Browse the repository at this point in the history
…HTWEIGHT

Reviewed-by: aboldtch, coleenp
  • Loading branch information
Fredrik Bredberg committed May 2, 2024
1 parent dd0b641 commit 553d45b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/hotspot/share/runtime/synchronizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1077,9 +1077,11 @@ intptr_t ObjectSynchronizer::FastHashCode(Thread* current, oop obj) {

// Inflate the monitor to set the hash.

// An async deflation can race after the inflate() call and before we
// can update the ObjectMonitor's header with the hash value below.
monitor = inflate(current, obj, inflate_cause_hash_code);
// There's no need to inflate if the mark has already got a monitor.
// NOTE: an async deflation can race after we get the monitor and
// before we can update the ObjectMonitor's header with the hash
// value below.
monitor = mark.has_monitor() ? mark.monitor() : inflate(current, obj, inflate_cause_hash_code);
// Load ObjectMonitor's header/dmw field and see if it has a hash.
mark = monitor->header();
assert(mark.is_neutral(), "invariant: header=" INTPTR_FORMAT, mark.value());
Expand Down

0 comments on commit 553d45b

Please sign in to comment.