src/hotspot/share/gc/shared/generation.cpp

Print this page




  51                     "object heap");
  52   }
  53   // Mangle all of the the initial generation.
  54   if (ZapUnusedHeapArea) {
  55     MemRegion mangle_region((HeapWord*)_virtual_space.low(),
  56       (HeapWord*)_virtual_space.high());
  57     SpaceMangler::mangle_region(mangle_region);
  58   }
  59   _reserved = MemRegion((HeapWord*)_virtual_space.low_boundary(),
  60           (HeapWord*)_virtual_space.high_boundary());
  61 }
  62 
  63 size_t Generation::initial_size() {
  64   GenCollectedHeap* gch = GenCollectedHeap::heap();
  65   if (gch->is_young_gen(this)) {
  66     return gch->young_gen_spec()->init_size();
  67   }
  68   return gch->old_gen_spec()->init_size();
  69 }
  70 






  71 size_t Generation::max_capacity() const {
  72   return reserved().byte_size();
  73 }
  74 
  75 // By default we get a single threaded default reference processor;
  76 // generations needing multi-threaded refs processing or discovery override this method.
  77 void Generation::ref_processor_init() {
  78   assert(_ref_processor == NULL, "a reference processor already exists");
  79   assert(!_reserved.is_empty(), "empty generation?");
  80   _span_based_discoverer.set_span(_reserved);
  81   _ref_processor = new ReferenceProcessor(&_span_based_discoverer);    // a vanilla reference processor
  82   if (_ref_processor == NULL) {
  83     vm_exit_during_initialization("Could not allocate ReferenceProcessor object");
  84   }
  85 }
  86 
  87 void Generation::print() const { print_on(tty); }
  88 
  89 void Generation::print_on(outputStream* st)  const {
  90   st->print(" %-20s", name());




  51                     "object heap");
  52   }
  53   // Mangle all of the the initial generation.
  54   if (ZapUnusedHeapArea) {
  55     MemRegion mangle_region((HeapWord*)_virtual_space.low(),
  56       (HeapWord*)_virtual_space.high());
  57     SpaceMangler::mangle_region(mangle_region);
  58   }
  59   _reserved = MemRegion((HeapWord*)_virtual_space.low_boundary(),
  60           (HeapWord*)_virtual_space.high_boundary());
  61 }
  62 
  63 size_t Generation::initial_size() {
  64   GenCollectedHeap* gch = GenCollectedHeap::heap();
  65   if (gch->is_young_gen(this)) {
  66     return gch->young_gen_spec()->init_size();
  67   }
  68   return gch->old_gen_spec()->init_size();
  69 }
  70 
  71 // This is for CMS. It returns stable monotonic used space size.
  72 // Remove this when CMS is removed.
  73 size_t Generation::used_stable() const {
  74   return used();
  75 }
  76 
  77 size_t Generation::max_capacity() const {
  78   return reserved().byte_size();
  79 }
  80 
  81 // By default we get a single threaded default reference processor;
  82 // generations needing multi-threaded refs processing or discovery override this method.
  83 void Generation::ref_processor_init() {
  84   assert(_ref_processor == NULL, "a reference processor already exists");
  85   assert(!_reserved.is_empty(), "empty generation?");
  86   _span_based_discoverer.set_span(_reserved);
  87   _ref_processor = new ReferenceProcessor(&_span_based_discoverer);    // a vanilla reference processor
  88   if (_ref_processor == NULL) {
  89     vm_exit_during_initialization("Could not allocate ReferenceProcessor object");
  90   }
  91 }
  92 
  93 void Generation::print() const { print_on(tty); }
  94 
  95 void Generation::print_on(outputStream* st)  const {
  96   st->print(" %-20s", name());