Skip to content

Commit

Permalink
8309956: Shenandoah: Strengthen the mark word check in string dedup
Browse files Browse the repository at this point in the history
Reviewed-by: wkemper, zgu, ysr
  • Loading branch information
shipilev committed Jun 14, 2023
1 parent 955fc2f commit 57b8251
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/hotspot/share/gc/shenandoah/shenandoahStringDedup.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@ bool ShenandoahStringDedup::is_candidate(oop obj) {
return false;
}

if (StringDedup::is_below_threshold_age(obj->age())) {
const markWord mark = obj->mark();
// Having/had displaced header, too risk to deal with them, skip
if (mark == markWord::INFLATING() || mark.has_displaced_mark_helper()) {
return false;
}
const markWord mark = obj->mark();

// Having/had displaced header, too risky to deal with them, skip
if (mark == markWord::INFLATING() || mark.has_displaced_mark_helper()) {
return false;
}

// Increase string age and enqueue it when it rearches age threshold
if (StringDedup::is_below_threshold_age(mark.age())) {
// Increase string age and enqueue it when it reaches age threshold
markWord new_mark = mark.incr_age();
if (mark == obj->cas_set_mark(new_mark, mark)) {
return StringDedup::is_threshold_age(new_mark.age()) &&
Expand Down

1 comment on commit 57b8251

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.