< prev index next >

src/hotspot/share/gc/serial/serialHeap.cpp

Print this page
rev 48000 : [mq]: open.patch


   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 #include "precompiled.hpp"

  26 #include "gc/serial/serialHeap.hpp"


  27 
  28 SerialHeap::SerialHeap(GenCollectorPolicy* policy) : GenCollectedHeap(policy) {}



































  29 
  30 void SerialHeap::check_gen_kinds() {
  31   assert(young_gen()->kind() == Generation::DefNew,
  32          "Wrong youngest generation type");
  33   assert(old_gen()->kind() == Generation::MarkSweepCompact,
  34          "Wrong generation kind");















  35 }


   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 #include "precompiled.hpp"
  26 #include "gc/serial/defNewGeneration.hpp"
  27 #include "gc/serial/serialHeap.hpp"
  28 #include "gc/shared/genMemoryPools.hpp"
  29 #include "services/memoryManager.hpp"
  30 
  31 SerialHeap::SerialHeap(GenCollectorPolicy* policy) :
  32   GenCollectedHeap(policy), _eden_pool(NULL), _survivor_pool(NULL), _old_pool(NULL) {
  33   _young_manager = new GCMemoryManager("Copy", "end of minor GC");
  34   _old_manager = new GCMemoryManager("MarkSweepCompact", "end of major GC");
  35 }
  36 
  37 jint SerialHeap::initialize() {
  38   jint status = GenCollectedHeap::initialize();
  39   if (status != JNI_OK) return status;
  40 
  41   DefNewGeneration* young = (DefNewGeneration*) young_gen();
  42 
  43   // Add a memory pool for each space and young gen doesn't
  44   // support low memory detection as it is expected to get filled up.
  45   _eden_pool = new ContiguousSpacePool(young->eden(),
  46                                              "Eden Space",
  47                                              young->max_eden_size(),
  48                                              false /* support_usage_threshold */);
  49   _survivor_pool = new SurvivorContiguousSpacePool(young,
  50                                                    "Survivor Space",
  51                                                    young->max_survivor_size(),
  52                                                    false /* support_usage_threshold */);
  53   Generation* old = old_gen();
  54   _old_pool = new GenerationPool(old, "Tenured Gen", true);
  55 
  56   _young_manager->add_pool(_eden_pool);
  57   _young_manager->add_pool(_survivor_pool);
  58   young->set_gc_manager(_young_manager);
  59 
  60   _old_manager->add_pool(_eden_pool);
  61   _old_manager->add_pool(_survivor_pool);
  62   _old_manager->add_pool(_old_pool);
  63   old->set_gc_manager(_old_manager);
  64 
  65   return JNI_OK;
  66 }
  67 
  68 void SerialHeap::check_gen_kinds() {
  69   assert(young_gen()->kind() == Generation::DefNew,
  70          "Wrong youngest generation type");
  71   assert(old_gen()->kind() == Generation::MarkSweepCompact,
  72          "Wrong generation kind");
  73 }
  74 
  75 GrowableArray<GCMemoryManager*> SerialHeap::memory_managers() {
  76   GrowableArray<GCMemoryManager*> memory_managers(2);
  77   memory_managers.append(_young_manager);
  78   memory_managers.append(_old_manager);
  79   return memory_managers;
  80 }
  81 
  82 GrowableArray<MemoryPool*> SerialHeap::memory_pools() {
  83   GrowableArray<MemoryPool*> memory_pools(3);
  84   memory_pools.append(_eden_pool);
  85   memory_pools.append(_survivor_pool);
  86   memory_pools.append(_old_pool);
  87   return memory_pools;
  88 }
< prev index next >