Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.
/ jdk21 Public archive

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: rkennke
Backport-of: 57b8251241e2044d5039ce162bf4637a9b2e5466
  • Loading branch information
shipilev committed Jun 15, 2023
1 parent 6711041 commit 0ac9275
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 0ac9275

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