41 #include "runtime/java.hpp" 42 #include "utilities/copy.hpp" 43 #include "utilities/events.hpp" 44 45 Generation::Generation(ReservedSpace rs, size_t initial_size) : 46 _ref_processor(NULL) { 47 if (!_virtual_space.initialize(rs, initial_size)) { 48 vm_exit_during_initialization("Could not reserve enough space for " 49 "object heap"); 50 } 51 // Mangle all of the the initial generation. 52 if (ZapUnusedHeapArea) { 53 MemRegion mangle_region((HeapWord*)_virtual_space.low(), 54 (HeapWord*)_virtual_space.high()); 55 SpaceMangler::mangle_region(mangle_region); 56 } 57 _reserved = MemRegion((HeapWord*)_virtual_space.low_boundary(), 58 (HeapWord*)_virtual_space.high_boundary()); 59 } 60 61 GenerationSpec* Generation::spec() { 62 GenCollectedHeap* gch = GenCollectedHeap::heap(); 63 if (gch->is_young_gen(this)) { 64 return gch->gen_policy()->young_gen_spec(); 65 } 66 return gch->gen_policy()->old_gen_spec(); 67 } 68 69 size_t Generation::max_capacity() const { 70 return reserved().byte_size(); 71 } 72 73 void Generation::print_heap_change(size_t prev_used) const { 74 if (PrintGCDetails && Verbose) { 75 gclog_or_tty->print(" " SIZE_FORMAT 76 "->" SIZE_FORMAT 77 "(" SIZE_FORMAT ")", 78 prev_used, used(), capacity()); 79 } else { 80 gclog_or_tty->print(" " SIZE_FORMAT "K" 81 "->" SIZE_FORMAT "K" 82 "(" SIZE_FORMAT "K)", 83 prev_used / K, used() / K, capacity() / K); 84 } 85 } 86 | 41 #include "runtime/java.hpp" 42 #include "utilities/copy.hpp" 43 #include "utilities/events.hpp" 44 45 Generation::Generation(ReservedSpace rs, size_t initial_size) : 46 _ref_processor(NULL) { 47 if (!_virtual_space.initialize(rs, initial_size)) { 48 vm_exit_during_initialization("Could not reserve enough space for " 49 "object heap"); 50 } 51 // Mangle all of the the initial generation. 52 if (ZapUnusedHeapArea) { 53 MemRegion mangle_region((HeapWord*)_virtual_space.low(), 54 (HeapWord*)_virtual_space.high()); 55 SpaceMangler::mangle_region(mangle_region); 56 } 57 _reserved = MemRegion((HeapWord*)_virtual_space.low_boundary(), 58 (HeapWord*)_virtual_space.high_boundary()); 59 } 60 61 size_t Generation::initial_size() { 62 GenCollectedHeap* gch = GenCollectedHeap::heap(); 63 if (gch->is_young_gen(this)) { 64 return gch->gen_policy()->young_gen_spec()->init_size(); 65 } 66 return gch->gen_policy()->old_gen_spec()->init_size(); 67 } 68 69 size_t Generation::max_capacity() const { 70 return reserved().byte_size(); 71 } 72 73 void Generation::print_heap_change(size_t prev_used) const { 74 if (PrintGCDetails && Verbose) { 75 gclog_or_tty->print(" " SIZE_FORMAT 76 "->" SIZE_FORMAT 77 "(" SIZE_FORMAT ")", 78 prev_used, used(), capacity()); 79 } else { 80 gclog_or_tty->print(" " SIZE_FORMAT "K" 81 "->" SIZE_FORMAT "K" 82 "(" SIZE_FORMAT "K)", 83 prev_used / K, used() / K, capacity() / K); 84 } 85 } 86 |