annotate src/hotspot/share/gc/shared/markBitMap.cpp @ 53545:5b87d3fc1093

8213373: Bulk MarkBitMap clearing methods Reviewed-by: rkennke, zgu
author shade
date Thu, 15 Nov 2018 21:05:47 +0100
parents 31b159f30fb2
children ebf733a324d4
rev   line source
rkennke@52321 1 /*
rkennke@52321 2 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
rkennke@52321 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
rkennke@52321 4 *
rkennke@52321 5 * This code is free software; you can redistribute it and/or modify it
rkennke@52321 6 * under the terms of the GNU General Public License version 2 only, as
rkennke@52321 7 * published by the Free Software Foundation.
rkennke@52321 8 *
rkennke@52321 9 * This code is distributed in the hope that it will be useful, but WITHOUT
rkennke@52321 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
rkennke@52321 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
rkennke@52321 12 * version 2 for more details (a copy is included in the LICENSE file that
rkennke@52321 13 * accompanied this code).
rkennke@52321 14 *
rkennke@52321 15 * You should have received a copy of the GNU General Public License version
rkennke@52321 16 * 2 along with this work; if not, write to the Free Software Foundation,
rkennke@52321 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
rkennke@52321 18 *
rkennke@52321 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
rkennke@52321 20 * or visit www.oracle.com if you need additional information or have any
rkennke@52321 21 * questions.
rkennke@52321 22 *
rkennke@52321 23 */
rkennke@52321 24
rkennke@52321 25 #include "precompiled.hpp"
rkennke@52321 26 #include "gc/shared/markBitMap.inline.hpp"
rkennke@52321 27 #include "memory/virtualspace.hpp"
rkennke@52321 28
rkennke@52321 29 void MarkBitMap::print_on_error(outputStream* st, const char* prefix) const {
rkennke@52321 30 _bm.print_on_error(st, prefix);
rkennke@52321 31 }
rkennke@52321 32
rkennke@52321 33 size_t MarkBitMap::compute_size(size_t heap_size) {
rkennke@52321 34 return ReservedSpace::allocation_align_size_up(heap_size / mark_distance());
rkennke@52321 35 }
rkennke@52321 36
rkennke@52321 37 size_t MarkBitMap::mark_distance() {
rkennke@52321 38 return MinObjAlignmentInBytes * BitsPerByte;
rkennke@52321 39 }
rkennke@52321 40
rkennke@52321 41 void MarkBitMap::initialize(MemRegion heap, MemRegion storage) {
rkennke@52321 42 _covered = heap;
rkennke@52321 43
rkennke@52321 44 _bm = BitMapView((BitMap::bm_word_t*) storage.start(), _covered.word_size() >> _shifter);
rkennke@52321 45 }
rkennke@52321 46
shade@53545 47 void MarkBitMap::do_clear(MemRegion mr, bool large) {
rkennke@52321 48 MemRegion intersection = mr.intersection(_covered);
rkennke@52321 49 assert(!intersection.is_empty(),
rkennke@52321 50 "Given range from " PTR_FORMAT " to " PTR_FORMAT " is completely outside the heap",
rkennke@52321 51 p2i(mr.start()), p2i(mr.end()));
rkennke@52321 52 // convert address range into offset range
shade@53545 53 size_t beg = addr_to_offset(intersection.start());
shade@53545 54 size_t end = addr_to_offset(intersection.end());
shade@53545 55 if (large) {
shade@53545 56 _bm.clear_large_range(beg, end);
shade@53545 57 } else {
shade@53545 58 _bm.clear_range(beg, end);
shade@53545 59 }
rkennke@52321 60 }
rkennke@52321 61
rkennke@52321 62 #ifdef ASSERT
rkennke@52321 63 void MarkBitMap::check_mark(HeapWord* addr) {
rkennke@52321 64 assert(Universe::heap()->is_in_reserved(addr),
rkennke@52321 65 "Trying to access bitmap " PTR_FORMAT " for address " PTR_FORMAT " not in the heap.",
rkennke@52321 66 p2i(this), p2i(addr));
rkennke@52321 67 }
rkennke@52321 68 #endif