hotspot/src/share/vm/gc/g1/g1CollectionSet.hpp
author mgerdin
Wed, 27 Apr 2016 11:25:16 +0200
changeset 38109 6503703df058
parent 37985 539c597ee0fa
child 38183 cb68e4923223
permissions -rw-r--r--
8155209: Move setting of young index in cset to G1CollectionSet Reviewed-by: sjohanss, ehelin
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
/*
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
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
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    25
#ifndef SHARE_VM_GC_G1_G1COLLECTIONSET_HPP
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    26
#define SHARE_VM_GC_G1_G1COLLECTIONSET_HPP
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 "gc/g1/collectionSetChooser.hpp"
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    29
#include "memory/allocation.hpp"
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    30
#include "utilities/debug.hpp"
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    31
#include "utilities/globalDefinitions.hpp"
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    32
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    33
class G1CollectedHeap;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    34
class G1CollectorState;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    35
class G1GCPhaseTimes;
37985
539c597ee0fa 8154154: Separate G1 specific policy code from the CollectorPolicy class hierarchy
mgerdin
parents: 37262
diff changeset
    36
class G1Policy;
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    37
class HeapRegion;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    38
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    39
class G1CollectionSet VALUE_OBJ_CLASS_SPEC {
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    40
  G1CollectedHeap* _g1;
37985
539c597ee0fa 8154154: Separate G1 specific policy code from the CollectorPolicy class hierarchy
mgerdin
parents: 37262
diff changeset
    41
  G1Policy* _policy;
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    42
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    43
  CollectionSetChooser* _cset_chooser;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    44
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    45
  uint _eden_region_length;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    46
  uint _survivor_region_length;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    47
  uint _old_region_length;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    48
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    49
  // The head of the list (via "next_in_collection_set()") representing the
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    50
  // current collection set. Set from the incrementally built collection
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    51
  // set at the start of the pause.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    52
  HeapRegion* _head;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    53
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    54
  // 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
    55
  // the incrementally built collection set at the start of an evacuation
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    56
  // pause, and incremented in finalize_old_part() when adding old regions
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    57
  // (if any) to the collection set.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    58
  size_t _bytes_used_before;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    59
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    60
  size_t _recorded_rs_lengths;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    61
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    62
  // The associated information that is maintained while the incremental
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    63
  // collection set is being built with young regions. Used to populate
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    64
  // the recorded info for the evacuation pause.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    65
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    66
  enum CSetBuildType {
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    67
    Active,             // We are actively building the collection set
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    68
    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
    69
  };
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    70
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    71
  CSetBuildType _inc_build_state;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    72
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    73
  // The head of the incrementally built collection set.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    74
  HeapRegion* _inc_head;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    75
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    76
  // The tail of the incrementally built collection set.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    77
  HeapRegion* _inc_tail;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    78
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    79
  // 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
    80
  // 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
    81
  // an evacuation pause.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    82
  size_t _inc_bytes_used_before;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    83
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    84
  // 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
    85
  // 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
    86
  // 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
    87
  // 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
    88
  // synchronize updates to this field.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    89
  size_t _inc_recorded_rs_lengths;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    90
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    91
  // A concurrent refinement thread periodically samples the young
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    92
  // 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
    93
  // 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
    94
  // 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
    95
  // _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
    96
  ssize_t _inc_recorded_rs_lengths_diffs;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    97
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
    98
  // 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
    99
  // 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
   100
  // 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
   101
  // MT-safety assumptions.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   102
  double _inc_predicted_elapsed_time_ms;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   103
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   104
  // 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
   105
  double _inc_predicted_elapsed_time_ms_diffs;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   106
38109
6503703df058 8155209: Move setting of young index in cset to G1CollectionSet
mgerdin
parents: 37985
diff changeset
   107
  uint _inc_region_length;
6503703df058 8155209: Move setting of young index in cset to G1CollectionSet
mgerdin
parents: 37985
diff changeset
   108
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   109
  G1CollectorState* collector_state();
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   110
  G1GCPhaseTimes* phase_times();
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   111
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   112
  double predict_region_elapsed_time_ms(HeapRegion* hr);
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   113
38109
6503703df058 8155209: Move setting of young index in cset to G1CollectionSet
mgerdin
parents: 37985
diff changeset
   114
  void verify_young_cset_indices() const NOT_DEBUG_RETURN;
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   115
public:
37985
539c597ee0fa 8154154: Separate G1 specific policy code from the CollectorPolicy class hierarchy
mgerdin
parents: 37262
diff changeset
   116
  G1CollectionSet(G1CollectedHeap* g1h, G1Policy* policy);
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   117
  ~G1CollectionSet();
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   118
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   119
  CollectionSetChooser* cset_chooser();
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   120
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   121
  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
   122
                           uint survivor_cset_region_length);
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   123
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   124
  void set_recorded_rs_lengths(size_t rs_lengths);
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   125
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   126
  uint region_length() const       { return young_region_length() +
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   127
                                            old_region_length(); }
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   128
  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
   129
                                            survivor_region_length(); }
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   130
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   131
  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
   132
  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
   133
  uint old_region_length() const      { return _old_region_length;      }
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   134
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   135
  // Incremental CSet Support
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   136
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   137
  // The head of the incrementally built collection set.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   138
  HeapRegion* inc_head() { return _inc_head; }
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   139
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   140
  // The tail of the incrementally built collection set.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   141
  HeapRegion* inc_tail() { return _inc_tail; }
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   142
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   143
  // Initialize incremental collection set info.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   144
  void start_incremental_building();
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   145
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   146
  // Perform any final calculations on the incremental CSet fields
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   147
  // before we can use them.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   148
  void finalize_incremental_building();
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   149
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   150
  void clear_incremental() {
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   151
    _inc_head = NULL;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   152
    _inc_tail = NULL;
38109
6503703df058 8155209: Move setting of young index in cset to G1CollectionSet
mgerdin
parents: 37985
diff changeset
   153
    _inc_region_length = 0;
37039
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   154
  }
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   155
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   156
  // Stop adding regions to the incremental collection set
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   157
  void stop_incremental_building() { _inc_build_state = Inactive; }
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   158
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   159
  // The head of the list (via "next_in_collection_set()") representing the
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   160
  // current collection set.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   161
  HeapRegion* head() { return _head; }
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   162
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   163
  void clear_head() { _head = NULL; }
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   164
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   165
  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
   166
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   167
  size_t bytes_used_before() const {
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   168
    return _bytes_used_before;
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   169
  }
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   170
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   171
  void reset_bytes_used_before() {
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   172
    _bytes_used_before = 0;
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
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   175
  // Choose a new collection set.  Marks the chosen regions as being
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   176
  // "in_collection_set", and links them together.  The head and number of
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   177
  // the collection set are available via access methods.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   178
  double finalize_young_part(double target_pause_time_ms);
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   179
  void finalize_old_part(double time_remaining_ms);
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
  // Add old region "hr" to the CSet.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   182
  void add_old_region(HeapRegion* hr);
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   183
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   184
  // 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
   185
  // the incrementally built collection set.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   186
  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
   187
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   188
  // Add hr to the LHS of the incremental collection set.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   189
  void add_eden_region(HeapRegion* hr);
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   190
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   191
  // Add hr to the RHS of the incremental collection set.
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   192
  void add_survivor_regions(HeapRegion* hr);
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   193
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   194
#ifndef PRODUCT
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   195
  void print(HeapRegion* list_head, outputStream* st);
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   196
#endif // !PRODUCT
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   197
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   198
private:
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   199
  // Update the incremental cset information when adding a region
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   200
  // (should not be called directly).
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   201
  void add_young_region_common(HeapRegion* hr);
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   202
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   203
};
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   204
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   205
#endif // SHARE_VM_GC_G1_G1COLLECTIONSET_HPP
79f62b89a7a6 8151178: Move the collection set out of the G1 collector policy
mgerdin
parents:
diff changeset
   206