hotspot/src/share/vm/gc/serial/tenuredGeneration.hpp
author jwilhelm
Wed, 17 Jun 2015 14:44:54 +0200
changeset 31358 693058672cc6
parent 30764 fec48bf5a827
child 32623 390a27af5657
permissions -rw-r--r--
8077842: Remove the level parameter passed around in GenCollectedHeap Reviewed-by: kbarrett, mgerdin
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:
28033
ab63acbd99ec 8066782: Move common code from CMSGeneration and TenuredGeneration to CardGeneration
brutisso
parents: 28032
diff changeset
    45
  ContiguousSpace*  _the_space;       // Actual space holding objects
27904
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    46
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  GenerationCounters*   _gen_counters;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  CSpaceCounters*       _space_counters;
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();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
 public:
31358
693058672cc6 8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents: 30764
diff changeset
    58
  TenuredGeneration(ReservedSpace rs,
693058672cc6 8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents: 30764
diff changeset
    59
                    size_t initial_byte_size,
693058672cc6 8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents: 30764
diff changeset
    60
                    GenRemSet* remset);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  Generation::Name kind() { return Generation::MarkSweepCompact; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  // Printing
27898
813ad96387b3 8065972: Remove support for ParNew+SerialOld and DefNew+CMS
brutisso
parents: 24941
diff changeset
    65
  const char* name() const { return "tenured generation"; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  const char* short_name() const { return "Tenured"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  // Does a "full" (forced) collection invoked on this generation collect
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  // all younger generations as well? Note that this is a
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  // hack to allow the collection of the younger gen first if the flag is
24941
4ebbe176a7b1 8042298: Remove the names gen0 and gen1 from the GC code
jwilhelm
parents: 22234
diff changeset
    71
  // set.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  virtual bool full_collects_younger_generations() const {
24941
4ebbe176a7b1 8042298: Remove the names gen0 and gen1 from the GC code
jwilhelm
parents: 22234
diff changeset
    73
    return !ScavengeBeforeFullGC;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
27904
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    76
  size_t unsafe_max_alloc_nogc() const;
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    77
  size_t contiguous_available() const;
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    78
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    79
  // Iteration
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    80
  void object_iterate(ObjectClosure* blk);
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    81
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    82
  virtual inline HeapWord* allocate(size_t word_size, bool is_tlab);
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    83
  virtual inline HeapWord* par_allocate(size_t word_size, bool is_tlab);
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    84
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    85
#define TenuredGen_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix)     \
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    86
  void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl);
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    87
  TenuredGen_SINCE_SAVE_MARKS_DECL(OopsInGenClosure,_v)
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    88
  SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(TenuredGen_SINCE_SAVE_MARKS_DECL)
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    89
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    90
  void save_marks();
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    91
  void reset_saved_marks();
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    92
  bool no_allocs_since_save_marks();
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    93
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    94
  inline size_t block_size(const HeapWord* addr) const;
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    95
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    96
  inline bool block_is_obj(const HeapWord* addr) const;
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    97
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    98
  virtual void collect(bool full,
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
    99
                       bool clear_all_soft_refs,
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   100
                       size_t size,
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   101
                       bool is_tlab);
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   102
  HeapWord* expand_and_allocate(size_t size,
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   103
                                bool is_tlab,
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   104
                                bool parallel = false);
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   105
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   106
  virtual void prepare_for_verify();
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   107
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   108
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  virtual void gc_prologue(bool full);
27904
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   110
  virtual void gc_epilogue(bool full);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  bool should_collect(bool   full,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
                      size_t word_size,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
                      bool   is_tlab);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
16681
d64161ca3e3c 8008508: CMS does not correctly reduce heap size after a Full GC
jmasa
parents: 15482
diff changeset
   115
  virtual void compute_new_size();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  // Performance Counter support
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  void update_counters();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
27904
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   120
  virtual void record_spaces_top();
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   121
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  // Statistics
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
31358
693058672cc6 8077842: Remove the level parameter passed around in GenCollectedHeap
jwilhelm
parents: 30764
diff changeset
   124
  virtual void update_gc_stats(Generation* current_generation, bool full);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
6985
e9364ec299ac 6896603: CMS/GCH: collection_attempt_is_safe() ergo should use more recent data
ysr
parents: 5547
diff changeset
   126
  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
   127
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   128
  virtual void verify();
d606512952cc 8065993: Merge OneContigSpaceCardGeneration with TenuredGeneration
brutisso
parents: 27898
diff changeset
   129
  virtual void print_on(outputStream* st) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6985
diff changeset
   131
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28033
diff changeset
   132
#endif // SHARE_VM_GC_SERIAL_TENUREDGENERATION_HPP