diff -r ca5978b8378b -r 784f3f2dea14 src/hotspot/share/gc/g1/collectionSetChooser.hpp --- a/src/hotspot/share/gc/g1/collectionSetChooser.hpp Mon Mar 26 16:51:41 2018 +0200 +++ b/src/hotspot/share/gc/g1/collectionSetChooser.hpp Mon Mar 26 16:51:43 2018 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -101,17 +101,18 @@ CollectionSetChooser(); + static size_t mixed_gc_live_threshold_bytes() { + return HeapRegion::GrainBytes * (size_t) G1MixedGCLiveThresholdPercent / 100; + } + + static bool region_occupancy_low_enough_for_evac(size_t live_bytes); + void sort_regions(); // Determine whether to add the given region to the CSet chooser or // not. Currently, we skip pinned regions and regions whose live // bytes are over the threshold. Humongous regions may be reclaimed during cleanup. - bool should_add(HeapRegion* hr) { - assert(hr->is_marked(), "pre-condition"); - assert(!hr->is_young(), "should never consider young regions"); - return !hr->is_pinned() && - hr->live_bytes() < _region_live_threshold_bytes; - } + bool should_add(HeapRegion* hr) const; // Returns the number candidate old regions added uint length() { return _end; } @@ -133,6 +134,9 @@ // and the amount of reclaimable bytes by reclaimable_bytes. void update_totals(uint region_num, size_t reclaimable_bytes); + // Iterate over all collection set candidate regions. + void iterate(HeapRegionClosure* cl); + void clear(); void rebuild(WorkGang* workers, uint n_regions);