mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 09:34:38 +02:00
8271579: G1: Move copy before CAS in do_copy_to_survivor_space
8272070: G1: Simplify age calculation after JDK-8271579 Co-authored-by: shoubing ma <mashoubing1@huawei.com> Reviewed-by: tschatzl, ayang
This commit is contained in:
parent
92bde6738a
commit
d874e9616f
1 changed files with 2 additions and 12 deletions
|
@ -464,11 +464,11 @@ oop G1ParScanThreadState::do_copy_to_survivor_space(G1HeapRegionAttr const regio
|
||||||
|
|
||||||
// We're going to allocate linearly, so might as well prefetch ahead.
|
// We're going to allocate linearly, so might as well prefetch ahead.
|
||||||
Prefetch::write(obj_ptr, PrefetchCopyIntervalInBytes);
|
Prefetch::write(obj_ptr, PrefetchCopyIntervalInBytes);
|
||||||
|
Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(old), obj_ptr, word_sz);
|
||||||
|
|
||||||
const oop obj = cast_to_oop(obj_ptr);
|
const oop obj = cast_to_oop(obj_ptr);
|
||||||
const oop forward_ptr = old->forward_to_atomic(obj, old_mark, memory_order_relaxed);
|
const oop forward_ptr = old->forward_to_atomic(obj, old_mark, memory_order_relaxed);
|
||||||
if (forward_ptr == NULL) {
|
if (forward_ptr == NULL) {
|
||||||
Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(old), obj_ptr, word_sz);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
const uint young_index = from_region->young_index_in_cset();
|
const uint young_index = from_region->young_index_in_cset();
|
||||||
|
@ -480,19 +480,9 @@ oop G1ParScanThreadState::do_copy_to_survivor_space(G1HeapRegionAttr const regio
|
||||||
if (dest_attr.is_young()) {
|
if (dest_attr.is_young()) {
|
||||||
if (age < markWord::max_age) {
|
if (age < markWord::max_age) {
|
||||||
age++;
|
age++;
|
||||||
}
|
obj->incr_age();
|
||||||
if (old_mark.has_displaced_mark_helper()) {
|
|
||||||
// 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));
|
|
||||||
}
|
}
|
||||||
_age_table.add(age, word_sz);
|
_age_table.add(age, word_sz);
|
||||||
} else {
|
|
||||||
obj->set_mark(old_mark);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Most objects are not arrays, so do one array check rather than
|
// Most objects are not arrays, so do one array check rather than
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue