104 FastScanClosure* cur, |
104 FastScanClosure* cur, |
105 FastScanClosure* older) : |
105 FastScanClosure* older) : |
106 _gch(gch), _scan_cur_or_nonheap(cur), _scan_older(older) |
106 _gch(gch), _scan_cur_or_nonheap(cur), _scan_older(older) |
107 { |
107 { |
108 assert(_gch->young_gen()->kind() == Generation::DefNew, "Generation should be DefNew"); |
108 assert(_gch->young_gen()->kind() == Generation::DefNew, "Generation should be DefNew"); |
109 _gen = (DefNewGeneration*)_gch->young_gen(); |
109 _young_gen = (DefNewGeneration*)_gch->young_gen(); |
110 } |
110 } |
111 |
111 |
112 void DefNewGeneration::FastEvacuateFollowersClosure::do_void() { |
112 void DefNewGeneration::FastEvacuateFollowersClosure::do_void() { |
113 do { |
113 do { |
114 _gch->oop_since_save_marks_iterate(GenCollectedHeap::YoungGen, _scan_cur_or_nonheap, _scan_older); |
114 _gch->oop_since_save_marks_iterate(GenCollectedHeap::YoungGen, _scan_cur_or_nonheap, _scan_older); |
115 } while (!_gch->no_allocs_since_save_marks()); |
115 } while (!_gch->no_allocs_since_save_marks()); |
116 guarantee(_gen->promo_failure_scan_is_complete(), "Failed to finish scan"); |
116 guarantee(_young_gen->promo_failure_scan_is_complete(), "Failed to finish scan"); |
117 } |
117 } |
118 |
118 |
119 ScanClosure::ScanClosure(DefNewGeneration* g, bool gc_barrier) : |
119 ScanClosure::ScanClosure(DefNewGeneration* g, bool gc_barrier) : |
120 OopsInKlassOrGenClosure(g), _g(g), _gc_barrier(gc_barrier) |
120 OopsInKlassOrGenClosure(g), _g(g), _gc_barrier(gc_barrier) |
121 { |
121 { |
198 |
198 |
199 _eden_space = new ContiguousSpace(); |
199 _eden_space = new ContiguousSpace(); |
200 _from_space = new ContiguousSpace(); |
200 _from_space = new ContiguousSpace(); |
201 _to_space = new ContiguousSpace(); |
201 _to_space = new ContiguousSpace(); |
202 |
202 |
203 if (_eden_space == NULL || _from_space == NULL || _to_space == NULL) |
203 if (_eden_space == NULL || _from_space == NULL || _to_space == NULL) { |
204 vm_exit_during_initialization("Could not allocate a new gen space"); |
204 vm_exit_during_initialization("Could not allocate a new gen space"); |
|
205 } |
205 |
206 |
206 // Compute the maximum eden and survivor space sizes. These sizes |
207 // Compute the maximum eden and survivor space sizes. These sizes |
207 // are computed assuming the entire reserved space is committed. |
208 // are computed assuming the entire reserved space is committed. |
208 // These values are exported as performance counters. |
209 // These values are exported as performance counters. |
209 uintx alignment = gch->collector_policy()->space_alignment(); |
210 uintx alignment = gch->collector_policy()->space_alignment(); |
653 eden()->clear(SpaceDecorator::Mangle); |
654 eden()->clear(SpaceDecorator::Mangle); |
654 from()->clear(SpaceDecorator::Mangle); |
655 from()->clear(SpaceDecorator::Mangle); |
655 if (ZapUnusedHeapArea) { |
656 if (ZapUnusedHeapArea) { |
656 // This is now done here because of the piece-meal mangling which |
657 // This is now done here because of the piece-meal mangling which |
657 // can check for valid mangling at intermediate points in the |
658 // can check for valid mangling at intermediate points in the |
658 // collection(s). When a minor collection fails to collect |
659 // collection(s). When a young collection fails to collect |
659 // sufficient space resizing of the young generation can occur |
660 // sufficient space resizing of the young generation can occur |
660 // an redistribute the spaces in the young generation. Mangle |
661 // an redistribute the spaces in the young generation. Mangle |
661 // here so that unzapped regions don't get distributed to |
662 // here so that unzapped regions don't get distributed to |
662 // other spaces. |
663 // other spaces. |
663 to()->mangle_unused_area(); |
664 to()->mangle_unused_area(); |