mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8180193: Make marking bitmap code available to other GCs
Reviewed-by: shade, stefank
This commit is contained in:
parent
d40735db17
commit
296002fe50
6 changed files with 247 additions and 122 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -28,23 +28,8 @@
|
||||||
#include "gc/g1/heapRegion.hpp"
|
#include "gc/g1/heapRegion.hpp"
|
||||||
#include "memory/virtualspace.hpp"
|
#include "memory/virtualspace.hpp"
|
||||||
|
|
||||||
void G1CMBitMap::print_on_error(outputStream* st, const char* prefix) const {
|
|
||||||
_bm.print_on_error(st, prefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t G1CMBitMap::compute_size(size_t heap_size) {
|
|
||||||
return ReservedSpace::allocation_align_size_up(heap_size / mark_distance());
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t G1CMBitMap::mark_distance() {
|
|
||||||
return MinObjAlignmentInBytes * BitsPerByte;
|
|
||||||
}
|
|
||||||
|
|
||||||
void G1CMBitMap::initialize(MemRegion heap, G1RegionToSpaceMapper* storage) {
|
void G1CMBitMap::initialize(MemRegion heap, G1RegionToSpaceMapper* storage) {
|
||||||
_covered = heap;
|
MarkBitMap::initialize(heap, storage->reserved());
|
||||||
|
|
||||||
_bm = BitMapView((BitMap::bm_word_t*) storage->reserved().start(), _covered.word_size() >> _shifter);
|
|
||||||
|
|
||||||
storage->set_mapping_changed_listener(&_listener);
|
storage->set_mapping_changed_listener(&_listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,19 +42,17 @@ void G1CMBitMapMappingChangedListener::on_commit(uint start_region, size_t num_r
|
||||||
_bm->clear_range(mr);
|
_bm->clear_range(mr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void G1CMBitMap::clear_range(MemRegion mr) {
|
|
||||||
MemRegion intersection = mr.intersection(_covered);
|
|
||||||
assert(!intersection.is_empty(),
|
|
||||||
"Given range from " PTR_FORMAT " to " PTR_FORMAT " is completely outside the heap",
|
|
||||||
p2i(mr.start()), p2i(mr.end()));
|
|
||||||
// convert address range into offset range
|
|
||||||
_bm.at_put_range(addr_to_offset(intersection.start()),
|
|
||||||
addr_to_offset(intersection.end()), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void G1CMBitMap::clear_region(HeapRegion* region) {
|
void G1CMBitMap::clear_region(HeapRegion* region) {
|
||||||
if (!region->is_empty()) {
|
if (!region->is_empty()) {
|
||||||
MemRegion mr(region->bottom(), region->top());
|
MemRegion mr(region->bottom(), region->top());
|
||||||
clear_range(mr);
|
clear_range(mr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ASSERT
|
||||||
|
void G1CMBitMap::check_mark(HeapWord* addr) {
|
||||||
|
assert(G1CollectedHeap::heap()->is_in_exact(addr),
|
||||||
|
"Trying to access bitmap " PTR_FORMAT " for address " PTR_FORMAT " not in the heap.",
|
||||||
|
p2i(this), p2i(addr));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#define SHARE_VM_GC_G1_G1CONCURRENTMARKBITMAP_HPP
|
#define SHARE_VM_GC_G1_G1CONCURRENTMARKBITMAP_HPP
|
||||||
|
|
||||||
#include "gc/g1/g1RegionToSpaceMapper.hpp"
|
#include "gc/g1/g1RegionToSpaceMapper.hpp"
|
||||||
|
#include "gc/shared/markBitMap.hpp"
|
||||||
#include "memory/memRegion.hpp"
|
#include "memory/memRegion.hpp"
|
||||||
#include "oops/oopsHierarchy.hpp"
|
#include "oops/oopsHierarchy.hpp"
|
||||||
#include "utilities/bitMap.hpp"
|
#include "utilities/bitMap.hpp"
|
||||||
|
@ -59,68 +60,24 @@ public:
|
||||||
|
|
||||||
// A generic mark bitmap for concurrent marking. This is essentially a wrapper
|
// A generic mark bitmap for concurrent marking. This is essentially a wrapper
|
||||||
// around the BitMap class that is based on HeapWords, with one bit per (1 << _shifter) HeapWords.
|
// around the BitMap class that is based on HeapWords, with one bit per (1 << _shifter) HeapWords.
|
||||||
class G1CMBitMap {
|
class G1CMBitMap : public MarkBitMap {
|
||||||
MemRegion _covered; // The heap area covered by this bitmap.
|
|
||||||
|
|
||||||
const int _shifter; // Shift amount from heap index to bit index in the bitmap.
|
|
||||||
|
|
||||||
BitMapView _bm; // The actual bitmap.
|
|
||||||
|
|
||||||
G1CMBitMapMappingChangedListener _listener;
|
G1CMBitMapMappingChangedListener _listener;
|
||||||
|
|
||||||
inline void check_mark(HeapWord* addr) NOT_DEBUG_RETURN;
|
protected:
|
||||||
|
|
||||||
|
virtual void check_mark(HeapWord* addr) NOT_DEBUG_RETURN;
|
||||||
|
|
||||||
// Convert from bit offset to address.
|
|
||||||
HeapWord* offset_to_addr(size_t offset) const {
|
|
||||||
return _covered.start() + (offset << _shifter);
|
|
||||||
}
|
|
||||||
// Convert from address to bit offset.
|
|
||||||
size_t addr_to_offset(const HeapWord* addr) const {
|
|
||||||
return pointer_delta(addr, _covered.start()) >> _shifter;
|
|
||||||
}
|
|
||||||
public:
|
public:
|
||||||
static size_t compute_size(size_t heap_size);
|
|
||||||
// Returns the amount of bytes on the heap between two marks in the bitmap.
|
|
||||||
static size_t mark_distance();
|
|
||||||
// Returns how many bytes (or bits) of the heap a single byte (or bit) of the
|
|
||||||
// mark bitmap corresponds to. This is the same as the mark distance above.
|
|
||||||
static size_t heap_map_factor() {
|
|
||||||
return mark_distance();
|
|
||||||
}
|
|
||||||
|
|
||||||
G1CMBitMap() : _covered(), _shifter(LogMinObjAlignment), _bm(), _listener() { _listener.set_bitmap(this); }
|
G1CMBitMap() : MarkBitMap(), _listener() { _listener.set_bitmap(this); }
|
||||||
|
|
||||||
// Initializes the underlying BitMap to cover the given area.
|
// Initializes the underlying BitMap to cover the given area.
|
||||||
void initialize(MemRegion heap, G1RegionToSpaceMapper* storage);
|
void initialize(MemRegion heap, G1RegionToSpaceMapper* storage);
|
||||||
|
|
||||||
// Read marks
|
|
||||||
bool is_marked(oop obj) const;
|
|
||||||
bool is_marked(HeapWord* addr) const {
|
|
||||||
assert(_covered.contains(addr),
|
|
||||||
"Address " PTR_FORMAT " is outside underlying space from " PTR_FORMAT " to " PTR_FORMAT,
|
|
||||||
p2i(addr), p2i(_covered.start()), p2i(_covered.end()));
|
|
||||||
return _bm.at(addr_to_offset(addr));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply the closure to the addresses that correspond to marked bits in the bitmap.
|
// Apply the closure to the addresses that correspond to marked bits in the bitmap.
|
||||||
inline bool iterate(G1CMBitMapClosure* cl, MemRegion mr);
|
inline bool iterate(G1CMBitMapClosure* cl, MemRegion mr);
|
||||||
|
|
||||||
// Return the address corresponding to the next marked bit at or after
|
|
||||||
// "addr", and before "limit", if "limit" is non-NULL. If there is no
|
|
||||||
// such bit, returns "limit" if that is non-NULL, or else "endWord()".
|
|
||||||
inline HeapWord* get_next_marked_addr(const HeapWord* addr,
|
|
||||||
const HeapWord* limit) const;
|
|
||||||
|
|
||||||
void print_on_error(outputStream* st, const char* prefix) const;
|
|
||||||
|
|
||||||
// Write marks.
|
|
||||||
inline void mark(HeapWord* addr);
|
|
||||||
inline void clear(HeapWord* addr);
|
|
||||||
inline void clear(oop obj);
|
|
||||||
inline bool par_mark(HeapWord* addr);
|
|
||||||
inline bool par_mark(oop obj);
|
|
||||||
|
|
||||||
void clear_range(MemRegion mr);
|
|
||||||
void clear_region(HeapRegion* hr);
|
void clear_region(HeapRegion* hr);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -26,6 +26,7 @@
|
||||||
#define SHARE_VM_GC_G1_G1CONCURRENTMARKBITMAP_INLINE_HPP
|
#define SHARE_VM_GC_G1_G1CONCURRENTMARKBITMAP_INLINE_HPP
|
||||||
|
|
||||||
#include "gc/g1/g1ConcurrentMarkBitMap.hpp"
|
#include "gc/g1/g1ConcurrentMarkBitMap.hpp"
|
||||||
|
#include "gc/shared/markBitMap.inline.hpp"
|
||||||
#include "memory/memRegion.hpp"
|
#include "memory/memRegion.hpp"
|
||||||
#include "utilities/align.hpp"
|
#include "utilities/align.hpp"
|
||||||
#include "utilities/bitMap.inline.hpp"
|
#include "utilities/bitMap.inline.hpp"
|
||||||
|
@ -50,49 +51,4 @@ inline bool G1CMBitMap::iterate(G1CMBitMapClosure* cl, MemRegion mr) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline HeapWord* G1CMBitMap::get_next_marked_addr(const HeapWord* addr,
|
|
||||||
const HeapWord* limit) const {
|
|
||||||
assert(limit != NULL, "limit must not be NULL");
|
|
||||||
// Round addr up to a possible object boundary to be safe.
|
|
||||||
size_t const addr_offset = addr_to_offset(align_up(addr, HeapWordSize << _shifter));
|
|
||||||
size_t const limit_offset = addr_to_offset(limit);
|
|
||||||
size_t const nextOffset = _bm.get_next_one_offset(addr_offset, limit_offset);
|
|
||||||
return offset_to_addr(nextOffset);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ASSERT
|
|
||||||
inline void G1CMBitMap::check_mark(HeapWord* addr) {
|
|
||||||
assert(G1CollectedHeap::heap()->is_in_exact(addr),
|
|
||||||
"Trying to access bitmap " PTR_FORMAT " for address " PTR_FORMAT " not in the heap.",
|
|
||||||
p2i(this), p2i(addr));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline void G1CMBitMap::mark(HeapWord* addr) {
|
|
||||||
check_mark(addr);
|
|
||||||
_bm.set_bit(addr_to_offset(addr));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void G1CMBitMap::clear(HeapWord* addr) {
|
|
||||||
check_mark(addr);
|
|
||||||
_bm.clear_bit(addr_to_offset(addr));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool G1CMBitMap::par_mark(HeapWord* addr) {
|
|
||||||
check_mark(addr);
|
|
||||||
return _bm.par_set_bit(addr_to_offset(addr));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool G1CMBitMap::par_mark(oop obj) {
|
|
||||||
return par_mark((HeapWord*) obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool G1CMBitMap::is_marked(oop obj) const{
|
|
||||||
return is_marked((HeapWord*) obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void G1CMBitMap::clear(oop obj) {
|
|
||||||
clear((HeapWord*) obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // SHARE_VM_GC_G1_G1CONCURRENTMARKBITMAP_INLINE_HPP
|
#endif // SHARE_VM_GC_G1_G1CONCURRENTMARKBITMAP_INLINE_HPP
|
||||||
|
|
63
src/hotspot/share/gc/shared/markBitMap.cpp
Normal file
63
src/hotspot/share/gc/shared/markBitMap.cpp
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018, 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "precompiled.hpp"
|
||||||
|
#include "gc/shared/markBitMap.inline.hpp"
|
||||||
|
#include "memory/virtualspace.hpp"
|
||||||
|
|
||||||
|
void MarkBitMap::print_on_error(outputStream* st, const char* prefix) const {
|
||||||
|
_bm.print_on_error(st, prefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t MarkBitMap::compute_size(size_t heap_size) {
|
||||||
|
return ReservedSpace::allocation_align_size_up(heap_size / mark_distance());
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t MarkBitMap::mark_distance() {
|
||||||
|
return MinObjAlignmentInBytes * BitsPerByte;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MarkBitMap::initialize(MemRegion heap, MemRegion storage) {
|
||||||
|
_covered = heap;
|
||||||
|
|
||||||
|
_bm = BitMapView((BitMap::bm_word_t*) storage.start(), _covered.word_size() >> _shifter);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MarkBitMap::clear_range(MemRegion mr) {
|
||||||
|
MemRegion intersection = mr.intersection(_covered);
|
||||||
|
assert(!intersection.is_empty(),
|
||||||
|
"Given range from " PTR_FORMAT " to " PTR_FORMAT " is completely outside the heap",
|
||||||
|
p2i(mr.start()), p2i(mr.end()));
|
||||||
|
// convert address range into offset range
|
||||||
|
_bm.at_put_range(addr_to_offset(intersection.start()),
|
||||||
|
addr_to_offset(intersection.end()), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ASSERT
|
||||||
|
void MarkBitMap::check_mark(HeapWord* addr) {
|
||||||
|
assert(Universe::heap()->is_in_reserved(addr),
|
||||||
|
"Trying to access bitmap " PTR_FORMAT " for address " PTR_FORMAT " not in the heap.",
|
||||||
|
p2i(this), p2i(addr));
|
||||||
|
}
|
||||||
|
#endif
|
94
src/hotspot/share/gc/shared/markBitMap.hpp
Normal file
94
src/hotspot/share/gc/shared/markBitMap.hpp
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018, 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SHARE_VM_GC_SHARED_MARKBITMAP_HPP
|
||||||
|
#define SHARE_VM_GC_SHARED_MARKBITMAP_HPP
|
||||||
|
|
||||||
|
#include "memory/memRegion.hpp"
|
||||||
|
#include "oops/oopsHierarchy.hpp"
|
||||||
|
#include "utilities/bitMap.hpp"
|
||||||
|
|
||||||
|
// A generic mark bitmap for concurrent marking. This is essentially a wrapper
|
||||||
|
// around the BitMap class that is based on HeapWords, with one bit per (1 << _shifter) HeapWords.
|
||||||
|
class MarkBitMap {
|
||||||
|
protected:
|
||||||
|
MemRegion _covered; // The heap area covered by this bitmap.
|
||||||
|
|
||||||
|
const int _shifter; // Shift amount from heap index to bit index in the bitmap.
|
||||||
|
|
||||||
|
BitMapView _bm; // The actual bitmap.
|
||||||
|
|
||||||
|
virtual void check_mark(HeapWord* addr) NOT_DEBUG_RETURN;
|
||||||
|
|
||||||
|
// Convert from bit offset to address.
|
||||||
|
HeapWord* offset_to_addr(size_t offset) const {
|
||||||
|
return _covered.start() + (offset << _shifter);
|
||||||
|
}
|
||||||
|
// Convert from address to bit offset.
|
||||||
|
size_t addr_to_offset(const HeapWord* addr) const {
|
||||||
|
return pointer_delta(addr, _covered.start()) >> _shifter;
|
||||||
|
}
|
||||||
|
public:
|
||||||
|
static size_t compute_size(size_t heap_size);
|
||||||
|
// Returns the amount of bytes on the heap between two marks in the bitmap.
|
||||||
|
static size_t mark_distance();
|
||||||
|
// Returns how many bytes (or bits) of the heap a single byte (or bit) of the
|
||||||
|
// mark bitmap corresponds to. This is the same as the mark distance above.
|
||||||
|
static size_t heap_map_factor() {
|
||||||
|
return mark_distance();
|
||||||
|
}
|
||||||
|
|
||||||
|
MarkBitMap() : _covered(), _shifter(LogMinObjAlignment), _bm() {}
|
||||||
|
|
||||||
|
// Initializes the underlying BitMap to cover the given area.
|
||||||
|
void initialize(MemRegion heap, MemRegion storage);
|
||||||
|
|
||||||
|
// Read marks
|
||||||
|
bool is_marked(oop obj) const;
|
||||||
|
bool is_marked(HeapWord* addr) const {
|
||||||
|
assert(_covered.contains(addr),
|
||||||
|
"Address " PTR_FORMAT " is outside underlying space from " PTR_FORMAT " to " PTR_FORMAT,
|
||||||
|
p2i(addr), p2i(_covered.start()), p2i(_covered.end()));
|
||||||
|
return _bm.at(addr_to_offset(addr));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the address corresponding to the next marked bit at or after
|
||||||
|
// "addr", and before "limit", if "limit" is non-NULL. If there is no
|
||||||
|
// such bit, returns "limit" if that is non-NULL, or else "endWord()".
|
||||||
|
inline HeapWord* get_next_marked_addr(const HeapWord* addr,
|
||||||
|
const HeapWord* limit) const;
|
||||||
|
|
||||||
|
void print_on_error(outputStream* st, const char* prefix) const;
|
||||||
|
|
||||||
|
// Write marks.
|
||||||
|
inline void mark(HeapWord* addr);
|
||||||
|
inline void clear(HeapWord* addr);
|
||||||
|
inline void clear(oop obj);
|
||||||
|
inline bool par_mark(HeapWord* addr);
|
||||||
|
inline bool par_mark(oop obj);
|
||||||
|
|
||||||
|
void clear_range(MemRegion mr);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SHARE_VM_GC_SHARED_MARKBITMAP_HPP
|
72
src/hotspot/share/gc/shared/markBitMap.inline.hpp
Normal file
72
src/hotspot/share/gc/shared/markBitMap.inline.hpp
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018, 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SHARE_VM_GC_SHARED_MARKBITMAP_INLINE_HPP
|
||||||
|
#define SHARE_VM_GC_SHARED_MARKBITMAP_INLINE_HPP
|
||||||
|
|
||||||
|
#include "gc/shared/collectedHeap.hpp"
|
||||||
|
#include "gc/shared/markBitMap.hpp"
|
||||||
|
#include "memory/memRegion.hpp"
|
||||||
|
#include "memory/universe.hpp"
|
||||||
|
#include "utilities/align.hpp"
|
||||||
|
#include "utilities/bitMap.inline.hpp"
|
||||||
|
|
||||||
|
inline HeapWord* MarkBitMap::get_next_marked_addr(const HeapWord* addr,
|
||||||
|
const HeapWord* limit) const {
|
||||||
|
assert(limit != NULL, "limit must not be NULL");
|
||||||
|
// Round addr up to a possible object boundary to be safe.
|
||||||
|
size_t const addr_offset = addr_to_offset(align_up(addr, HeapWordSize << _shifter));
|
||||||
|
size_t const limit_offset = addr_to_offset(limit);
|
||||||
|
size_t const nextOffset = _bm.get_next_one_offset(addr_offset, limit_offset);
|
||||||
|
return offset_to_addr(nextOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void MarkBitMap::mark(HeapWord* addr) {
|
||||||
|
check_mark(addr);
|
||||||
|
_bm.set_bit(addr_to_offset(addr));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void MarkBitMap::clear(HeapWord* addr) {
|
||||||
|
check_mark(addr);
|
||||||
|
_bm.clear_bit(addr_to_offset(addr));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool MarkBitMap::par_mark(HeapWord* addr) {
|
||||||
|
check_mark(addr);
|
||||||
|
return _bm.par_set_bit(addr_to_offset(addr));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool MarkBitMap::par_mark(oop obj) {
|
||||||
|
return par_mark((HeapWord*) obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool MarkBitMap::is_marked(oop obj) const{
|
||||||
|
return is_marked((HeapWord*) obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void MarkBitMap::clear(oop obj) {
|
||||||
|
clear((HeapWord*) obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // SHARE_VM_GC_SHARED_MARKBITMAP_INLINE_HPP
|
Loading…
Add table
Add a link
Reference in a new issue