annotate src/hotspot/share/gc/shared/markBitMap.cpp @ 56939:c0338134a40b

Automatic merge with records-and-sealed
author mcimadamore
date Mon, 15 Jul 2019 19:40:40 +0000
parents 5b87d3fc1093
children
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"
stefank@56139 27 #include "memory/universe.hpp"
rkennke@52321 28 #include "memory/virtualspace.hpp"
rkennke@52321 29
rkennke@52321 30 void MarkBitMap::print_on_error(outputStream* st, const char* prefix) const {
rkennke@52321 31 _bm.print_on_error(st, prefix);
rkennke@52321 32 }
rkennke@52321 33
rkennke@52321 34 size_t MarkBitMap::compute_size(size_t heap_size) {
rkennke@52321 35 return ReservedSpace::allocation_align_size_up(heap_size / mark_distance());
rkennke@52321 36 }
rkennke@52321 37
rkennke@52321 38 size_t MarkBitMap::mark_distance() {
rkennke@52321 39 return MinObjAlignmentInBytes * BitsPerByte;
rkennke@52321 40 }
rkennke@52321 41
rkennke@52321 42 void MarkBitMap::initialize(MemRegion heap, MemRegion storage) {
rkennke@52321 43 _covered = heap;
rkennke@52321 44
rkennke@52321 45 _bm = BitMapView((BitMap::bm_word_t*) storage.start(), _covered.word_size() >> _shifter);
rkennke@52321 46 }
rkennke@52321 47
shade@53545 48 void MarkBitMap::do_clear(MemRegion mr, bool large) {
rkennke@52321 49 MemRegion intersection = mr.intersection(_covered);
rkennke@52321 50 assert(!intersection.is_empty(),
rkennke@52321 51 "Given range from " PTR_FORMAT " to " PTR_FORMAT " is completely outside the heap",
rkennke@52321 52 p2i(mr.start()), p2i(mr.end()));
rkennke@52321 53 // convert address range into offset range
shade@53545 54 size_t beg = addr_to_offset(intersection.start());
shade@53545 55 size_t end = addr_to_offset(intersection.end());
shade@53545 56 if (large) {
shade@53545 57 _bm.clear_large_range(beg, end);
shade@53545 58 } else {
shade@53545 59 _bm.clear_range(beg, end);
shade@53545 60 }
rkennke@52321 61 }
rkennke@52321 62
rkennke@52321 63 #ifdef ASSERT
rkennke@52321 64 void MarkBitMap::check_mark(HeapWord* addr) {
rkennke@52321 65 assert(Universe::heap()->is_in_reserved(addr),
rkennke@52321 66 "Trying to access bitmap " PTR_FORMAT " for address " PTR_FORMAT " not in the heap.",
rkennke@52321 67 p2i(this), p2i(addr));
rkennke@52321 68 }
rkennke@52321 69 #endif