@@ -826,7 +826,8 @@ void PSParallelCompact::fill_dense_prefix_end(SpaceId id) {
826
826
}
827
827
}
828
828
829
- bool PSParallelCompact::check_maximum_compaction (size_t total_live_words,
829
+ bool PSParallelCompact::check_maximum_compaction (bool should_do_max_compaction,
830
+ size_t total_live_words,
830
831
MutableSpace* const old_space,
831
832
HeapWord* full_region_prefix_end) {
832
833
@@ -839,25 +840,17 @@ bool PSParallelCompact::check_maximum_compaction(size_t total_live_words,
839
840
// Check if all live objs are too much for old-gen.
840
841
const bool is_old_gen_too_full = (total_live_words >= old_space->capacity_in_words ());
841
842
842
- // JVM flags
843
- const uint total_invocations = heap->total_full_collections ();
844
- assert (total_invocations >= _maximum_compaction_gc_num, " sanity" );
845
- const size_t gcs_since_max = total_invocations - _maximum_compaction_gc_num;
846
- const bool is_interval_ended = gcs_since_max > HeapMaximumCompactionInterval;
847
-
848
843
// If all regions in old-gen are full
849
844
const bool is_region_full =
850
845
full_region_prefix_end >= _summary_data.region_align_down (old_space->top ());
851
846
852
- if (is_max_on_system_gc || is_old_gen_too_full || is_interval_ended || is_region_full) {
853
- _maximum_compaction_gc_num = total_invocations;
854
- return true ;
855
- }
856
-
857
- return false ;
847
+ return should_do_max_compaction
848
+ || is_max_on_system_gc
849
+ || is_old_gen_too_full
850
+ || is_region_full;
858
851
}
859
852
860
- void PSParallelCompact::summary_phase ()
853
+ void PSParallelCompact::summary_phase (bool should_do_max_compaction )
861
854
{
862
855
GCTraceTime (Info, gc, phases) tm (" Summary Phase" , &_gc_timer);
863
856
@@ -880,9 +873,10 @@ void PSParallelCompact::summary_phase()
880
873
_space_info[i].set_dense_prefix (space->bottom ());
881
874
}
882
875
883
- bool maximum_compaction = check_maximum_compaction (total_live_words,
884
- old_space,
885
- full_region_prefix_end);
876
+ should_do_max_compaction = check_maximum_compaction (should_do_max_compaction,
877
+ total_live_words,
878
+ old_space,
879
+ full_region_prefix_end);
886
880
{
887
881
GCTraceTime (Info, gc, phases) tm (" Summary Phase: expand" , &_gc_timer);
888
882
// Try to expand old-gen in order to fit all live objs and waste.
@@ -891,7 +885,7 @@ void PSParallelCompact::summary_phase()
891
885
ParallelScavengeHeap::heap ()->old_gen ()->try_expand_till_size (target_capacity_bytes);
892
886
}
893
887
894
- HeapWord* dense_prefix_end = maximum_compaction
888
+ HeapWord* dense_prefix_end = should_do_max_compaction
895
889
? full_region_prefix_end
896
890
: compute_dense_prefix_for_old_space (old_space,
897
891
full_region_prefix_end);
@@ -961,11 +955,7 @@ void PSParallelCompact::summary_phase()
961
955
}
962
956
}
963
957
964
- // This method invokes a full collection. The argument controls whether
965
- // soft-refs should be cleared or not.
966
- // Note that this method should only be called from the vm_thread while at a
967
- // safepoint.
968
- bool PSParallelCompact::invoke (bool clear_all_soft_refs) {
958
+ bool PSParallelCompact::invoke (bool clear_all_soft_refs, bool should_do_max_compaction) {
969
959
assert (SafepointSynchronize::is_at_safepoint (), " should be at safepoint" );
970
960
assert (Thread::current () == (Thread*)VMThread::vm_thread (),
971
961
" should be in vm thread" );
@@ -1020,7 +1010,7 @@ bool PSParallelCompact::invoke(bool clear_all_soft_refs) {
1020
1010
1021
1011
marking_phase (&_gc_tracer);
1022
1012
1023
- summary_phase ();
1013
+ summary_phase (should_do_max_compaction );
1024
1014
1025
1015
#if COMPILER2_OR_JVMCI
1026
1016
assert (DerivedPointerTable::is_active (), " Sanity" );
0 commit comments