Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8278146: G1: Rework VM_G1Concurrent VMOp to clearly identify it as pause #6677

Closed
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 2 additions & 24 deletions src/hotspot/share/gc/g1/g1ConcurrentMarkThread.cpp
Expand Up @@ -56,26 +56,6 @@ G1ConcurrentMarkThread::G1ConcurrentMarkThread(G1ConcurrentMark* cm) :
create_and_start();
}

class CMRemark : public VoidClosure {
G1ConcurrentMark* _cm;
public:
CMRemark(G1ConcurrentMark* cm) : _cm(cm) {}

void do_void(){
_cm->remark();
}
};

class CMCleanup : public VoidClosure {
G1ConcurrentMark* _cm;
public:
CMCleanup(G1ConcurrentMark* cm) : _cm(cm) {}

void do_void(){
_cm->cleanup();
}
};

double G1ConcurrentMarkThread::mmu_delay_end(G1Policy* policy, bool remark) {
// There are 3 reasons to use SuspendibleThreadSetJoiner.
// 1. To avoid concurrency problem.
Expand Down Expand Up @@ -239,8 +219,7 @@ bool G1ConcurrentMarkThread::subphase_delay_to_keep_mmu_before_remark() {

bool G1ConcurrentMarkThread::subphase_remark() {
ConcurrentGCBreakpoints::at("BEFORE MARKING COMPLETED");
CMRemark cl(_cm);
VM_G1Concurrent op(&cl, "Pause Remark");
VM_G1PauseRemark op;
VMThread::execute(&op);
return _cm->has_aborted();
}
Expand All @@ -257,8 +236,7 @@ bool G1ConcurrentMarkThread::phase_delay_to_keep_mmu_before_cleanup() {
}

bool G1ConcurrentMarkThread::phase_cleanup() {
CMCleanup cl(_cm);
VM_G1Concurrent op(&cl, "Pause Cleanup");
VM_G1PauseCleanup op;
VMThread::execute(&op);
return _cm->has_aborted();
}
Expand Down
19 changes: 15 additions & 4 deletions src/hotspot/share/gc/g1/g1VMOperations.cpp
Expand Up @@ -170,7 +170,7 @@ void VM_G1CollectForAllocation::doit() {
}
}

void VM_G1Concurrent::doit() {
void VM_G1PauseConcurrent::doit() {
GCIdMark gc_id_mark(_gc_id);
GCTraceCPUTime tcpu;
G1CollectedHeap* g1h = G1CollectedHeap::heap();
Expand All @@ -184,17 +184,28 @@ void VM_G1Concurrent::doit() {
TraceCollectorStats tcs(g1h->monitoring_support()->conc_collection_counters());
SvcGCMarker sgcm(SvcGCMarker::CONCURRENT);
IsGCActiveMark x;
_cl->do_void();

work();
}

bool VM_G1Concurrent::doit_prologue() {
bool VM_G1PauseConcurrent::doit_prologue() {
Heap_lock->lock();
return true;
}

void VM_G1Concurrent::doit_epilogue() {
void VM_G1PauseConcurrent::doit_epilogue() {
if (Universe::has_reference_pending_list()) {
Heap_lock->notify_all();
}
Heap_lock->unlock();
}

void VM_G1PauseRemark::work() {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
g1h->concurrent_mark()->remark();
}

void VM_G1PauseCleanup::work() {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
g1h->concurrent_mark()->cleanup();
}
30 changes: 23 additions & 7 deletions src/hotspot/share/gc/g1/g1VMOperations.hpp
Expand Up @@ -87,18 +87,34 @@ class VM_G1CollectForAllocation : public VM_CollectForAllocation {
};

// Concurrent G1 stop-the-world operations such as remark and cleanup.
class VM_G1Concurrent : public VM_Operation {
VoidClosure* _cl;
const char* _message;
class VM_G1PauseConcurrent : public VM_Operation {
private:
shipilev marked this conversation as resolved.
Show resolved Hide resolved
shipilev marked this conversation as resolved.
Show resolved Hide resolved
uint _gc_id;
const char* _message;

protected:
VM_G1PauseConcurrent(const char* message) :
_gc_id(GCId::current()), _message(message) { }

public:
VM_G1Concurrent(VoidClosure* cl, const char* message) :
_cl(cl), _message(message), _gc_id(GCId::current()) { }
virtual VMOp_Type type() const { return VMOp_G1Concurrent; }
virtual void doit();
virtual bool doit_prologue();
virtual void doit_epilogue();
virtual void doit();
shipilev marked this conversation as resolved.
Show resolved Hide resolved
virtual void work() = 0;
shipilev marked this conversation as resolved.
Show resolved Hide resolved
};

class VM_G1PauseRemark : public VM_G1PauseConcurrent {
public:
VM_G1PauseRemark() : VM_G1PauseConcurrent("Pause Remark") { }
virtual VMOp_Type type() const { return VMOp_G1PauseRemark; }
virtual void work();
shipilev marked this conversation as resolved.
Show resolved Hide resolved
};

class VM_G1PauseCleanup : public VM_G1PauseConcurrent {
public:
VM_G1PauseCleanup() : VM_G1PauseConcurrent("Pause Cleanup") { }
virtual VMOp_Type type() const { return VMOp_G1PauseCleanup; }
virtual void work();
shipilev marked this conversation as resolved.
Show resolved Hide resolved
};

#endif // SHARE_GC_G1_G1VMOPERATIONS_HPP
3 changes: 2 additions & 1 deletion src/hotspot/share/runtime/vmOperation.hpp
Expand Up @@ -58,7 +58,8 @@
template(ParallelGCSystemGC) \
template(G1CollectForAllocation) \
template(G1CollectFull) \
template(G1Concurrent) \
template(G1PauseRemark) \
template(G1PauseCleanup) \
template(G1TryInitiateConcMark) \
template(ZMarkStart) \
template(ZMarkEnd) \
Expand Down