Skip to content

Commit 0f78d01

Browse files
committedApr 12, 2024
8329658: Serial: Refactor ContiguousSpace::_next_compaction_space
Reviewed-by: ayang, tschatzl
1 parent b8f675f commit 0f78d01

File tree

4 files changed

+1
-32
lines changed

4 files changed

+1
-32
lines changed
 

‎src/hotspot/share/gc/serial/defNewGeneration.cpp

-14
Original file line numberDiff line numberDiff line change
@@ -359,24 +359,12 @@ void DefNewGeneration::compute_space_boundaries(uintx minimum_eden_size,
359359
}
360360
from()->initialize(fromMR, clear_space, mangle_space);
361361
to()->initialize(toMR, clear_space, mangle_space);
362-
363-
// Set next compaction spaces.
364-
eden()->set_next_compaction_space(from());
365-
// The to-space is normally empty before a compaction so need
366-
// not be considered. The exception is during promotion
367-
// failure handling when to-space can contain live objects.
368-
from()->set_next_compaction_space(nullptr);
369362
}
370363

371364
void DefNewGeneration::swap_spaces() {
372365
ContiguousSpace* s = from();
373366
_from_space = to();
374367
_to_space = s;
375-
eden()->set_next_compaction_space(from());
376-
// The to-space is normally empty before a compaction so need
377-
// not be considered. The exception is during promotion
378-
// failure handling when to-space can contain live objects.
379-
from()->set_next_compaction_space(nullptr);
380368

381369
if (UsePerfData) {
382370
CSpaceCounters* c = _from_counters;
@@ -780,7 +768,6 @@ void DefNewGeneration::collect(bool full,
780768
// as a result of a partial evacuation of eden
781769
// and from-space.
782770
swap_spaces(); // For uniformity wrt ParNewGeneration.
783-
from()->set_next_compaction_space(to());
784771
heap->set_incremental_collection_failed();
785772

786773
_gc_tracer->report_promotion_failed(_promotion_failed_info);
@@ -801,7 +788,6 @@ void DefNewGeneration::collect(bool full,
801788
void DefNewGeneration::init_assuming_no_promotion_failure() {
802789
_promotion_failed = false;
803790
_promotion_failed_info.reset();
804-
from()->set_next_compaction_space(nullptr);
805791
}
806792

807793
void DefNewGeneration::remove_forwarding_pointers() {

‎src/hotspot/share/gc/serial/serialFullGC.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ class Compacter {
267267
_spaces[1].init(heap->young_gen()->eden());
268268
_spaces[2].init(heap->young_gen()->from());
269269

270-
bool is_promotion_failed = (heap->young_gen()->from()->next_compaction_space() != nullptr);
270+
bool is_promotion_failed = !heap->young_gen()->to()->is_empty();
271271
if (is_promotion_failed) {
272272
_spaces[3].init(heap->young_gen()->to());
273273
_num_spaces = 4;

‎src/hotspot/share/gc/shared/space.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
ContiguousSpace::ContiguousSpace():
4444
_bottom(nullptr),
4545
_end(nullptr),
46-
_next_compaction_space(nullptr),
4746
_top(nullptr) {
4847
_mangler = new GenSpaceMangler(this);
4948
}
@@ -64,7 +63,6 @@ void ContiguousSpace::initialize(MemRegion mr,
6463
if (clear_space) {
6564
clear(mangle_space);
6665
}
67-
_next_compaction_space = nullptr;
6866
}
6967

7068
void ContiguousSpace::clear(bool mangle_space) {

‎src/hotspot/share/gc/shared/space.hpp

-15
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ class ContiguousSpace: public CHeapObj<mtGC> {
6464
private:
6565
HeapWord* _bottom;
6666
HeapWord* _end;
67-
68-
ContiguousSpace* _next_compaction_space;
69-
7067
HeapWord* _top;
7168
// A helper for mangling the unused area of the space in debug builds.
7269
GenSpaceMangler* _mangler;
@@ -123,18 +120,6 @@ class ContiguousSpace: public CHeapObj<mtGC> {
123120
// had allocation performed in it, but is now to be considered empty.
124121
void clear(bool mangle_space);
125122

126-
// Returns the next space (in the current generation) to be compacted in
127-
// the global compaction order. Also is used to select the next
128-
// space into which to compact.
129-
130-
ContiguousSpace* next_compaction_space() const {
131-
return _next_compaction_space;
132-
}
133-
134-
void set_next_compaction_space(ContiguousSpace* csp) {
135-
_next_compaction_space = csp;
136-
}
137-
138123
// Accessors
139124
HeapWord* top() const { return _top; }
140125
void set_top(HeapWord* value) { _top = value; }

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Apr 12, 2024

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