Skip to content

Commit 1eec30a

Browse files
committed
8331573: Rename CollectedHeap::is_gc_active to be explicitly about STW GCs
Reviewed-by: stefank, zgu, tschatzl, gli
1 parent e8a2d56 commit 1eec30a

27 files changed

+62
-64
lines changed

src/hotspot/share/gc/g1/g1CollectedHeap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2399,7 +2399,7 @@ void G1CollectedHeap::expand_heap_after_young_collection(){
23992399

24002400
bool G1CollectedHeap::do_collection_pause_at_safepoint() {
24012401
assert_at_safepoint_on_vm_thread();
2402-
guarantee(!is_gc_active(), "collection is not reentrant");
2402+
guarantee(!is_stw_gc_active(), "collection is not reentrant");
24032403

24042404
do_collection_pause_at_safepoint_helper();
24052405
return true;
@@ -2469,7 +2469,7 @@ void G1CollectedHeap::flush_region_pin_cache() {
24692469
void G1CollectedHeap::do_collection_pause_at_safepoint_helper() {
24702470
ResourceMark rm;
24712471

2472-
IsGCActiveMark active_gc_mark;
2472+
IsSTWGCActiveMark active_gc_mark;
24732473
GCIdMark gc_id_mark;
24742474
SvcGCMarker sgcm(SvcGCMarker::MINOR);
24752475

src/hotspot/share/gc/g1/g1CollectedHeap.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ class G1CollectedHeap : public CollectedHeap {
749749
// false if unable to do the collection due to the GC locker being
750750
// active, true otherwise.
751751
// precondition: at safepoint on VM thread
752-
// precondition: !is_gc_active()
752+
// precondition: !is_stw_gc_active()
753753
bool do_collection_pause_at_safepoint();
754754

755755
// Helper for do_collection_pause_at_safepoint, containing the guts

src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ inline bool G1CollectedHeap::is_obj_dead(const oop obj, const HeapRegion* hr) co
265265

266266
inline void G1CollectedHeap::pin_object(JavaThread* thread, oop obj) {
267267
assert(obj != nullptr, "obj must not be null");
268-
assert(!is_gc_active(), "must not pin objects during a GC");
268+
assert(!is_stw_gc_active(), "must not pin objects during a GC pause");
269269
assert(obj->is_typeArray(), "must be typeArray");
270270

271271
uint obj_region_idx = heap_region_containing(obj)->hrm_index();
@@ -274,7 +274,7 @@ inline void G1CollectedHeap::pin_object(JavaThread* thread, oop obj) {
274274

275275
inline void G1CollectedHeap::unpin_object(JavaThread* thread, oop obj) {
276276
assert(obj != nullptr, "obj must not be null");
277-
assert(!is_gc_active(), "must not unpin objects during a GC");
277+
assert(!is_stw_gc_active(), "must not unpin objects during a GC pause");
278278

279279
uint obj_region_idx = heap_region_containing(obj)->hrm_index();
280280
G1ThreadLocalData::pin_count_cache(thread).dec_count(obj_region_idx);

src/hotspot/share/gc/g1/g1FullGCScope.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class G1FullGCScope : public StackObj {
5252
SvcGCMarker _svc_marker;
5353
STWGCTimer _timer;
5454
G1FullGCTracer* _tracer;
55-
IsGCActiveMark _active;
55+
IsSTWGCActiveMark _active;
5656
G1FullGCJFRTracerMark _tracer_mark;
5757
ClearedAllSoftRefs _soft_refs;
5858
G1FullGCMonitoringScope _monitoring_scope;

src/hotspot/share/gc/g1/g1RemSet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1564,7 +1564,7 @@ bool G1RemSet::clean_card_before_refine(CardValue** const card_ptr_addr) {
15641564

15651565
void G1RemSet::refine_card_concurrently(CardValue* const card_ptr,
15661566
const uint worker_id) {
1567-
assert(!_g1h->is_gc_active(), "Only call concurrently");
1567+
assert(!_g1h->is_stw_gc_active(), "Only call concurrently");
15681568
check_card_ptr(card_ptr, _ct);
15691569

15701570
// Construct the MemRegion representing the card.

src/hotspot/share/gc/g1/g1VMOperations.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void VM_G1PauseConcurrent::doit() {
146146

147147
G1ConcGCMonitoringScope monitoring_scope(g1h->monitoring_support());
148148
SvcGCMarker sgcm(SvcGCMarker::CONCURRENT);
149-
IsGCActiveMark x;
149+
IsSTWGCActiveMark x;
150150

151151
work();
152152
}

src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ void ParallelScavengeHeap::do_full_collection(bool clear_all_soft_refs) {
459459
HeapWord* ParallelScavengeHeap::failed_mem_allocate(size_t size) {
460460
assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint");
461461
assert(Thread::current() == (Thread*)VMThread::vm_thread(), "should be in vm thread");
462-
assert(!is_gc_active(), "not reentrant");
462+
assert(!is_stw_gc_active(), "not reentrant");
463463
assert(!Heap_lock->owned_by_self(), "this thread should not own the Heap_lock");
464464

465465
// We assume that allocation in eden will fail unless we collect.

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,9 +1269,9 @@ bool PSParallelCompact::invoke(bool maximum_heap_compaction) {
12691269
"should be in vm thread");
12701270

12711271
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
1272-
assert(!heap->is_gc_active(), "not reentrant");
1272+
assert(!heap->is_stw_gc_active(), "not reentrant");
12731273

1274-
IsGCActiveMark mark;
1274+
IsSTWGCActiveMark mark;
12751275

12761276
const bool clear_all_soft_refs =
12771277
heap->soft_ref_policy()->should_clear_all_soft_refs();
@@ -1492,7 +1492,7 @@ class PCAddThreadRootsMarkingTaskClosure : public ThreadClosure {
14921492
public:
14931493
PCAddThreadRootsMarkingTaskClosure(uint worker_id) : _worker_id(worker_id) { }
14941494
void do_thread(Thread* thread) {
1495-
assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc");
1495+
assert(ParallelScavengeHeap::heap()->is_stw_gc_active(), "called outside gc");
14961496

14971497
ResourceMark rm;
14981498

@@ -1509,7 +1509,7 @@ class PCAddThreadRootsMarkingTaskClosure : public ThreadClosure {
15091509
};
15101510

15111511
void steal_marking_work(TaskTerminator& terminator, uint worker_id) {
1512-
assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc");
1512+
assert(ParallelScavengeHeap::heap()->is_stw_gc_active(), "called outside gc");
15131513

15141514
ParCompactionManager* cm =
15151515
ParCompactionManager::gc_thread_compaction_manager(worker_id);
@@ -1986,7 +1986,7 @@ void PSParallelCompact::write_block_fill_histogram()
19861986
#endif // #ifdef ASSERT
19871987

19881988
static void compaction_with_stealing_work(TaskTerminator* terminator, uint worker_id) {
1989-
assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc");
1989+
assert(ParallelScavengeHeap::heap()->is_stw_gc_active(), "called outside gc");
19901990

19911991
ParCompactionManager* cm =
19921992
ParCompactionManager::gc_thread_compaction_manager(worker_id);

src/hotspot/share/gc/parallel/psScavenge.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ ParallelScavengeTracer PSScavenge::_gc_tracer;
8484
CollectorCounters* PSScavenge::_counters = nullptr;
8585

8686
static void scavenge_roots_work(ParallelRootType::Value root_type, uint worker_id) {
87-
assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc");
87+
assert(ParallelScavengeHeap::heap()->is_stw_gc_active(), "called outside gc");
8888

8989
PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(worker_id);
9090
PSPromoteRootsClosure roots_to_old_closure(pm);
@@ -115,7 +115,7 @@ static void scavenge_roots_work(ParallelRootType::Value root_type, uint worker_i
115115
}
116116

117117
static void steal_work(TaskTerminator& terminator, uint worker_id) {
118-
assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc");
118+
assert(ParallelScavengeHeap::heap()->is_stw_gc_active(), "called outside gc");
119119

120120
PSPromotionManager* pm =
121121
PSPromotionManager::gc_thread_promotion_manager(worker_id);
@@ -232,11 +232,11 @@ class ParallelScavengeRefProcProxyTask : public RefProcProxyTask {
232232
bool PSScavenge::invoke() {
233233
assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint");
234234
assert(Thread::current() == (Thread*)VMThread::vm_thread(), "should be in vm thread");
235-
assert(!ParallelScavengeHeap::heap()->is_gc_active(), "not reentrant");
235+
assert(!ParallelScavengeHeap::heap()->is_stw_gc_active(), "not reentrant");
236236

237237
ParallelScavengeHeap* const heap = ParallelScavengeHeap::heap();
238238
PSAdaptiveSizePolicy* policy = heap->size_policy();
239-
IsGCActiveMark mark;
239+
IsSTWGCActiveMark mark;
240240

241241
const bool scavenge_done = PSScavenge::invoke_no_policy();
242242
const bool need_full_gc = !scavenge_done;
@@ -264,7 +264,7 @@ class PSThreadRootsTaskClosure : public ThreadClosure {
264264
public:
265265
PSThreadRootsTaskClosure(uint worker_id) : _worker_id(worker_id) { }
266266
virtual void do_thread(Thread* thread) {
267-
assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc");
267+
assert(ParallelScavengeHeap::heap()->is_stw_gc_active(), "called outside gc");
268268

269269
PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(_worker_id);
270270
PSScavengeRootsClosure roots_closure(pm);

src/hotspot/share/gc/serial/serialHeap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ void SerialHeap::do_collection(bool full,
484484
assert(my_thread->is_VM_thread(), "only VM thread");
485485
assert(Heap_lock->is_locked(),
486486
"the requesting thread should have the Heap_lock");
487-
guarantee(!is_gc_active(), "collection is not reentrant");
487+
guarantee(!is_stw_gc_active(), "collection is not reentrant");
488488

489489
if (GCLocker::check_active_before_gc()) {
490490
return; // GC is disabled (e.g. JNI GetXXXCritical operation)
@@ -495,7 +495,7 @@ void SerialHeap::do_collection(bool full,
495495

496496
ClearedAllSoftRefs casr(do_clear_all_soft_refs, soft_ref_policy());
497497

498-
IsGCActiveMark active_gc_mark;
498+
IsSTWGCActiveMark active_gc_mark;
499499

500500
bool complete = full && (max_generation == OldGen);
501501
bool old_collects_young = complete;

0 commit comments

Comments
 (0)