hotspot/src/share/vm/memory/tenuredGeneration.hpp
author jrose
Fri, 08 Jan 2010 13:47:01 -0800
changeset 4584 e2a449e8cc6f
parent 1623 a0dd9009e992
child 5547 f4b087cbb361
permissions -rw-r--r--
6912062: disassembler plugin needs to produce symbolic information in product mode Summary: More informative disassembly in product mode. Also, a more consistent CompileCommand syntax. Reviewed-by: never
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
1623
a0dd9009e992 6785258: Update copyright year
xdono
parents: 1557
diff changeset
     2
 * Copyright 2001-2008 Sun Microsystems, Inc.  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
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
// TenuredGeneration models the heap containing old (promoted/tenured) objects.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
class ParGCAllocBufferWithBOT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
class TenuredGeneration: public OneContigSpaceCardGeneration {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
  friend class VMStructs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
 protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
  // current shrinking effect: this damps shrinking when the heap gets empty.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
  size_t _shrink_factor;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
  // Some statistics from before gc started.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  // These are gathered in the gc_prologue (and should_collect)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  // to control growing/shrinking policy in spite of promotions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  size_t _capacity_at_prologue;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  size_t _used_at_prologue;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  // To support parallel promotion: an array of parallel allocation
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  // buffers, one per thread, initially NULL.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  ParGCAllocBufferWithBOT** _alloc_buffers;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  // Retire all alloc buffers before a full GC, so that they will be
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  // re-allocated at the start of the next young GC.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  void retire_alloc_buffers_before_full_gc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  GenerationCounters*   _gen_counters;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  CSpaceCounters*       _space_counters;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  TenuredGeneration(ReservedSpace rs, size_t initial_byte_size, int level,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
                    GenRemSet* remset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  Generation::Name kind() { return Generation::MarkSweepCompact; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  // Printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  const char* name() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  const char* short_name() const { return "Tenured"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  bool must_be_youngest() const { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  bool must_be_oldest() const { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  // Does a "full" (forced) collection invoked on this generation collect
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  // all younger generations as well? Note that this is a
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  // hack to allow the collection of the younger gen first if the flag is
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  // set. This is better than using th policy's should_collect_gen0_first()
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  // since that causes us to do an extra unnecessary pair of restart-&-stop-world.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  virtual bool full_collects_younger_generations() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
    return !CollectGen0First;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  // Mark sweep support
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  void compute_new_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  virtual void gc_prologue(bool full);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  virtual void gc_epilogue(bool full);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  bool should_collect(bool   full,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
                      size_t word_size,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
                      bool   is_tlab);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  virtual void collect(bool full,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
                       bool clear_all_soft_refs,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
                       size_t size,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
                       bool is_tlab);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
#ifndef SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  // Overrides.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  virtual oop par_promote(int thread_num,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
                          oop obj, markOop m, size_t word_sz);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  virtual void par_promote_alloc_undo(int thread_num,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
                                      HeapWord* obj, size_t word_sz);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  virtual void par_promote_alloc_done(int thread_num);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
#endif // SERIALGC
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  // Performance Counter support
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  void update_counters();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  // Statistics
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  virtual void update_gc_stats(int level, bool full);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  virtual bool promotion_attempt_is_safe(size_t max_promoted_in_bytes,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    bool younger_handles_promotion_failure) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  void verify_alloc_buffers_clean();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
};