src/share/vm/memory/generationSpec.hpp

Wed, 15 Feb 2012 10:12:55 -0800

author
never
date
Wed, 15 Feb 2012 10:12:55 -0800
changeset 3571
09d00c18e323
parent 2314
f95d63e2154a
child 3900
d2a62e0f25eb
permissions
-rw-r--r--

7145537: minor tweaks to LogEvents
Reviewed-by: kvn, twisti

     1 /*
     2  * Copyright (c) 2001, 2010, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    22  *
    23  */
    25 #ifndef SHARE_VM_MEMORY_GENERATIONSPEC_HPP
    26 #define SHARE_VM_MEMORY_GENERATIONSPEC_HPP
    28 #include "memory/generation.hpp"
    29 #include "memory/permGen.hpp"
    31 // The specification of a generation.  This class also encapsulates
    32 // some generation-specific behavior.  This is done here rather than as a
    33 // virtual function of Generation because these methods are needed in
    34 // initialization of the Generations.
    35 class GenerationSpec : public CHeapObj {
    36   friend class VMStructs;
    37 private:
    38   Generation::Name _name;
    39   size_t           _init_size;
    40   size_t           _max_size;
    42 public:
    43   GenerationSpec(Generation::Name name, size_t init_size, size_t max_size) {
    44     _name = name;
    45     _init_size = init_size;
    46     _max_size = max_size;
    47   }
    49   Generation* init(ReservedSpace rs, int level, GenRemSet* remset);
    51   // Accessors
    52   Generation::Name name()        const { return _name; }
    53   size_t init_size()             const { return _init_size; }
    54   void set_init_size(size_t size)      { _init_size = size; }
    55   size_t max_size()              const { return _max_size; }
    56   void set_max_size(size_t size)       { _max_size = size; }
    58   // Alignment
    59   void align(size_t alignment) {
    60     set_init_size(align_size_up(init_size(), alignment));
    61     set_max_size(align_size_up(max_size(), alignment));
    62   }
    64   // Return the number of regions contained in the generation which
    65   // might need to be independently covered by a remembered set.
    66   virtual int n_covered_regions() const { return 1; }
    67 };
    69 typedef GenerationSpec* GenerationSpecPtr;
    71 // The specification of a permanent generation. This class is very
    72 // similar to GenerationSpec in use. Due to PermGen's not being a
    73 // true Generation, we cannot combine the spec classes either.
    74 class PermanentGenerationSpec : public CHeapObj {
    75   friend class VMStructs;
    76 private:
    77   PermGen::Name    _name;
    78   size_t           _init_size;
    79   size_t           _max_size;
    80   size_t           _read_only_size;
    81   size_t           _read_write_size;
    82   size_t           _misc_data_size;
    83   size_t           _misc_code_size;
    84   bool             _enable_shared_spaces;
    86   enum {
    87     _n_spaces = 2
    88   };
    90 public:
    91   PermanentGenerationSpec(PermGen::Name name, size_t init_size,
    92                           size_t max_size, size_t read_only_size,
    93                           size_t read_write_size, size_t misc_data_size,
    94                           size_t misc_code_size);
    96   PermGen* init(ReservedSpace rs, size_t init_size, GenRemSet* remset);
    98   void disable_sharing() {
    99     _enable_shared_spaces = false;
   100     _read_only_size = 0;
   101     _read_write_size = 0;
   102     _misc_data_size = 0;
   103     _misc_code_size = 0;
   104   }
   106   // Accessors
   107   PermGen::Name name()           const { return _name; }
   108   size_t init_size()             const { return _init_size; }
   109   void set_init_size(size_t size)      { _init_size = size; }
   111   // Max size for user DOES NOT include shared spaces.
   112   // Max size for space allocation DOES include shared spaces.
   113   size_t max_size() const {
   114     return _max_size + _read_only_size + _read_write_size;
   115   }
   117   // Need one covered region for the main space, and one for the shared
   118   // spaces (together).
   119   int n_covered_regions() const { return 2; }
   121   void align(size_t alignment);
   123   size_t read_only_size() const { return _read_only_size; }
   124   size_t read_write_size() const { return _read_write_size; }
   125   size_t misc_data_size() const { return _misc_data_size; }
   126   size_t misc_code_size() const { return _misc_code_size; }
   127   bool enable_shared_spaces()    const { return _enable_shared_spaces; }
   128 };
   130 #endif // SHARE_VM_MEMORY_GENERATIONSPEC_HPP

mercurial