46 Generation::Generation(ReservedSpace rs, size_t initial_size) : 47 _ref_processor(NULL), 48 _gc_manager(NULL) { 49 if (!_virtual_space.initialize(rs, initial_size)) { 50 vm_exit_during_initialization("Could not reserve enough space for " 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->gen_policy()->young_gen_spec()->init_size(); 67 } 68 return gch->gen_policy()->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 _ref_processor = new ReferenceProcessor(_reserved); // a vanilla reference processor 81 if (_ref_processor == NULL) { 82 vm_exit_during_initialization("Could not allocate ReferenceProcessor object"); 83 } 84 } 85 86 void Generation::print() const { print_on(tty); } 87 88 void Generation::print_on(outputStream* st) const { | 46 Generation::Generation(ReservedSpace rs, size_t initial_size) : 47 _ref_processor(NULL), 48 _gc_manager(NULL) { 49 if (!_virtual_space.initialize(rs, initial_size)) { 50 vm_exit_during_initialization("Could not reserve enough space for " 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 _ref_processor = new ReferenceProcessor(_reserved); // a vanilla reference processor 81 if (_ref_processor == NULL) { 82 vm_exit_during_initialization("Could not allocate ReferenceProcessor object"); 83 } 84 } 85 86 void Generation::print() const { print_on(tty); } 87 88 void Generation::print_on(outputStream* st) const { |