Skip to content

Commit

Permalink
8289739: Add G1 specific GC breakpoints for testing
Browse files Browse the repository at this point in the history
Reviewed-by: kbarrett, iwalulya
  • Loading branch information
Thomas Schatzl committed Jul 6, 2022
1 parent ac6be16 commit 8341895
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/hotspot/share/gc/g1/g1ConcurrentMarkThread.cpp
Expand Up @@ -234,6 +234,7 @@ bool G1ConcurrentMarkThread::subphase_remark() {
}

bool G1ConcurrentMarkThread::phase_rebuild_remembered_sets() {
ConcurrentGCBreakpoints::at("AFTER REBUILD STARTED");
G1ConcPhaseTimer p(_cm, "Concurrent Rebuild Remembered Sets");
_cm->rebuild_rem_set_concurrently();
return _cm->has_aborted();
Expand All @@ -245,12 +246,14 @@ bool G1ConcurrentMarkThread::phase_delay_to_keep_mmu_before_cleanup() {
}

bool G1ConcurrentMarkThread::phase_cleanup() {
ConcurrentGCBreakpoints::at("BEFORE REBUILD COMPLETED");
VM_G1PauseCleanup op;
VMThread::execute(&op);
return _cm->has_aborted();
}

bool G1ConcurrentMarkThread::phase_clear_bitmap_for_next_mark() {
ConcurrentGCBreakpoints::at("AFTER CLEANUP STARTED");
G1ConcPhaseTimer p(_cm, "Concurrent Cleanup for Next Mark");
_cm->cleanup_for_next_mark();
return _cm->has_aborted();
Expand Down Expand Up @@ -318,6 +321,7 @@ void G1ConcurrentMarkThread::concurrent_undo_cycle_do() {
}

void G1ConcurrentMarkThread::concurrent_cycle_end(bool mark_cycle_completed) {
ConcurrentGCBreakpoints::at("BEFORE CLEANUP COMPLETED");
// Update the number of full collections that have been
// completed. This will also notify the G1OldGCCount_lock in case a
// Java thread is waiting for a full GC to happen (e.g., it
Expand Down
13 changes: 13 additions & 0 deletions test/hotspot/jtreg/gc/TestConcurrentGCBreakpoints.java
Expand Up @@ -42,6 +42,13 @@ public class TestConcurrentGCBreakpoints {

private static final WhiteBox WB = WhiteBox.getWhiteBox();

private static void testG1SpecificBreakpoints() {
WB.concurrentGCRunTo(WB.G1_AFTER_REBUILD_STARTED);
WB.concurrentGCRunTo(WB.G1_BEFORE_REBUILD_COMPLETED);
WB.concurrentGCRunTo(WB.G1_AFTER_CLEANUP_STARTED);
WB.concurrentGCRunTo(WB.G1_BEFORE_CLEANUP_COMPLETED);
}

// All testN() assume initial state is idle, and restore that state.

// Step through the common breakpoints.
Expand All @@ -51,10 +58,16 @@ private static void testSimpleCycle() throws Exception {
// Run one cycle.
WB.concurrentGCRunTo(WB.AFTER_MARKING_STARTED);
WB.concurrentGCRunTo(WB.BEFORE_MARKING_COMPLETED);
if (GC.G1.isSelected()) {
testG1SpecificBreakpoints();
}
WB.concurrentGCRunToIdle();
// Run a second cycle.
WB.concurrentGCRunTo(WB.AFTER_MARKING_STARTED);
WB.concurrentGCRunTo(WB.BEFORE_MARKING_COMPLETED);
if (GC.G1.isSelected()) {
testG1SpecificBreakpoints();
}
WB.concurrentGCRunToIdle();
} finally {
WB.concurrentGCRunToIdle();
Expand Down
6 changes: 6 additions & 0 deletions test/lib/sun/hotspot/WhiteBox.java
Expand Up @@ -488,6 +488,12 @@ private void checkConcurrentGCIsControlled() {
public final String AFTER_CONCURRENT_REFERENCE_PROCESSING_STARTED =
"AFTER CONCURRENT REFERENCE PROCESSING STARTED";

// G1 specific GC breakpoints.
public final String G1_AFTER_REBUILD_STARTED = "AFTER REBUILD STARTED";
public final String G1_BEFORE_REBUILD_COMPLETED = "BEFORE REBUILD COMPLETED";
public final String G1_AFTER_CLEANUP_STARTED = "AFTER CLEANUP STARTED";
public final String G1_BEFORE_CLEANUP_COMPLETED = "BEFORE CLEANUP COMPLETED";

public void concurrentGCAcquireControl() {
checkConcurrentGCBreakpointsSupported();
if (concurrentGCIsControlled) {
Expand Down

1 comment on commit 8341895

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.