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
Backport-of: 57b8251241e2044d5039ce162bf4637a9b2e5466
  • Loading branch information
shipilev committed Jun 20, 2023
1 parent 3773e0b commit fb1741c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/hotspot/share/gc/shenandoah/shenandoahStringDedup.inline.hpp
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 fb1741c

@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.