src/share/vm/memory/generationSpec.hpp

Print this page


   1 /*
   2  * Copyright (c) 2001, 2004, 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  */
  24 






  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;
  35 
  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   }
  42 
  43   Generation* init(ReservedSpace rs, int level, GenRemSet* remset);
  44 


 103   void set_init_size(size_t size)      { _init_size = size; }
 104 
 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   }
 110 
 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; }
 114 
 115   void align(size_t alignment);
 116 
 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 };


   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  */
  24 
  25 #ifndef SHARE_VM_MEMORY_GENERATIONSPEC_HPP
  26 #define SHARE_VM_MEMORY_GENERATIONSPEC_HPP
  27 
  28 #include "memory/generation.hpp"
  29 #include "memory/permGen.hpp"
  30 
  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;
  41 
  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   }
  48 
  49   Generation* init(ReservedSpace rs, int level, GenRemSet* remset);
  50 


 109   void set_init_size(size_t size)      { _init_size = size; }
 110 
 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   }
 116 
 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; }
 120 
 121   void align(size_t alignment);
 122 
 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 };
 129 
 130 #endif // SHARE_VM_MEMORY_GENERATIONSPEC_HPP