48 Generation::Generation(ReservedSpace rs, size_t initial_size, int level) :
49 _level(level),
50 _ref_processor(NULL) {
51 if (!_virtual_space.initialize(rs, initial_size)) {
52 vm_exit_during_initialization("Could not reserve enough space for "
53 "object heap");
54 }
55 // Mangle all of the the initial generation.
56 if (ZapUnusedHeapArea) {
57 MemRegion mangle_region((HeapWord*)_virtual_space.low(),
58 (HeapWord*)_virtual_space.high());
59 SpaceMangler::mangle_region(mangle_region);
60 }
61 _reserved = MemRegion((HeapWord*)_virtual_space.low_boundary(),
62 (HeapWord*)_virtual_space.high_boundary());
63 }
64
65 GenerationSpec* Generation::spec() {
66 GenCollectedHeap* gch = GenCollectedHeap::heap();
67 assert(0 <= level() && level() < gch->_n_gens, "Bad gen level");
68 return gch->_gen_specs[level()];
69 }
70
71 size_t Generation::max_capacity() const {
72 return reserved().byte_size();
73 }
74
75 void Generation::print_heap_change(size_t prev_used) const {
76 if (PrintGCDetails && Verbose) {
77 gclog_or_tty->print(" " SIZE_FORMAT
78 "->" SIZE_FORMAT
79 "(" SIZE_FORMAT ")",
80 prev_used, used(), capacity());
81 } else {
82 gclog_or_tty->print(" " SIZE_FORMAT "K"
83 "->" SIZE_FORMAT "K"
84 "(" SIZE_FORMAT "K)",
85 prev_used / K, used() / K, capacity() / K);
86 }
87 }
88
|
48 Generation::Generation(ReservedSpace rs, size_t initial_size, int level) :
49 _level(level),
50 _ref_processor(NULL) {
51 if (!_virtual_space.initialize(rs, initial_size)) {
52 vm_exit_during_initialization("Could not reserve enough space for "
53 "object heap");
54 }
55 // Mangle all of the the initial generation.
56 if (ZapUnusedHeapArea) {
57 MemRegion mangle_region((HeapWord*)_virtual_space.low(),
58 (HeapWord*)_virtual_space.high());
59 SpaceMangler::mangle_region(mangle_region);
60 }
61 _reserved = MemRegion((HeapWord*)_virtual_space.low_boundary(),
62 (HeapWord*)_virtual_space.high_boundary());
63 }
64
65 GenerationSpec* Generation::spec() {
66 GenCollectedHeap* gch = GenCollectedHeap::heap();
67 assert(0 <= level() && level() < gch->_n_gens, "Bad gen level");
68 return level() == 0 ? gch->gen_policy()->young_gen_spec() : gch->gen_policy()->old_gen_spec();
69 }
70
71 size_t Generation::max_capacity() const {
72 return reserved().byte_size();
73 }
74
75 void Generation::print_heap_change(size_t prev_used) const {
76 if (PrintGCDetails && Verbose) {
77 gclog_or_tty->print(" " SIZE_FORMAT
78 "->" SIZE_FORMAT
79 "(" SIZE_FORMAT ")",
80 prev_used, used(), capacity());
81 } else {
82 gclog_or_tty->print(" " SIZE_FORMAT "K"
83 "->" SIZE_FORMAT "K"
84 "(" SIZE_FORMAT "K)",
85 prev_used / K, used() / K, capacity() / K);
86 }
87 }
88
|