21 * |
21 * |
22 */ |
22 */ |
23 |
23 |
24 #include "precompiled.hpp" |
24 #include "precompiled.hpp" |
25 #include "memory/allocation.hpp" |
25 #include "memory/allocation.hpp" |
26 #include "gc/shenandoah/shenandoahForwarding.hpp" |
|
27 #include "gc/shenandoah/shenandoahHeapRegionSet.inline.hpp" |
26 #include "gc/shenandoah/shenandoahHeapRegionSet.inline.hpp" |
28 #include "gc/shenandoah/shenandoahHeap.inline.hpp" |
27 #include "gc/shenandoah/shenandoahHeap.inline.hpp" |
29 #include "gc/shenandoah/shenandoahHeapRegion.hpp" |
28 #include "gc/shenandoah/shenandoahHeapRegion.hpp" |
30 #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp" |
29 #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp" |
31 #include "gc/shenandoah/shenandoahTraversalGC.hpp" |
30 #include "gc/shenandoah/shenandoahTraversalGC.hpp" |
451 } |
450 } |
452 } |
451 } |
453 |
452 |
454 void ShenandoahHeapRegion::oop_iterate_objects(OopIterateClosure* blk) { |
453 void ShenandoahHeapRegion::oop_iterate_objects(OopIterateClosure* blk) { |
455 assert(! is_humongous(), "no humongous region here"); |
454 assert(! is_humongous(), "no humongous region here"); |
456 HeapWord* obj_addr = bottom() + ShenandoahForwarding::word_size(); |
455 HeapWord* obj_addr = bottom(); |
457 HeapWord* t = top(); |
456 HeapWord* t = top(); |
458 // Could call objects iterate, but this is easier. |
457 // Could call objects iterate, but this is easier. |
459 while (obj_addr < t) { |
458 while (obj_addr < t) { |
460 oop obj = oop(obj_addr); |
459 oop obj = oop(obj_addr); |
461 obj_addr += obj->oop_iterate_size(blk) + ShenandoahForwarding::word_size(); |
460 obj_addr += obj->oop_iterate_size(blk); |
462 } |
461 } |
463 } |
462 } |
464 |
463 |
465 void ShenandoahHeapRegion::oop_iterate_humongous(OopIterateClosure* blk) { |
464 void ShenandoahHeapRegion::oop_iterate_humongous(OopIterateClosure* blk) { |
466 assert(is_humongous(), "only humongous region here"); |
465 assert(is_humongous(), "only humongous region here"); |
467 // Find head. |
466 // Find head. |
468 ShenandoahHeapRegion* r = humongous_start_region(); |
467 ShenandoahHeapRegion* r = humongous_start_region(); |
469 assert(r->is_humongous_start(), "need humongous head here"); |
468 assert(r->is_humongous_start(), "need humongous head here"); |
470 oop obj = oop(r->bottom() + ShenandoahForwarding::word_size()); |
469 oop obj = oop(r->bottom()); |
471 obj->oop_iterate(blk, MemRegion(bottom(), top())); |
470 obj->oop_iterate(blk, MemRegion(bottom(), top())); |
472 } |
471 } |
473 |
472 |
474 ShenandoahHeapRegion* ShenandoahHeapRegion::humongous_start_region() const { |
473 ShenandoahHeapRegion* ShenandoahHeapRegion::humongous_start_region() const { |
475 assert(is_humongous(), "Must be a part of the humongous region"); |
474 assert(is_humongous(), "Must be a part of the humongous region"); |
504 "p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")", |
503 "p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")", |
505 p2i(p), p2i(bottom()), p2i(end())); |
504 p2i(p), p2i(bottom()), p2i(end())); |
506 if (p >= top()) { |
505 if (p >= top()) { |
507 return top(); |
506 return top(); |
508 } else { |
507 } else { |
509 HeapWord* last = bottom() + ShenandoahForwarding::word_size(); |
508 HeapWord* last = bottom(); |
510 HeapWord* cur = last; |
509 HeapWord* cur = last; |
511 while (cur <= p) { |
510 while (cur <= p) { |
512 last = cur; |
511 last = cur; |
513 cur += oop(cur)->size() + ShenandoahForwarding::word_size(); |
512 cur += oop(cur)->size(); |
514 } |
513 } |
515 shenandoah_assert_correct(NULL, oop(last)); |
514 shenandoah_assert_correct(NULL, oop(last)); |
516 return last; |
515 return last; |
517 } |
516 } |
518 } |
517 } |