src/hotspot/share/gc/g1/g1CollectionSet.hpp
author tschatzl
Wed, 17 Jul 2019 16:33:19 +0200
changeset 55722 5ee183a90e65
parent 55510 3e31a8beaae4
child 57663 bf8e76d86d05
permissions -rw-r--r--
8227084: Add timing information for merge heap root preparation Reviewed-by: sangheki, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52897
diff changeset
     2
 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
     4
 *
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
     7
 * published by the Free Software Foundation.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
     8
 *
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    13
 * accompanied this code).
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    14
 *
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    18
 *
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    21
 * questions.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    22
 *
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    23
 */
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52897
diff changeset
    25
#ifndef SHARE_GC_G1_G1COLLECTIONSET_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52897
diff changeset
    26
#define SHARE_GC_G1_G1COLLECTIONSET_HPP
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    27
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    28
#include "utilities/debug.hpp"
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    29
#include "utilities/globalDefinitions.hpp"
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    30
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    31
class G1CollectedHeap;
53703
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
    32
class G1CollectionSetCandidates;
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    33
class G1CollectorState;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    34
class G1GCPhaseTimes;
52897
495c05ee2a9a 8213890: Implementation of JEP 344: Abortable Mixed Collections for G1
sjohanss
parents: 49806
diff changeset
    35
class G1ParScanThreadStateSet;
37985
539c597ee0fa 8154154: Separate G1 specific policy code from the CollectorPolicy class hierarchy
mgerdin
parents: 37262
diff changeset
    36
class G1Policy;
38183
cb68e4923223 8150721: Don't explicitly manage G1 young regions in YoungList
mgerdin
parents: 38109
diff changeset
    37
class G1SurvivorRegions;
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    38
class HeapRegion;
55510
3e31a8beaae4 8213108: Improve work distribution during remembered set scan
tschatzl
parents: 54465
diff changeset
    39
class HeapRegionClaimer;
53703
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
    40
class HeapRegionClosure;
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    41
54465
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    42
// The collection set.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    43
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    44
// The set of regions that are evacuated during an evacuation pause.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    45
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    46
// At the end of a collection, before freeing the collection set, this set
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    47
// contains all regions that were evacuated during this collection:
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    48
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    49
// - survivor regions from the last collection (if any)
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    50
// - eden regions allocated by the mutator
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    51
// - old gen regions evacuated during mixed gc
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    52
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    53
// This set is built incrementally at mutator time as regions are retired, and
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    54
// if this had been a mixed gc, some additional (during gc) incrementally added
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    55
// old regions from the collection set candidates built during the concurrent
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    56
// cycle.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    57
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    58
// A more detailed overview of how the collection set changes over time follows:
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    59
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    60
// 0) at the end of GC the survivor regions are added to this collection set.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    61
// 1) the mutator incrementally adds eden regions as they retire
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    62
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    63
// ----- gc starts
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    64
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    65
// 2) prepare (finalize) young regions of the collection set for collection
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    66
//    - relabel the survivors as eden
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    67
//    - finish up the incremental building that happened at mutator time
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    68
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    69
// iff this is a young-only collection:
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    70
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    71
// a3) evacuate the current collection set in one "initial evacuation" phase
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    72
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    73
// iff this is a mixed collection:
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    74
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    75
// b3) calculate the set of old gen regions we may be able to collect in this
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    76
//     collection from the list of collection set candidates.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    77
//     - one part is added to the current collection set
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    78
//     - the remainder regions are labeled as optional, and NOT yet added to the
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    79
//     collection set.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    80
// b4) evacuate the current collection set in the "initial evacuation" phase
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    81
// b5) evacuate the optional regions in the "optional evacuation" phase. This is
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    82
//     done in increments (or rounds).
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    83
//     b5-1) add a few of the optional regions to the current collection set
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    84
//     b5-2) evacuate only these newly added optional regions. For this mechanism we
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    85
//     reuse the incremental collection set building infrastructure (used also at
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    86
//     mutator time).
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    87
//     b5-3) repeat from b5-1 until the policy determines we are done
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    88
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    89
// all collections
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    90
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    91
// 6) free the collection set (contains all regions now; empties collection set
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    92
//    afterwards)
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    93
// 7) add survivors to this collection set
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    94
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    95
// ----- gc ends
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    96
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    97
// goto 1)
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    98
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
    99
// Examples of how the collection set might look over time:
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   100
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   101
// Legend:
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   102
// S = survivor, E = eden, O = old.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   103
// |xxxx| = increment (with increment markers), containing four regions
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   104
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   105
// |SSSS|                         ... after step 0), with four survivor regions
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   106
// |SSSSEE|                       ... at step 1), after retiring two eden regions
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   107
// |SSSSEEEE|                     ... after step 1), after retiring four eden regions
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   108
// |EEEEEEEE|                     ... after step 2)
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   109
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   110
// iff this is a young-only collection
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   111
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   112
// EEEEEEEE||                      ... after step a3), after initial evacuation phase
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   113
// ||                              ... after step 6)
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   114
// |SS|                            ... after step 7), with two survivor regions
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   115
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   116
// iff this is a mixed collection
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   117
//
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   118
// |EEEEEEEEOOOO|                  ... after step b3), added four regions to be
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   119
//                                     evacuated in the "initial evacuation" phase
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   120
// EEEEEEEEOOOO||                  ... after step b4), incremental part is empty
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   121
//                                     after evacuation
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   122
// EEEEEEEEOOOO|OO|                ... after step b5.1), added two regions to be
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   123
//                                     evacuated in the first round of the
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   124
//                                     "optional evacuation" phase
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   125
// EEEEEEEEOOOOOO|O|               ... after step b5.1), added one region to be
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   126
//                                     evacuated in the second round of the
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   127
//                                     "optional evacuation" phase
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   128
// EEEEEEEEOOOOOOO||               ... after step b5), the complete collection set.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   129
// ||                              ... after step b6)
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   130
// |SSS|                           ... after step 7), with three survivor regions
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   131
//
49392
2956d0ece7a9 8199282: Remove ValueObj class for allocation subclassing for gc code
coleenp
parents: 47216
diff changeset
   132
class G1CollectionSet {
49806
2d62570a615c 8200426: Make G1 code use _g1h members
tschatzl
parents: 49392
diff changeset
   133
  G1CollectedHeap* _g1h;
37985
539c597ee0fa 8154154: Separate G1 specific policy code from the CollectorPolicy class hierarchy
mgerdin
parents: 37262
diff changeset
   134
  G1Policy* _policy;
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   135
54465
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   136
  // All old gen collection set candidate regions for the current mixed phase.
53703
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
   137
  G1CollectionSetCandidates* _candidates;
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   138
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   139
  uint _eden_region_length;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   140
  uint _survivor_region_length;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   141
  uint _old_region_length;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   142
39698
4016de4e596b 8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents: 38183
diff changeset
   143
  // The actual collection set as a set of region indices.
4016de4e596b 8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents: 38183
diff changeset
   144
  // All entries in _collection_set_regions below _collection_set_cur_length are
54465
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   145
  // assumed to be part of the collection set.
39698
4016de4e596b 8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents: 38183
diff changeset
   146
  // We assume that at any time there is at most only one writer and (one or more)
4016de4e596b 8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents: 38183
diff changeset
   147
  // concurrent readers. This means we are good with using storestore and loadload
4016de4e596b 8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents: 38183
diff changeset
   148
  // barriers on the writer and reader respectively only.
4016de4e596b 8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents: 38183
diff changeset
   149
  uint* _collection_set_regions;
4016de4e596b 8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents: 38183
diff changeset
   150
  volatile size_t _collection_set_cur_length;
4016de4e596b 8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents: 38183
diff changeset
   151
  size_t _collection_set_max_length;
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   152
54465
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   153
  // When doing mixed collections we can add old regions to the collection set, which
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   154
  // will be collected only if there is enough time. We call these optional regions.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   155
  // This member records the current number of regions that are of that type that
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   156
  // correspond to the first x entries in the collection set candidates.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   157
  uint _num_optional_regions;
52897
495c05ee2a9a 8213890: Implementation of JEP 344: Abortable Mixed Collections for G1
sjohanss
parents: 49806
diff changeset
   158
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   159
  // The number of bytes in the collection set before the pause. Set from
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   160
  // the incrementally built collection set at the start of an evacuation
54465
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   161
  // pause, and updated as more regions are added to the collection set.
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   162
  size_t _bytes_used_before;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   163
54465
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   164
  // The number of cards in the remembered set in the collection set. Set from
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   165
  // the incrementally built collection set at the start of an evacuation
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   166
  // pause, and updated as more regions are added to the collection set.
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   167
  size_t _recorded_rs_lengths;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   168
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   169
  enum CSetBuildType {
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   170
    Active,             // We are actively building the collection set
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   171
    Inactive            // We are not actively building the collection set
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   172
  };
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   173
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   174
  CSetBuildType _inc_build_state;
54465
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   175
  size_t _inc_part_start;
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   176
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   177
  // The associated information that is maintained while the incremental
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   178
  // collection set is being built with *young* regions. Used to populate
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   179
  // the recorded info for the evacuation pause.
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   180
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   181
  // The number of bytes in the incrementally built collection set.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   182
  // Used to set _collection_set_bytes_used_before at the start of
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   183
  // an evacuation pause.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   184
  size_t _inc_bytes_used_before;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   185
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   186
  // The RSet lengths recorded for regions in the CSet. It is updated
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   187
  // by the thread that adds a new region to the CSet. We assume that
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   188
  // only one thread can be allocating a new CSet region (currently,
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   189
  // it does so after taking the Heap_lock) hence no need to
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   190
  // synchronize updates to this field.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   191
  size_t _inc_recorded_rs_lengths;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   192
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   193
  // A concurrent refinement thread periodically samples the young
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   194
  // region RSets and needs to update _inc_recorded_rs_lengths as
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   195
  // the RSets grow. Instead of having to synchronize updates to that
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   196
  // field we accumulate them in this field and add it to
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   197
  // _inc_recorded_rs_lengths_diffs at the start of a GC.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   198
  ssize_t _inc_recorded_rs_lengths_diffs;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   199
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   200
  // The predicted elapsed time it will take to collect the regions in
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   201
  // the CSet. This is updated by the thread that adds a new region to
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   202
  // the CSet. See the comment for _inc_recorded_rs_lengths about
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   203
  // MT-safety assumptions.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   204
  double _inc_predicted_elapsed_time_ms;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   205
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   206
  // See the comment for _inc_recorded_rs_lengths_diffs.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   207
  double _inc_predicted_elapsed_time_ms_diffs;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   208
54465
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   209
  void set_recorded_rs_lengths(size_t rs_lengths);
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   210
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   211
  G1CollectorState* collector_state();
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   212
  G1GCPhaseTimes* phase_times();
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   213
52897
495c05ee2a9a 8213890: Implementation of JEP 344: Abortable Mixed Collections for G1
sjohanss
parents: 49806
diff changeset
   214
  void verify_young_cset_indices() const NOT_DEBUG_RETURN;
54465
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   215
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   216
  double predict_region_elapsed_time_ms(HeapRegion* hr);
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   217
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   218
  // Update the incremental collection set information when adding a region.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   219
  void add_young_region_common(HeapRegion* hr);
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   220
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   221
  // Add old region "hr" to the collection set.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   222
  void add_old_region(HeapRegion* hr);
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   223
  void free_optional_regions();
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   224
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   225
  // Add old region "hr" to optional collection set.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   226
  void add_optional_region(HeapRegion* hr);
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   227
54465
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   228
  void move_candidates_to_collection_set(uint num_regions);
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   229
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   230
  // Finalize the young part of the initial collection set. Relabel survivor regions
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   231
  // as Eden and calculate a prediction on how long the evacuation of all young regions
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   232
  // will take.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   233
  double finalize_young_part(double target_pause_time_ms, G1SurvivorRegions* survivors);
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   234
  // Perform any final calculations on the incremental collection set fields before we
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   235
  // can use them.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   236
  void finalize_incremental_building();
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   237
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   238
  // Select the old regions of the initial collection set and determine how many optional
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   239
  // regions we might be able to evacuate in this pause.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   240
  void finalize_old_part(double time_remaining_ms);
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   241
public:
37985
539c597ee0fa 8154154: Separate G1 specific policy code from the CollectorPolicy class hierarchy
mgerdin
parents: 37262
diff changeset
   242
  G1CollectionSet(G1CollectedHeap* g1h, G1Policy* policy);
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   243
  ~G1CollectionSet();
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   244
39698
4016de4e596b 8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents: 38183
diff changeset
   245
  // Initializes the collection set giving the maximum possible length of the collection set.
4016de4e596b 8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents: 38183
diff changeset
   246
  void initialize(uint max_region_length);
4016de4e596b 8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents: 38183
diff changeset
   247
53703
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
   248
  void clear_candidates();
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
   249
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
   250
  void set_candidates(G1CollectionSetCandidates* candidates) {
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
   251
    assert(_candidates == NULL, "Trying to replace collection set candidates.");
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
   252
    _candidates = candidates;
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
   253
  }
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
   254
  G1CollectionSetCandidates* candidates() { return _candidates; }
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   255
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   256
  void init_region_lengths(uint eden_cset_region_length,
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   257
                           uint survivor_cset_region_length);
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   258
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   259
  uint region_length() const       { return young_region_length() +
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   260
                                            old_region_length(); }
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   261
  uint young_region_length() const { return eden_region_length() +
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   262
                                            survivor_region_length(); }
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   263
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   264
  uint eden_region_length() const     { return _eden_region_length;     }
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   265
  uint survivor_region_length() const { return _survivor_region_length; }
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   266
  uint old_region_length() const      { return _old_region_length;      }
54465
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   267
  uint optional_region_length() const { return _num_optional_regions; }
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   268
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   269
  // Reset the contents of the collection set.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   270
  void clear();
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   271
39698
4016de4e596b 8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents: 38183
diff changeset
   272
  // Incremental collection set support
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   273
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   274
  // Initialize incremental collection set info.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   275
  void start_incremental_building();
54465
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   276
  // Start a new collection set increment.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   277
  void update_incremental_marker() { _inc_build_state = Active; _inc_part_start = _collection_set_cur_length; }
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   278
  // Stop adding regions to the current collection set increment.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   279
  void stop_incremental_building() { _inc_build_state = Inactive; }
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   280
54465
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   281
  // Iterate over the current collection set increment applying the given HeapRegionClosure
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   282
  // from a starting position determined by the given worker id.
55510
3e31a8beaae4 8213108: Improve work distribution during remembered set scan
tschatzl
parents: 54465
diff changeset
   283
  void iterate_incremental_part_from(HeapRegionClosure* cl, HeapRegionClaimer* hr_claimer, uint worker_id, uint total_workers) const;
3e31a8beaae4 8213108: Improve work distribution during remembered set scan
tschatzl
parents: 54465
diff changeset
   284
3e31a8beaae4 8213108: Improve work distribution during remembered set scan
tschatzl
parents: 54465
diff changeset
   285
  // Returns the length of the current increment in number of regions.
3e31a8beaae4 8213108: Improve work distribution during remembered set scan
tschatzl
parents: 54465
diff changeset
   286
  size_t increment_length() const { return _collection_set_cur_length - _inc_part_start; }
3e31a8beaae4 8213108: Improve work distribution during remembered set scan
tschatzl
parents: 54465
diff changeset
   287
  // Returns the length of the whole current collection set in number of regions
3e31a8beaae4 8213108: Improve work distribution during remembered set scan
tschatzl
parents: 54465
diff changeset
   288
  size_t cur_length() const { return _collection_set_cur_length; }
39698
4016de4e596b 8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents: 38183
diff changeset
   289
54465
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   290
  // Iterate over the entire collection set (all increments calculated so far), applying
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   291
  // the given HeapRegionClosure on all of them.
39698
4016de4e596b 8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents: 38183
diff changeset
   292
  void iterate(HeapRegionClosure* cl) const;
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   293
54465
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   294
  void iterate_optional(HeapRegionClosure* cl) const;
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   295
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   296
  size_t recorded_rs_lengths() { return _recorded_rs_lengths; }
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   297
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   298
  size_t bytes_used_before() const {
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   299
    return _bytes_used_before;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   300
  }
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   301
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   302
  void reset_bytes_used_before() {
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   303
    _bytes_used_before = 0;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   304
  }
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   305
54465
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   306
  // Finalize the initial collection set consisting of all young regions potentially a
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   307
  // few old gen regions.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   308
  void finalize_initial_collection_set(double target_pause_time_ms, G1SurvivorRegions* survivor);
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   309
  // Finalize the next collection set from the set of available optional old gen regions.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   310
  bool finalize_optional_for_evacuation(double remaining_pause_time);
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   311
  // Abandon (clean up) optional collection set regions that were not evacuated in this
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   312
  // pause.
c4f16445675a 8218668: Clean up evacuation of optional collection set
tschatzl
parents: 53703
diff changeset
   313
  void abandon_optional_collection_set(G1ParScanThreadStateSet* pss);
52897
495c05ee2a9a 8213890: Implementation of JEP 344: Abortable Mixed Collections for G1
sjohanss
parents: 49806
diff changeset
   314
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   315
  // Update information about hr in the aggregated information for
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   316
  // the incrementally built collection set.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   317
  void update_young_region_prediction(HeapRegion* hr, size_t new_rs_length);
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   318
39698
4016de4e596b 8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents: 38183
diff changeset
   319
  // Add eden region to the collection set.
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   320
  void add_eden_region(HeapRegion* hr);
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   321
39698
4016de4e596b 8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents: 38183
diff changeset
   322
  // Add survivor region to the collection set.
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   323
  void add_survivor_regions(HeapRegion* hr);
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   324
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   325
#ifndef PRODUCT
39698
4016de4e596b 8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents: 38183
diff changeset
   326
  bool verify_young_ages();
4016de4e596b 8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents: 38183
diff changeset
   327
4016de4e596b 8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents: 38183
diff changeset
   328
  void print(outputStream* st);
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   329
#endif // !PRODUCT
52897
495c05ee2a9a 8213890: Implementation of JEP 344: Abortable Mixed Collections for G1
sjohanss
parents: 49806
diff changeset
   330
};
495c05ee2a9a 8213890: Implementation of JEP 344: Abortable Mixed Collections for G1
sjohanss
parents: 49806
diff changeset
   331
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52897
diff changeset
   332
#endif // SHARE_GC_G1_G1COLLECTIONSET_HPP