Skip to content

Commit 9793e73

Browse files
committedNov 26, 2024
8344853: Parallel: Improve comments in psParallelCompact
Reviewed-by: sjohanss, zgu
1 parent 57d35f9 commit 9793e73

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed
 

‎src/hotspot/share/gc/parallel/psParallelCompact.cpp

+16-16
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,9 @@ HeapWord* ParallelCompactData::summarize_split_space(size_t src_region,
362362

363363
split_info.record(split_region, overflowing_obj, preceding_live_words);
364364

365-
HeapWord* src_region_start = region_to_addr(src_region);
366-
HeapWord* new_top = destination - pointer_delta(src_region_start, overflowing_obj);
365+
// The [overflowing_obj, src_region_start) part has been accounted for, so
366+
// must move back the new_top, now that this overflowing obj is deferred.
367+
HeapWord* new_top = destination - pointer_delta(region_to_addr(src_region), overflowing_obj);
367368

368369
// If the overflowing obj was relocated to its original destination,
369370
// those destination regions would have their source_region set. Now that
@@ -890,7 +891,7 @@ void PSParallelCompact::summary_phase()
890891
_summary_data.summarize_dense_prefix(old_space->bottom(), dense_prefix_end);
891892
}
892893

893-
// Compacting objs inn [dense_prefix_end, old_space->top())
894+
// Compacting objs in [dense_prefix_end, old_space->top())
894895
_summary_data.summarize(_space_info[id].split_info(),
895896
dense_prefix_end, old_space->top(), nullptr,
896897
dense_prefix_end, old_space->end(),
@@ -1596,29 +1597,28 @@ void PSParallelCompact::forward_to_new_addr() {
15961597
&start_region, &end_region);
15971598
for (size_t cur_region = start_region; cur_region < end_region; ++cur_region) {
15981599
RegionData* region_ptr = _summary_data.region(cur_region);
1599-
size_t live_words = region_ptr->partial_obj_size();
1600+
size_t partial_obj_size = region_ptr->partial_obj_size();
16001601

1601-
if (live_words == ParallelCompactData::RegionSize) {
1602+
if (partial_obj_size == ParallelCompactData::RegionSize) {
16021603
// No obj-start
16031604
continue;
16041605
}
16051606

16061607
HeapWord* region_start = _summary_data.region_to_addr(cur_region);
16071608
HeapWord* region_end = region_start + ParallelCompactData::RegionSize;
16081609

1609-
16101610
if (split_info.is_split(cur_region)) {
16111611
// Part 1: will be relocated to space-1
16121612
HeapWord* preceding_destination = split_info.preceding_destination();
16131613
HeapWord* split_point = split_info.split_point();
1614-
forward_objs_in_range(cm, region_start + live_words, split_point, preceding_destination + live_words);
1614+
forward_objs_in_range(cm, region_start + partial_obj_size, split_point, preceding_destination + partial_obj_size);
16151615

16161616
// Part 2: will be relocated to space-2
16171617
HeapWord* destination = region_ptr->destination();
16181618
forward_objs_in_range(cm, split_point, region_end, destination);
16191619
} else {
16201620
HeapWord* destination = region_ptr->destination();
1621-
forward_objs_in_range(cm, region_start + live_words, region_end, destination + live_words);
1621+
forward_objs_in_range(cm, region_start + partial_obj_size, region_end, destination + partial_obj_size);
16221622
}
16231623
}
16241624
}
@@ -1984,11 +1984,11 @@ HeapWord* PSParallelCompact::skip_live_words(HeapWord* beg, HeapWord* end, size_
19841984
}
19851985
}
19861986

1987-
// On filling a destination region (dest-region), we need to know the location
1988-
// of the word that will be at the start of the dest-region after compaction.
1989-
// A dest-region can have one or more source regions, but only the first
1990-
// source-region contains this location. This location is retrieved by calling
1991-
// `first_src_addr` on a dest-region.
1987+
// On starting to fill a destination region (dest-region), we need to know the
1988+
// location of the word that will be at the start of the dest-region after
1989+
// compaction. A dest-region can have one or more source regions, but only the
1990+
// first source-region contains this location. This location is retrieved by
1991+
// calling `first_src_addr` on a dest-region.
19921992
// Conversely, a source-region has a dest-region which holds the destination of
19931993
// the first live word on this source-region, based on which the destination
19941994
// for the rest of live words can be derived.
@@ -2017,9 +2017,9 @@ HeapWord* PSParallelCompact::skip_live_words(HeapWord* beg, HeapWord* end, size_
20172017
// ^ ^
20182018
// | old-space-end | eden-space-start
20192019
//
2020-
// Therefore, in this example, region-n will have two dest-regions, one for
2021-
// the final region in old-space and the other for the first region in
2022-
// eden-space.
2020+
// Therefore, in this example, region-n will have two dest-regions:
2021+
// 1. the final region in old-space
2022+
// 2. the first region in eden-space.
20232023
// To handle this special case, we introduce the concept of split-region, whose
20242024
// contents are relocated to two spaces. `SplitInfo` captures all necessary
20252025
// info about the split, the first part, spliting-point, and the second part.

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Nov 26, 2024

@openjdk-notifier[bot]
Please sign in to comment.