1 #ifdef USE_PRAGMA_IDENT_HDR
   2 #pragma ident "@(#)cmsPermGen.hpp       1.1 07/05/02 16:12:51 JVM"
   3 #endif
   4 /*
   5  * Copyright (c) 2007 Sun Microsystems, Inc.  All Rights Reserved.
   6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   7  *   
   8  * This code is free software; you can redistribute it and/or modify it
   9  * under the terms of the GNU General Public License version 2 only, as
  10  * published by the Free Software Foundation.
  11  *   
  12  * This code is distributed in the hope that it will be useful, but WITHOUT
  13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15  * version 2 for more details (a copy is included in the LICENSE file that
  16  * accompanied this code).
  17  *  
  18  * You should have received a copy of the GNU General Public License version
  19  * 2 along with this work; if not, write to the Free Software Foundation,
  20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21  *   
  22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  23  * CA 95054 USA or visit www.sun.com if you need additional information or
  24  * have any questions.
  25  *  
  26  */
  27 
  28 class CardTableRS;   // fwd decl
  29 class ConcurrentMarkSweepGeneration;
  30 
  31 // A PermGen implemented with a CMS space, collected by a CMS collector.
  32 class CMSPermGen:  public PermGen {
  33   friend class VMStructs;
  34 
  35  protected:
  36   // The "generation" view.
  37   ConcurrentMarkSweepGeneration* _gen;
  38 
  39  public:
  40   CMSPermGen(ReservedSpace rs, size_t initial_byte_size,
  41              CardTableRS* ct, FreeBlockDictionary::DictionaryChoice);
  42 
  43   HeapWord* mem_allocate(size_t size);
  44 
  45   void compute_new_size();
  46 
  47   Generation* as_gen() const { return _gen; }
  48 };
  49 
  50 // This is the "generation" view of a CMSPermGen.
  51 class CMSPermGenGen: public ConcurrentMarkSweepGeneration {
  52   // Abstractly, this is a subtype that gets access to protected fields.
  53   friend class CMSPermGen;
  54 public:
  55   CMSPermGenGen(ReservedSpace rs, size_t initial_byte_size,
  56                        int level, CardTableRS* ct):
  57     // See comments in the constructor for CompactibleFreeListSpace
  58     // regarding not using adaptive free lists for a perm gen.
  59     ConcurrentMarkSweepGeneration(rs, initial_byte_size, // MinPermHeapExapnsion
  60       level, ct, false /* use adaptive freelists */,
  61       (FreeBlockDictionary::DictionaryChoice)CMSDictionaryChoice)
  62   {}
  63 
  64   void initialize_performance_counters();
  65 
  66   const char* name() const {
  67     return "concurrent-mark-sweep perm gen";
  68   }
  69 
  70   const char* short_name() const {
  71     return "CMS Perm";
  72   }
  73 
  74   bool must_be_youngest() const { return false; }
  75   bool must_be_oldest() const { return false; }
  76 };