Skip to content
Permalink
Browse files
8268122: Add specific gc cause for G1 full collections
Reviewed-by: tschatzl, kbarrett
  • Loading branch information
kstefanj committed Jun 9, 2021
1 parent 43e38a1 commit caf7f49887db3ea26ee302f37941f196b3a76f3f
Showing 5 changed files with 8 additions and 2 deletions.
@@ -1139,6 +1139,7 @@ void G1CollectedHeap::do_full_collection(bool clear_all_soft_refs) {
}

bool G1CollectedHeap::upgrade_to_full_collection() {
GCCauseSetter compaction(this, GCCause::_g1_compaction_pause);
log_info(gc, ergo)("Attempting full compaction clearing soft references");
bool success = do_full_collection(false /* explicit gc */,
true /* clear_all_soft_refs */,
@@ -1188,6 +1189,7 @@ HeapWord* G1CollectedHeap::satisfy_failed_allocation_helper(size_t word_size,
}

if (do_gc) {
GCCauseSetter compaction(this, GCCause::_g1_compaction_pause);
// Expansion didn't work, we'll try to do a Full GC.
// If maximum_compaction is set we clear all soft references and don't
// allow any dead wood to be left on the heap.
@@ -93,6 +93,9 @@ const char* GCCause::to_string(GCCause::Cause cause) {
case _g1_inc_collection_pause:
return "G1 Evacuation Pause";

case _g1_compaction_pause:
return "G1 Compaction Pause";

case _g1_humongous_allocation:
return "G1 Humongous Allocation";

@@ -71,6 +71,7 @@ class GCCause : public AllStatic {
_adaptive_size_policy,

_g1_inc_collection_pause,
_g1_compaction_pause,
_g1_humongous_allocation,
_g1_periodic_collection,
_g1_preventive_collection,
@@ -40,7 +40,7 @@ public static void main(String[] args) throws Exception {
String testID = "G1ConcurrentMark";
String[] vmFlags = {"-XX:+UseG1GC", "-XX:+ExplicitGCInvokesConcurrent"};
String[] gcNames = {GCHelper.gcG1New, GCHelper.gcG1Old, GCHelper.gcG1Full};
String[] gcCauses = {"G1 Evacuation Pause", "G1 Preventive Collection", "Allocation Failure", "System.gc()"};
String[] gcCauses = {"G1 Evacuation Pause", "G1 Preventive Collection", "G1 Compaction Pause", "System.gc()"};
GCGarbageCollectionUtil.test(testID, vmFlags, gcNames, gcCauses);
}
}
@@ -40,7 +40,7 @@ public static void main(String[] args) throws Exception {
String testID = "G1FullCollection";
String[] vmFlags = {"-XX:+UseG1GC"};
String[] gcNames = {GCHelper.gcG1New, GCHelper.gcG1Old, GCHelper.gcG1Full};
String[] gcCauses = {"G1 Evacuation Pause", "G1 Preventive Collection", "Allocation Failure", "System.gc()"};
String[] gcCauses = {"G1 Evacuation Pause", "G1 Preventive Collection", "G1 Compaction Pause", "System.gc()"};
GCGarbageCollectionUtil.test(testID, vmFlags, gcNames, gcCauses);
}
}

1 comment on commit caf7f49

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on caf7f49 Jun 9, 2021

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.