8256038: G1: Improve comment about mark word handling of displaced mark words
Reviewed-by: sjohanss, kbarrett
diff --git a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp
index ad8f76e..c9ca7da 100644
--- a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp
+++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp
@@ -490,12 +490,11 @@
age++;
}
if (old_mark.has_displaced_mark_helper()) {
- // In this case, we have to install the mark word first,
- // otherwise obj looks to be forwarded (the old mark word,
- // which contains the forward pointer, was copied)
- obj->set_mark(old_mark);
+ // In this case, we have to install the old mark word containing the
+ // displacement tag, and update the age in the displaced mark word.
markWord new_mark = old_mark.displaced_mark_helper().set_age(age);
old_mark.set_displaced_mark_helper(new_mark);
+ obj->set_mark(old_mark);
} else {
obj->set_mark(old_mark.set_age(age));
}