equal
deleted
inserted
replaced
40 #include "memory/iterator.hpp" |
40 #include "memory/iterator.hpp" |
41 #include "memory/resourceArea.hpp" |
41 #include "memory/resourceArea.hpp" |
42 #include "oops/oop.inline.hpp" |
42 #include "oops/oop.inline.hpp" |
43 #include "runtime/atomic.hpp" |
43 #include "runtime/atomic.hpp" |
44 #include "runtime/orderAccess.inline.hpp" |
44 #include "runtime/orderAccess.inline.hpp" |
|
45 #include "utilities/growableArray.hpp" |
45 |
46 |
46 int HeapRegion::LogOfHRGrainBytes = 0; |
47 int HeapRegion::LogOfHRGrainBytes = 0; |
47 int HeapRegion::LogOfHRGrainWords = 0; |
48 int HeapRegion::LogOfHRGrainWords = 0; |
48 size_t HeapRegion::GrainBytes = 0; |
49 size_t HeapRegion::GrainBytes = 0; |
49 size_t HeapRegion::GrainWords = 0; |
50 size_t HeapRegion::GrainWords = 0; |
102 CardsPerRegion = GrainBytes >> CardTableModRefBS::card_shift; |
103 CardsPerRegion = GrainBytes >> CardTableModRefBS::card_shift; |
103 |
104 |
104 if (G1HeapRegionSize != GrainBytes) { |
105 if (G1HeapRegionSize != GrainBytes) { |
105 FLAG_SET_ERGO(size_t, G1HeapRegionSize, GrainBytes); |
106 FLAG_SET_ERGO(size_t, G1HeapRegionSize, GrainBytes); |
106 } |
107 } |
107 } |
|
108 |
|
109 void HeapRegion::reset_after_compaction() { |
|
110 G1ContiguousSpace::reset_after_compaction(); |
|
111 // After a compaction the mark bitmap is invalid, so we must |
|
112 // treat all objects as being inside the unmarked area. |
|
113 zero_marked_bytes(); |
|
114 init_top_at_mark_start(); |
|
115 } |
108 } |
116 |
109 |
117 void HeapRegion::hr_clear(bool keep_remset, bool clear_space, bool locked) { |
110 void HeapRegion::hr_clear(bool keep_remset, bool clear_space, bool locked) { |
118 assert(_humongous_start_region == NULL, |
111 assert(_humongous_start_region == NULL, |
119 "we should have already filtered out humongous regions"); |
112 "we should have already filtered out humongous regions"); |
274 get_trace_type(), |
267 get_trace_type(), |
275 to, |
268 to, |
276 (uintptr_t)bottom(), |
269 (uintptr_t)bottom(), |
277 used(), |
270 used(), |
278 (uint)allocation_context()); |
271 (uint)allocation_context()); |
279 } |
|
280 |
|
281 CompactibleSpace* HeapRegion::next_compaction_space() const { |
|
282 return G1CollectedHeap::heap()->next_compaction_region(this); |
|
283 } |
272 } |
284 |
273 |
285 void HeapRegion::note_self_forwarding_removal_start(bool during_initial_mark, |
274 void HeapRegion::note_self_forwarding_removal_start(bool during_initial_mark, |
286 bool during_conc_mark) { |
275 bool during_conc_mark) { |
287 // We always recreate the prev marking info and we'll explicitly |
276 // We always recreate the prev marking info and we'll explicitly |
409 void HeapRegion::verify_strong_code_roots(VerifyOption vo, bool* failures) const { |
398 void HeapRegion::verify_strong_code_roots(VerifyOption vo, bool* failures) const { |
410 if (!G1VerifyHeapRegionCodeRoots) { |
399 if (!G1VerifyHeapRegionCodeRoots) { |
411 // We're not verifying code roots. |
400 // We're not verifying code roots. |
412 return; |
401 return; |
413 } |
402 } |
414 if (vo == VerifyOption_G1UseMarkWord) { |
403 if (vo == VerifyOption_G1UseFullMarking) { |
415 // Marking verification during a full GC is performed after class |
404 // Marking verification during a full GC is performed after class |
416 // unloading, code cache unloading, etc so the strong code roots |
405 // unloading, code cache unloading, etc so the strong code roots |
417 // attached to each heap region are in an inconsistent state. They won't |
406 // attached to each heap region are in an inconsistent state. They won't |
418 // be consistent until the strong code roots are rebuilt after the |
407 // be consistent until the strong code roots are rebuilt after the |
419 // actual GC. Skip verifying the strong code roots in this particular |
408 // actual GC. Skip verifying the strong code roots in this particular |
480 int _n_failures; |
469 int _n_failures; |
481 VerifyOption _vo; |
470 VerifyOption _vo; |
482 public: |
471 public: |
483 // _vo == UsePrevMarking -> use "prev" marking information, |
472 // _vo == UsePrevMarking -> use "prev" marking information, |
484 // _vo == UseNextMarking -> use "next" marking information, |
473 // _vo == UseNextMarking -> use "next" marking information, |
485 // _vo == UseMarkWord -> use mark word from object header. |
474 // _vo == UseFullMarking -> use "next" marking bitmap but no TAMS. |
486 G1VerificationClosure(G1CollectedHeap* g1h, VerifyOption vo) : |
475 G1VerificationClosure(G1CollectedHeap* g1h, VerifyOption vo) : |
487 _g1h(g1h), _bs(barrier_set_cast<CardTableModRefBS>(g1h->barrier_set())), |
476 _g1h(g1h), _bs(barrier_set_cast<CardTableModRefBS>(g1h->barrier_set())), |
488 _containing_obj(NULL), _failures(false), _n_failures(0), _vo(vo) { |
477 _containing_obj(NULL), _failures(false), _n_failures(0), _vo(vo) { |
489 } |
478 } |
490 |
479 |
831 verify_rem_set(VerifyOption_G1UsePrevMarking, &failures); |
820 verify_rem_set(VerifyOption_G1UsePrevMarking, &failures); |
832 guarantee(!failures, "HeapRegion RemSet verification failed"); |
821 guarantee(!failures, "HeapRegion RemSet verification failed"); |
833 } |
822 } |
834 |
823 |
835 void HeapRegion::prepare_for_compaction(CompactPoint* cp) { |
824 void HeapRegion::prepare_for_compaction(CompactPoint* cp) { |
836 scan_and_forward(this, cp); |
825 // Not used for G1 anymore, but pure virtual in Space. |
|
826 ShouldNotReachHere(); |
837 } |
827 } |
838 |
828 |
839 // G1OffsetTableContigSpace code; copied from space.cpp. Hope this can go |
829 // G1OffsetTableContigSpace code; copied from space.cpp. Hope this can go |
840 // away eventually. |
830 // away eventually. |
841 |
831 |