6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #ifndef SHARE_VM_GC_SHENANDOAH_SHENANDOAHMARKBITMAP_INLINE_HPP
27 #define SHARE_VM_GC_SHENANDOAH_SHENANDOAHMARKBITMAP_INLINE_HPP
28
29 #include "gc/shenandoah/shenandoahMarkBitMap.hpp"
30
31 #include "runtime/atomic.hpp"
32 #include "utilities/count_trailing_zeros.hpp"
33
34 inline size_t ShenandoahMarkBitMap::address_to_index(const HeapWord* addr) const {
35 return (pointer_delta(addr, _covered.start()) << 1) >> _shift;
36 }
37
38 inline HeapWord* ShenandoahMarkBitMap::index_to_address(size_t offset) const {
39 return _covered.start() + ((offset >> 1) << _shift);
40 }
41
42 inline bool ShenandoahMarkBitMap::mark_strong(HeapWord* heap_addr, bool& was_upgraded) {
43 check_mark(heap_addr);
44
45 idx_t bit = address_to_index(heap_addr);
46 verify_index(bit);
47 volatile bm_word_t* const addr = word_addr(bit);
188 if (bit_in_word(end) != 0) {
189 mask |= ~(bit_mask(end) - 1); // high (left) bits
190 }
191 return mask;
192 }
193
194 inline void ShenandoahMarkBitMap::clear_range_of_words(bm_word_t* map, idx_t beg, idx_t end) {
195 for (idx_t i = beg; i < end; ++i) map[i] = 0;
196 }
197
198 inline void ShenandoahMarkBitMap::clear_large_range_of_words(idx_t beg, idx_t end) {
199 assert(beg <= end, "underflow");
200 memset(_map + beg, 0, (end - beg) * sizeof(bm_word_t));
201 }
202
203 inline void ShenandoahMarkBitMap::clear_range_of_words(idx_t beg, idx_t end) {
204 clear_range_of_words(_map, beg, end);
205 }
206
207
208 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAHMARKBITMAP_INLINE_HPP
|
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHMARKBITMAP_INLINE_HPP
27 #define SHARE_GC_SHENANDOAH_SHENANDOAHMARKBITMAP_INLINE_HPP
28
29 #include "gc/shenandoah/shenandoahMarkBitMap.hpp"
30
31 #include "runtime/atomic.hpp"
32 #include "utilities/count_trailing_zeros.hpp"
33
34 inline size_t ShenandoahMarkBitMap::address_to_index(const HeapWord* addr) const {
35 return (pointer_delta(addr, _covered.start()) << 1) >> _shift;
36 }
37
38 inline HeapWord* ShenandoahMarkBitMap::index_to_address(size_t offset) const {
39 return _covered.start() + ((offset >> 1) << _shift);
40 }
41
42 inline bool ShenandoahMarkBitMap::mark_strong(HeapWord* heap_addr, bool& was_upgraded) {
43 check_mark(heap_addr);
44
45 idx_t bit = address_to_index(heap_addr);
46 verify_index(bit);
47 volatile bm_word_t* const addr = word_addr(bit);
188 if (bit_in_word(end) != 0) {
189 mask |= ~(bit_mask(end) - 1); // high (left) bits
190 }
191 return mask;
192 }
193
194 inline void ShenandoahMarkBitMap::clear_range_of_words(bm_word_t* map, idx_t beg, idx_t end) {
195 for (idx_t i = beg; i < end; ++i) map[i] = 0;
196 }
197
198 inline void ShenandoahMarkBitMap::clear_large_range_of_words(idx_t beg, idx_t end) {
199 assert(beg <= end, "underflow");
200 memset(_map + beg, 0, (end - beg) * sizeof(bm_word_t));
201 }
202
203 inline void ShenandoahMarkBitMap::clear_range_of_words(idx_t beg, idx_t end) {
204 clear_range_of_words(_map, beg, end);
205 }
206
207
208 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHMARKBITMAP_INLINE_HPP
|