447
448 // Methods to enter the two overflow sync barriers
449 void enter_first_sync_barrier(uint worker_id);
450 void enter_second_sync_barrier(uint worker_id);
451
452 // Clear the given bitmap in parallel using the given WorkGang. If may_yield is
453 // true, periodically insert checks to see if this method should exit prematurely.
454 void clear_bitmap(G1CMBitMap* bitmap, WorkGang* workers, bool may_yield);
455
456 // Region statistics gathered during marking.
457 G1RegionMarkStats* _region_mark_stats;
458 // Top pointer for each region at the start of the rebuild remembered set process
459 // for regions which remembered sets need to be rebuilt. A NULL for a given region
460 // means that this region does not be scanned during the rebuilding remembered
461 // set phase at all.
462 HeapWord* volatile* _top_at_rebuild_starts;
463 public:
464 void add_to_liveness(uint worker_id, oop const obj, size_t size);
465 // Liveness of the given region as determined by concurrent marking, i.e. the amount of
466 // live words between bottom and nTAMS.
467 size_t liveness(uint region) { return _region_mark_stats[region]._live_words; }
468
469 // Sets the internal top_at_region_start for the given region to current top of the region.
470 inline void update_top_at_rebuild_start(HeapRegion* r);
471 // TARS for the given region during remembered set rebuilding.
472 inline HeapWord* top_at_rebuild_start(uint region) const;
473
474 // Clear statistics gathered during the concurrent cycle for the given region after
475 // it has been reclaimed.
476 void clear_statistics_in_region(uint region_idx);
477 // Notification for eagerly reclaimed regions to clean up.
478 void humongous_object_eagerly_reclaimed(HeapRegion* r);
479 // Manipulation of the global mark stack.
480 // The push and pop operations are used by tasks for transfers
481 // between task-local queues and the global mark stack.
482 bool mark_stack_push(G1TaskQueueEntry* arr) {
483 if (!_global_mark_stack.par_push_chunk(arr)) {
484 set_has_overflown();
485 return false;
486 }
487 return true;
822 G1ConcurrentMark *cm,
823 G1CMTaskQueue* task_queue,
824 G1RegionMarkStats* mark_stats,
825 uint max_regions);
826
827 inline void update_liveness(oop const obj, size_t const obj_size);
828
829 // Clear (without flushing) the mark cache entry for the given region.
830 void clear_mark_stats_cache(uint region_idx);
831 // Evict the whole statistics cache into the global statistics. Returns the
832 // number of cache hits and misses so far.
833 Pair<size_t, size_t> flush_mark_stats_cache();
834 // Prints statistics associated with this task
835 void print_stats();
836 };
837
838 // Class that's used to to print out per-region liveness
839 // information. It's currently used at the end of marking and also
840 // after we sort the old regions at the end of the cleanup operation.
841 class G1PrintRegionLivenessInfoClosure : public HeapRegionClosure {
842 private:
843 // Accumulators for these values.
844 size_t _total_used_bytes;
845 size_t _total_capacity_bytes;
846 size_t _total_prev_live_bytes;
847 size_t _total_next_live_bytes;
848
849 // Accumulator for the remembered set size
850 size_t _total_remset_bytes;
851
852 // Accumulator for strong code roots memory size
853 size_t _total_strong_code_roots_bytes;
854
855 static double bytes_to_mb(size_t val) {
856 return (double) val / (double) M;
857 }
858
859 public:
860 // The header and footer are printed in the constructor and
861 // destructor respectively.
862 G1PrintRegionLivenessInfoClosure(const char* phase_name);
|
447
448 // Methods to enter the two overflow sync barriers
449 void enter_first_sync_barrier(uint worker_id);
450 void enter_second_sync_barrier(uint worker_id);
451
452 // Clear the given bitmap in parallel using the given WorkGang. If may_yield is
453 // true, periodically insert checks to see if this method should exit prematurely.
454 void clear_bitmap(G1CMBitMap* bitmap, WorkGang* workers, bool may_yield);
455
456 // Region statistics gathered during marking.
457 G1RegionMarkStats* _region_mark_stats;
458 // Top pointer for each region at the start of the rebuild remembered set process
459 // for regions which remembered sets need to be rebuilt. A NULL for a given region
460 // means that this region does not be scanned during the rebuilding remembered
461 // set phase at all.
462 HeapWord* volatile* _top_at_rebuild_starts;
463 public:
464 void add_to_liveness(uint worker_id, oop const obj, size_t size);
465 // Liveness of the given region as determined by concurrent marking, i.e. the amount of
466 // live words between bottom and nTAMS.
467 size_t liveness(uint region) const { return _region_mark_stats[region]._live_words; }
468
469 // Sets the internal top_at_region_start for the given region to current top of the region.
470 inline void update_top_at_rebuild_start(HeapRegion* r);
471 // TARS for the given region during remembered set rebuilding.
472 inline HeapWord* top_at_rebuild_start(uint region) const;
473
474 // Clear statistics gathered during the concurrent cycle for the given region after
475 // it has been reclaimed.
476 void clear_statistics_in_region(uint region_idx);
477 // Notification for eagerly reclaimed regions to clean up.
478 void humongous_object_eagerly_reclaimed(HeapRegion* r);
479 // Manipulation of the global mark stack.
480 // The push and pop operations are used by tasks for transfers
481 // between task-local queues and the global mark stack.
482 bool mark_stack_push(G1TaskQueueEntry* arr) {
483 if (!_global_mark_stack.par_push_chunk(arr)) {
484 set_has_overflown();
485 return false;
486 }
487 return true;
822 G1ConcurrentMark *cm,
823 G1CMTaskQueue* task_queue,
824 G1RegionMarkStats* mark_stats,
825 uint max_regions);
826
827 inline void update_liveness(oop const obj, size_t const obj_size);
828
829 // Clear (without flushing) the mark cache entry for the given region.
830 void clear_mark_stats_cache(uint region_idx);
831 // Evict the whole statistics cache into the global statistics. Returns the
832 // number of cache hits and misses so far.
833 Pair<size_t, size_t> flush_mark_stats_cache();
834 // Prints statistics associated with this task
835 void print_stats();
836 };
837
838 // Class that's used to to print out per-region liveness
839 // information. It's currently used at the end of marking and also
840 // after we sort the old regions at the end of the cleanup operation.
841 class G1PrintRegionLivenessInfoClosure : public HeapRegionClosure {
842 // Accumulators for these values.
843 size_t _total_used_bytes;
844 size_t _total_capacity_bytes;
845 size_t _total_prev_live_bytes;
846 size_t _total_next_live_bytes;
847
848 // Accumulator for the remembered set size
849 size_t _total_remset_bytes;
850
851 // Accumulator for strong code roots memory size
852 size_t _total_strong_code_roots_bytes;
853
854 static double bytes_to_mb(size_t val) {
855 return (double) val / (double) M;
856 }
857
858 public:
859 // The header and footer are printed in the constructor and
860 // destructor respectively.
861 G1PrintRegionLivenessInfoClosure(const char* phase_name);
|