src/hotspot/share/gc/shared/cardGeneration.hpp
author coleenp
Thu, 10 Jan 2019 15:13:51 -0500
changeset 53244 9807daeb47c4
parent 49730 c2761ef9fd95
permissions -rw-r--r--
8216167: Update include guards to reflect correct directories Summary: Use script and some manual fixup to fix directores names in include guards. Reviewed-by: lfoltan, eosterlund, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28031
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49730
diff changeset
     2
 * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
28031
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
     4
 *
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
     7
 * published by the Free Software Foundation.
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
     8
 *
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    13
 * accompanied this code).
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    14
 *
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    18
 *
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    21
 * questions.
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    22
 *
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    23
 */
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49730
diff changeset
    25
#ifndef SHARE_GC_SHARED_CARDGENERATION_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49730
diff changeset
    26
#define SHARE_GC_SHARED_CARDGENERATION_HPP
28031
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    27
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    28
// Class CardGeneration is a generation that is covered by a card table,
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    29
// and uses a card-size block-offset array to implement block_start.
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    30
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28033
diff changeset
    31
#include "gc/shared/generation.hpp"
28031
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    32
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    33
class BlockOffsetSharedArray;
49730
c2761ef9fd95 8200759: Move GC entries in vmStructs.cpp to GC specific files
stefank
parents: 47216
diff changeset
    34
class CardTableRS;
28033
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    35
class CompactibleSpace;
28031
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    36
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    37
class CardGeneration: public Generation {
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    38
  friend class VMStructs;
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    39
 protected:
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    40
  // This is shared with other generations.
33212
906b3d079b13 8139434: Unify GenRemSet and CardTableRS
david
parents: 31358
diff changeset
    41
  CardTableRS* _rs;
28031
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    42
  // This is local to this generation.
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    43
  BlockOffsetSharedArray* _bts;
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    44
28033
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    45
  // Current shrinking effect: this damps shrinking when the heap gets empty.
28031
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    46
  size_t _shrink_factor;
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    47
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    48
  size_t _min_heap_delta_bytes;   // Minimum amount to expand.
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    49
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    50
  // Some statistics from before gc started.
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    51
  // These are gathered in the gc_prologue (and should_collect)
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    52
  // to control growing/shrinking policy in spite of promotions.
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    53
  size_t _capacity_at_prologue;
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    54
  size_t _used_at_prologue;
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    55
33212
906b3d079b13 8139434: Unify GenRemSet and CardTableRS
david
parents: 31358
diff changeset
    56
  CardGeneration(ReservedSpace rs, size_t initial_byte_size, CardTableRS* remset);
28031
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    57
28033
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    58
  virtual void assert_correct_size_change_locking() = 0;
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    59
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    60
  virtual CompactibleSpace* space() const = 0;
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    61
28031
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    62
 public:
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    63
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    64
  // Attempt to expand the generation by "bytes".  Expand by at a
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    65
  // minimum "expand_bytes".  Return true if some amount (not
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    66
  // necessarily the full "bytes") was done.
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    67
  virtual bool expand(size_t bytes, size_t expand_bytes);
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    68
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    69
  // Shrink generation with specified size
28033
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    70
  virtual void shrink(size_t bytes);
28031
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    71
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    72
  virtual void compute_new_size();
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    73
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    74
  virtual void clear_remembered_set();
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    75
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    76
  virtual void invalidate_remembered_set();
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    77
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    78
  virtual void prepare_for_verify();
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    79
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    80
  // Grow generation with specified size (returns false if unable to grow)
28033
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    81
  bool grow_by(size_t bytes);
28031
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    82
  // Grow generation to reserved size.
28033
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    83
  bool grow_to_reserved();
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    84
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    85
  size_t capacity() const;
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    86
  size_t used() const;
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    87
  size_t free() const;
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    88
  MemRegion used_region() const;
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    89
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    90
  void space_iterate(SpaceClosure* blk, bool usedOnly = false);
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    91
30870
3050fdcdc60b 8080112: Replace and remove the last usages of CollectedHeap::n_par_threads()
stefank
parents: 30764
diff changeset
    92
  void younger_refs_iterate(OopsInGenClosure* blk, uint n_threads);
28033
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    93
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    94
  bool is_in(const void* p) const;
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    95
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28031
diff changeset
    96
  CompactibleSpace* first_compaction_space() const;
28031
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    97
};
10aec24d2b61 8066780: Split CardGeneration out to its own file
brutisso
parents:
diff changeset
    98
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49730
diff changeset
    99
#endif // SHARE_GC_SHARED_CARDGENERATION_HPP