src/hotspot/share/gc/serial/tenuredGeneration.hpp
author sjohanss
Wed, 15 Nov 2017 17:05:28 +0100
changeset 47897 eb3696e0c6d8
parent 47216 71c04702a3d5
child 50034 01a88f825a84
permissions -rw-r--r--
8189734: Cleanup MarkSweep when G1 dependency is gone Reviewed-by: sangheki, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28033
diff changeset
     2
 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1623
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1623
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1623
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28033
diff changeset
    25
#ifndef SHARE_VM_GC_SERIAL_TENUREDGENERATION_HPP
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28033
diff changeset
    26
#define SHARE_VM_GC_SERIAL_TENUREDGENERATION_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6985
diff changeset
    27
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28033
diff changeset
    28
#include "gc/serial/cSpaceCounters.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28033
diff changeset
    29
#include "gc/shared/cardGeneration.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28033
diff changeset
    30
#include "gc/shared/gcStats.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28033
diff changeset
    31
#include "gc/shared/generationCounters.hpp"
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 7397
diff changeset
    32
#include "utilities/macros.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6985
diff changeset
    33
27904
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    34
// TenuredGeneration models the heap containing old (promoted/tenured) objects
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    35
// contained in a single contiguous space.
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    36
//
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    37
// Garbage collection is performed using mark-compact.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
27904
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    39
class TenuredGeneration: public CardGeneration {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  friend class VMStructs;
27904
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    41
  // Abstractly, this is a subtype that gets access to protected fields.
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    42
  friend class VM_PopulateDumpSharedSpace;
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    43
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
 protected:
32623
390a27af5657 8134626: Misc cleanups after generation array removal
jwilhelm
parents: 31358
diff changeset
    45
  ContiguousSpace*    _the_space;       // Actual space holding objects
27904
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    46
32623
390a27af5657 8134626: Misc cleanups after generation array removal
jwilhelm
parents: 31358
diff changeset
    47
  GenerationCounters* _gen_counters;
390a27af5657 8134626: Misc cleanups after generation array removal
jwilhelm
parents: 31358
diff changeset
    48
  CSpaceCounters*     _space_counters;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
27904
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    50
  // Allocation failure
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    51
  virtual bool expand(size_t bytes, size_t expand_bytes);
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    52
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    53
  // Accessing spaces
28033
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28032
diff changeset
    54
  ContiguousSpace* space() const { return _the_space; }
27904
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    55
28033
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28032
diff changeset
    56
  void assert_correct_size_change_locking();
32623
390a27af5657 8134626: Misc cleanups after generation array removal
jwilhelm
parents: 31358
diff changeset
    57
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
 public:
31358
693058672cc6 8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents: 30764
diff changeset
    59
  TenuredGeneration(ReservedSpace rs,
693058672cc6 8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents: 30764
diff changeset
    60
                    size_t initial_byte_size,
33212
906b3d079b13 8139434: Unify GenRemSet and CardTableRS
david
parents: 32623
diff changeset
    61
                    CardTableRS* remset);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  Generation::Name kind() { return Generation::MarkSweepCompact; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  // Printing
27898
813ad96387b3 8065972: Remove support for ParNew+SerialOld and DefNew+CMS
brutisso
parents: 24941
diff changeset
    66
  const char* name() const { return "tenured generation"; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  const char* short_name() const { return "Tenured"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
27904
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    69
  size_t unsafe_max_alloc_nogc() const;
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    70
  size_t contiguous_available() const;
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    71
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    72
  // Iteration
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    73
  void object_iterate(ObjectClosure* blk);
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    74
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    75
  virtual inline HeapWord* allocate(size_t word_size, bool is_tlab);
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    76
  virtual inline HeapWord* par_allocate(size_t word_size, bool is_tlab);
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    77
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    78
#define TenuredGen_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix)     \
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    79
  void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl);
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    80
  TenuredGen_SINCE_SAVE_MARKS_DECL(OopsInGenClosure,_v)
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    81
  SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(TenuredGen_SINCE_SAVE_MARKS_DECL)
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    82
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    83
  void save_marks();
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    84
  void reset_saved_marks();
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    85
  bool no_allocs_since_save_marks();
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    86
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    87
  inline size_t block_size(const HeapWord* addr) const;
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    88
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    89
  inline bool block_is_obj(const HeapWord* addr) const;
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    90
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    91
  virtual void collect(bool full,
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    92
                       bool clear_all_soft_refs,
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    93
                       size_t size,
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    94
                       bool is_tlab);
32623
390a27af5657 8134626: Misc cleanups after generation array removal
jwilhelm
parents: 31358
diff changeset
    95
27904
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    96
  HeapWord* expand_and_allocate(size_t size,
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    97
                                bool is_tlab,
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    98
                                bool parallel = false);
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    99
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   100
  virtual void prepare_for_verify();
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   101
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  virtual void gc_prologue(bool full);
27904
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   103
  virtual void gc_epilogue(bool full);
32623
390a27af5657 8134626: Misc cleanups after generation array removal
jwilhelm
parents: 31358
diff changeset
   104
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  bool should_collect(bool   full,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
                      size_t word_size,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
                      bool   is_tlab);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
16681
d64161ca3e3c 8008508: CMS does not correctly reduce heap size after a Full GC
jmasa
parents: 15482
diff changeset
   109
  virtual void compute_new_size();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  // Performance Counter support
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  void update_counters();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
27904
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   114
  virtual void record_spaces_top();
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   115
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  // Statistics
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
31358
693058672cc6 8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents: 30764
diff changeset
   118
  virtual void update_gc_stats(Generation* current_generation, bool full);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
6985
e9364ec299ac 6896603: CMS/GCH: collection_attempt_is_safe() ergo should use more recent data
ysr
parents: 5547
diff changeset
   120
  virtual bool promotion_attempt_is_safe(size_t max_promoted_in_bytes) const;
27904
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   121
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   122
  virtual void verify();
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   123
  virtual void print_on(outputStream* st) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6985
diff changeset
   125
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28033
diff changeset
   126
#endif // SHARE_VM_GC_SERIAL_TENUREDGENERATION_HPP