Skip to content

Commit 850c23d

Browse files
author
duke
committed
Backport 17cf49746d0c289bdf779c974cdc84a3ab32ab4b
1 parent e5d351f commit 850c23d

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,29 @@ void ShenandoahGenerationalHeap::stop() {
184184
regulator_thread()->stop();
185185
}
186186

187+
bool ShenandoahGenerationalHeap::requires_barriers(stackChunkOop obj) const {
188+
if (is_idle()) {
189+
return false;
190+
}
191+
192+
if (is_concurrent_young_mark_in_progress() && is_in_young(obj) && !marking_context()->allocated_after_mark_start(obj)) {
193+
// We are marking young, this object is in young, and it is below the TAMS
194+
return true;
195+
}
196+
197+
if (is_in_old(obj)) {
198+
// Card marking barriers are required for objects in the old generation
199+
return true;
200+
}
201+
202+
if (has_forwarded_objects()) {
203+
// Object may have pointers that need to be updated
204+
return true;
205+
}
206+
207+
return false;
208+
}
209+
187210
void ShenandoahGenerationalHeap::evacuate_collection_set(bool concurrent) {
188211
ShenandoahRegionIterator regions;
189212
ShenandoahGenerationalEvacuationTask task(this, &regions, concurrent, false /* only promote regions */);

src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ class ShenandoahGenerationalHeap : public ShenandoahHeap {
128128

129129
void stop() override;
130130

131+
bool requires_barriers(stackChunkOop obj) const override;
132+
131133
// Used for logging the result of a region transfer outside the heap lock
132134
struct TransferResult {
133135
bool success;

0 commit comments

Comments
 (0)