src/share/vm/memory/generationSpec.hpp

Mon, 23 Jun 2008 16:49:37 -0700

author
ysr
date
Mon, 23 Jun 2008 16:49:37 -0700
changeset 782
60fb9c4db4e6
parent 435
a61af66fc99e
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6718086: CMS assert: _concurrent_iteration_safe_limit update missed
Summary: Initialize the field correctly in ContiguousSpace's constructor and initialize() methods, using the latter for the survivor spaces upon initial construction or a subsequent resizing of the young generation. Add some missing Space sub-class constructors.
Reviewed-by: apetrusenko

     1 /*
     2  * Copyright 2001-2004 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  *
    19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
    21  * have any questions.
    22  *
    23  */
    25 // The specification of a generation.  This class also encapsulates
    26 // some generation-specific behavior.  This is done here rather than as a
    27 // virtual function of Generation because these methods are needed in
    28 // initialization of the Generations.
    29 class GenerationSpec : public CHeapObj {
    30   friend class VMStructs;
    31 private:
    32   Generation::Name _name;
    33   size_t           _init_size;
    34   size_t           _max_size;
    36 public:
    37   GenerationSpec(Generation::Name name, size_t init_size, size_t max_size) {
    38     _name = name;
    39     _init_size = init_size;
    40     _max_size = max_size;
    41   }
    43   Generation* init(ReservedSpace rs, int level, GenRemSet* remset);
    45   // Accessors
    46   Generation::Name name()        const { return _name; }
    47   size_t init_size()             const { return _init_size; }
    48   void set_init_size(size_t size)      { _init_size = size; }
    49   size_t max_size()              const { return _max_size; }
    50   void set_max_size(size_t size)       { _max_size = size; }
    52   // Alignment
    53   void align(size_t alignment) {
    54     set_init_size(align_size_up(init_size(), alignment));
    55     set_max_size(align_size_up(max_size(), alignment));
    56   }
    58   // Return the number of regions contained in the generation which
    59   // might need to be independently covered by a remembered set.
    60   virtual int n_covered_regions() const { return 1; }
    61 };
    63 typedef GenerationSpec* GenerationSpecPtr;
    65 // The specification of a permanent generation. This class is very
    66 // similar to GenerationSpec in use. Due to PermGen's not being a
    67 // true Generation, we cannot combine the spec classes either.
    68 class PermanentGenerationSpec : public CHeapObj {
    69   friend class VMStructs;
    70 private:
    71   PermGen::Name    _name;
    72   size_t           _init_size;
    73   size_t           _max_size;
    74   size_t           _read_only_size;
    75   size_t           _read_write_size;
    76   size_t           _misc_data_size;
    77   size_t           _misc_code_size;
    78   bool             _enable_shared_spaces;
    80   enum {
    81     _n_spaces = 2
    82   };
    84 public:
    85   PermanentGenerationSpec(PermGen::Name name, size_t init_size,
    86                           size_t max_size, size_t read_only_size,
    87                           size_t read_write_size, size_t misc_data_size,
    88                           size_t misc_code_size);
    90   PermGen* init(ReservedSpace rs, size_t init_size, GenRemSet* remset);
    92   void disable_sharing() {
    93     _enable_shared_spaces = false;
    94     _read_only_size = 0;
    95     _read_write_size = 0;
    96     _misc_data_size = 0;
    97     _misc_code_size = 0;
    98   }
   100   // Accessors
   101   PermGen::Name name()           const { return _name; }
   102   size_t init_size()             const { return _init_size; }
   103   void set_init_size(size_t size)      { _init_size = size; }
   105   // Max size for user DOES NOT include shared spaces.
   106   // Max size for space allocation DOES include shared spaces.
   107   size_t max_size() const {
   108     return _max_size + _read_only_size + _read_write_size;
   109   }
   111   // Need one covered region for the main space, and one for the shared
   112   // spaces (together).
   113   int n_covered_regions() const { return 2; }
   115   void align(size_t alignment);
   117   size_t read_only_size() const { return _read_only_size; }
   118   size_t read_write_size() const { return _read_write_size; }
   119   size_t misc_data_size() const { return _misc_data_size; }
   120   size_t misc_code_size() const { return _misc_code_size; }
   121   bool enable_shared_spaces()    const { return _enable_shared_spaces; }
   122 };

mercurial