/* * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
bool
ParMarkBitMap::initialize(MemRegion covered_region)
{ const idx_t bits = bits_required(covered_region); // The bits will be divided evenly between two bitmaps; each of them should be // an integral number of words.
assert(is_aligned(bits, (BitsPerWord * 2)), "region size unaligned");
size_t
ParMarkBitMap::live_words_in_range_helper(HeapWord* beg_addr, oop end_obj) const
{
assert(beg_addr <= cast_from_oop<HeapWord*>(end_obj), "bad range");
assert(is_marked(end_obj), "end_obj must be live");
idx_t live_bits = 0;
// The bitmap routines require the right boundary to be word-aligned. const idx_t end_bit = addr_to_bit(cast_from_oop<HeapWord*>(end_obj)); const idx_t range_end = align_range_end(end_bit);
size_t last_ret = cm->last_query_return(); if (end_obj > last_obj) {
last_ret = last_ret + live_words_in_range_helper(last_obj, end_oop);
last_obj = end_obj;
} elseif (end_obj < last_obj) { // The cached value is for an object that is to the left (lower address) of the current // end_obj. Calculate back from that cached value. if (pointer_delta(end_obj, beg_addr) > pointer_delta(last_obj, end_obj)) {
last_ret = last_ret - live_words_in_range_helper(end_obj, cast_to_oop(last_obj));
} else {
last_ret = live_words_in_range_helper(beg_addr, end_oop);
}
last_obj = end_obj;
}
// The bitmap routines require the right boundary to be word-aligned. const idx_t live_search_end = align_range_end(range_end); const idx_t dead_search_end = align_range_end(dead_range_end);
idx_t cur_beg = range_beg; if (range_beg < range_end && is_unmarked(range_beg)) { // The range starts with dead space. Look for the next object, then fill.
cur_beg = find_obj_beg(range_beg + 1, dead_search_end); const idx_t dead_space_end = MIN2(cur_beg - 1, dead_range_end - 1); const size_t size = obj_size(range_beg, dead_space_end);
dead_closure->do_addr(bit_to_addr(range_beg), size);
}
while (cur_beg < range_end) { const idx_t cur_end = find_obj_end(cur_beg, live_search_end); if (cur_end >= range_end) { // The obj ends outside the range.
live_closure->set_source(bit_to_addr(cur_beg)); return incomplete;
}
const size_t size = obj_size(cur_beg, cur_end);
IterationStatus status = live_closure->do_addr(bit_to_addr(cur_beg), size); if (status != incomplete) {
assert(status == would_overflow || status == full, "sanity"); return status;
}
// Look for the start of the next object. const idx_t dead_space_beg = cur_end + 1;
cur_beg = find_obj_beg(dead_space_beg, dead_search_end); if (cur_beg > dead_space_beg) { // Found dead space; compute the size and invoke the dead closure. const idx_t dead_space_end = MIN2(cur_beg - 1, dead_range_end - 1); const size_t size = obj_size(dead_space_beg, dead_space_end);
dead_closure->do_addr(bit_to_addr(dead_space_beg), size);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.