944 _dwl_mean = double(MIN2(ParallelOldDeadWoodLimiterMean, max)) / 100.0;
945 _dwl_std_dev = double(MIN2(ParallelOldDeadWoodLimiterStdDev, max)) / 100.0;
946 _dwl_first_term = 1.0 / (sqrt(2.0 * M_PI) * _dwl_std_dev);
947 DEBUG_ONLY(_dwl_initialized = true;)
948 _dwl_adjustment = normal_distribution(1.0);
949 }
950
951 void
952 PSParallelCompact::clear_data_covering_space(SpaceId id)
953 {
954 // At this point, top is the value before GC, new_top() is the value that will
955 // be set at the end of GC. The marking bitmap is cleared to top; nothing
956 // should be marked above top. The summary data is cleared to the larger of
957 // top & new_top.
958 MutableSpace* const space = _space_info[id].space();
959 HeapWord* const bot = space->bottom();
960 HeapWord* const top = space->top();
961 HeapWord* const max_top = MAX2(top, _space_info[id].new_top());
962
963 const idx_t beg_bit = _mark_bitmap.addr_to_bit(bot);
964 const idx_t end_bit = BitMap::word_align_up(_mark_bitmap.addr_to_bit(top));
965 _mark_bitmap.clear_range(beg_bit, end_bit);
966
967 const size_t beg_region = _summary_data.addr_to_region_idx(bot);
968 const size_t end_region =
969 _summary_data.addr_to_region_idx(_summary_data.region_align_up(max_top));
970 _summary_data.clear_range(beg_region, end_region);
971
972 // Clear the data used to 'split' regions.
973 SplitInfo& split_info = _space_info[id].split_info();
974 if (split_info.is_valid()) {
975 split_info.clear();
976 }
977 DEBUG_ONLY(split_info.verify_clear();)
978 }
979
980 void PSParallelCompact::pre_compact()
981 {
982 // Update the from & to space pointers in space_info, since they are swapped
983 // at each young gen gc. Do the update unconditionally (even though a
984 // promotion failure does not swap spaces) because an unknown number of young
2832 }
2833 cm->update_contents(oop(addr));
2834 assert(oopDesc::is_oop_or_null(oop(addr)), "Expected an oop or NULL at " PTR_FORMAT, p2i(oop(addr)));
2835 }
2836 }
2837 }
2838
2839 // Skip over count live words starting from beg, and return the address of the
2840 // next live word. Unless marked, the word corresponding to beg is assumed to
2841 // be dead. Callers must either ensure beg does not correspond to the middle of
2842 // an object, or account for those live words in some other way. Callers must
2843 // also ensure that there are enough live words in the range [beg, end) to skip.
2844 HeapWord*
2845 PSParallelCompact::skip_live_words(HeapWord* beg, HeapWord* end, size_t count)
2846 {
2847 assert(count > 0, "sanity");
2848
2849 ParMarkBitMap* m = mark_bitmap();
2850 idx_t bits_to_skip = m->words_to_bits(count);
2851 idx_t cur_beg = m->addr_to_bit(beg);
2852 const idx_t search_end = BitMap::word_align_up(m->addr_to_bit(end));
2853
2854 do {
2855 cur_beg = m->find_obj_beg(cur_beg, search_end);
2856 idx_t cur_end = m->find_obj_end(cur_beg, search_end);
2857 const size_t obj_bits = cur_end - cur_beg + 1;
2858 if (obj_bits > bits_to_skip) {
2859 return m->bit_to_addr(cur_beg + bits_to_skip);
2860 }
2861 bits_to_skip -= obj_bits;
2862 cur_beg = cur_end + 1;
2863 } while (bits_to_skip > 0);
2864
2865 // Skipping the desired number of words landed just past the end of an object.
2866 // Find the start of the next object.
2867 cur_beg = m->find_obj_beg(cur_beg, search_end);
2868 assert(cur_beg < m->addr_to_bit(end), "not enough live words to skip");
2869 return m->bit_to_addr(cur_beg);
2870 }
2871
2872 HeapWord* PSParallelCompact::first_src_addr(HeapWord* const dest_addr,
|
944 _dwl_mean = double(MIN2(ParallelOldDeadWoodLimiterMean, max)) / 100.0;
945 _dwl_std_dev = double(MIN2(ParallelOldDeadWoodLimiterStdDev, max)) / 100.0;
946 _dwl_first_term = 1.0 / (sqrt(2.0 * M_PI) * _dwl_std_dev);
947 DEBUG_ONLY(_dwl_initialized = true;)
948 _dwl_adjustment = normal_distribution(1.0);
949 }
950
951 void
952 PSParallelCompact::clear_data_covering_space(SpaceId id)
953 {
954 // At this point, top is the value before GC, new_top() is the value that will
955 // be set at the end of GC. The marking bitmap is cleared to top; nothing
956 // should be marked above top. The summary data is cleared to the larger of
957 // top & new_top.
958 MutableSpace* const space = _space_info[id].space();
959 HeapWord* const bot = space->bottom();
960 HeapWord* const top = space->top();
961 HeapWord* const max_top = MAX2(top, _space_info[id].new_top());
962
963 const idx_t beg_bit = _mark_bitmap.addr_to_bit(bot);
964 const idx_t end_bit = _mark_bitmap.align_range_end(_mark_bitmap.addr_to_bit(top));
965 _mark_bitmap.clear_range(beg_bit, end_bit);
966
967 const size_t beg_region = _summary_data.addr_to_region_idx(bot);
968 const size_t end_region =
969 _summary_data.addr_to_region_idx(_summary_data.region_align_up(max_top));
970 _summary_data.clear_range(beg_region, end_region);
971
972 // Clear the data used to 'split' regions.
973 SplitInfo& split_info = _space_info[id].split_info();
974 if (split_info.is_valid()) {
975 split_info.clear();
976 }
977 DEBUG_ONLY(split_info.verify_clear();)
978 }
979
980 void PSParallelCompact::pre_compact()
981 {
982 // Update the from & to space pointers in space_info, since they are swapped
983 // at each young gen gc. Do the update unconditionally (even though a
984 // promotion failure does not swap spaces) because an unknown number of young
2832 }
2833 cm->update_contents(oop(addr));
2834 assert(oopDesc::is_oop_or_null(oop(addr)), "Expected an oop or NULL at " PTR_FORMAT, p2i(oop(addr)));
2835 }
2836 }
2837 }
2838
2839 // Skip over count live words starting from beg, and return the address of the
2840 // next live word. Unless marked, the word corresponding to beg is assumed to
2841 // be dead. Callers must either ensure beg does not correspond to the middle of
2842 // an object, or account for those live words in some other way. Callers must
2843 // also ensure that there are enough live words in the range [beg, end) to skip.
2844 HeapWord*
2845 PSParallelCompact::skip_live_words(HeapWord* beg, HeapWord* end, size_t count)
2846 {
2847 assert(count > 0, "sanity");
2848
2849 ParMarkBitMap* m = mark_bitmap();
2850 idx_t bits_to_skip = m->words_to_bits(count);
2851 idx_t cur_beg = m->addr_to_bit(beg);
2852 const idx_t search_end = m->align_range_end(m->addr_to_bit(end));
2853
2854 do {
2855 cur_beg = m->find_obj_beg(cur_beg, search_end);
2856 idx_t cur_end = m->find_obj_end(cur_beg, search_end);
2857 const size_t obj_bits = cur_end - cur_beg + 1;
2858 if (obj_bits > bits_to_skip) {
2859 return m->bit_to_addr(cur_beg + bits_to_skip);
2860 }
2861 bits_to_skip -= obj_bits;
2862 cur_beg = cur_end + 1;
2863 } while (bits_to_skip > 0);
2864
2865 // Skipping the desired number of words landed just past the end of an object.
2866 // Find the start of the next object.
2867 cur_beg = m->find_obj_beg(cur_beg, search_end);
2868 assert(cur_beg < m->addr_to_bit(end), "not enough live words to skip");
2869 return m->bit_to_addr(cur_beg);
2870 }
2871
2872 HeapWord* PSParallelCompact::first_src_addr(HeapWord* const dest_addr,
|