1 /*
2 * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
288 return words >> obj_granularity_shift();
289 }
290
291 inline size_t ParMarkBitMap::obj_size(idx_t beg_bit, idx_t end_bit) const
292 {
293 DEBUG_ONLY(verify_bit(beg_bit);)
294 DEBUG_ONLY(verify_bit(end_bit);)
295 return bits_to_words(end_bit - beg_bit + 1);
296 }
297
298 inline size_t
299 ParMarkBitMap::obj_size(HeapWord* beg_addr, HeapWord* end_addr) const
300 {
301 DEBUG_ONLY(verify_addr(beg_addr);)
302 DEBUG_ONLY(verify_addr(end_addr);)
303 return pointer_delta(end_addr, beg_addr) + obj_granularity();
304 }
305
306 inline size_t ParMarkBitMap::obj_size(idx_t beg_bit) const
307 {
308 const idx_t end_bit = _end_bits.get_next_one_offset_inline(beg_bit, size());
309 assert(is_marked(beg_bit), "obj not marked");
310 assert(end_bit < size(), "end bit missing");
311 return obj_size(beg_bit, end_bit);
312 }
313
314 inline size_t ParMarkBitMap::obj_size(HeapWord* addr) const
315 {
316 return obj_size(addr_to_bit(addr));
317 }
318
319 inline ParMarkBitMap::IterationStatus
320 ParMarkBitMap::iterate(ParMarkBitMapClosure* live_closure,
321 HeapWord* range_beg,
322 HeapWord* range_end) const
323 {
324 return iterate(live_closure, addr_to_bit(range_beg), addr_to_bit(range_end));
325 }
326
327 inline ParMarkBitMap::IterationStatus
328 ParMarkBitMap::iterate(ParMarkBitMapClosure* live_closure,
342 return mark_obj((HeapWord*)obj, (size_t)size);
343 }
344
345 inline BitMap::idx_t
346 ParMarkBitMap::addr_to_bit(HeapWord* addr) const
347 {
348 DEBUG_ONLY(verify_addr(addr);)
349 return words_to_bits(pointer_delta(addr, region_start()));
350 }
351
352 inline HeapWord*
353 ParMarkBitMap::bit_to_addr(idx_t bit) const
354 {
355 DEBUG_ONLY(verify_bit(bit);)
356 return region_start() + bits_to_words(bit);
357 }
358
359 inline ParMarkBitMap::idx_t
360 ParMarkBitMap::find_obj_beg(idx_t beg, idx_t end) const
361 {
362 return _beg_bits.get_next_one_offset_inline_aligned_right(beg, end);
363 }
364
365 inline ParMarkBitMap::idx_t
366 ParMarkBitMap::find_obj_end(idx_t beg, idx_t end) const
367 {
368 return _end_bits.get_next_one_offset_inline_aligned_right(beg, end);
369 }
370
371 inline HeapWord*
372 ParMarkBitMap::find_obj_beg(HeapWord* beg, HeapWord* end) const
373 {
374 const idx_t beg_bit = addr_to_bit(beg);
375 const idx_t end_bit = addr_to_bit(end);
376 const idx_t search_end = BitMap::word_align_up(end_bit);
377 const idx_t res_bit = MIN2(find_obj_beg(beg_bit, search_end), end_bit);
378 return bit_to_addr(res_bit);
379 }
380
381 inline HeapWord*
382 ParMarkBitMap::find_obj_end(HeapWord* beg, HeapWord* end) const
383 {
384 const idx_t beg_bit = addr_to_bit(beg);
385 const idx_t end_bit = addr_to_bit(end);
386 const idx_t search_end = BitMap::word_align_up(end_bit);
387 const idx_t res_bit = MIN2(find_obj_end(beg_bit, search_end), end_bit);
388 return bit_to_addr(res_bit);
|
1 /*
2 * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
288 return words >> obj_granularity_shift();
289 }
290
291 inline size_t ParMarkBitMap::obj_size(idx_t beg_bit, idx_t end_bit) const
292 {
293 DEBUG_ONLY(verify_bit(beg_bit);)
294 DEBUG_ONLY(verify_bit(end_bit);)
295 return bits_to_words(end_bit - beg_bit + 1);
296 }
297
298 inline size_t
299 ParMarkBitMap::obj_size(HeapWord* beg_addr, HeapWord* end_addr) const
300 {
301 DEBUG_ONLY(verify_addr(beg_addr);)
302 DEBUG_ONLY(verify_addr(end_addr);)
303 return pointer_delta(end_addr, beg_addr) + obj_granularity();
304 }
305
306 inline size_t ParMarkBitMap::obj_size(idx_t beg_bit) const
307 {
308 const idx_t end_bit = _end_bits.get_next_one_offset(beg_bit, size());
309 assert(is_marked(beg_bit), "obj not marked");
310 assert(end_bit < size(), "end bit missing");
311 return obj_size(beg_bit, end_bit);
312 }
313
314 inline size_t ParMarkBitMap::obj_size(HeapWord* addr) const
315 {
316 return obj_size(addr_to_bit(addr));
317 }
318
319 inline ParMarkBitMap::IterationStatus
320 ParMarkBitMap::iterate(ParMarkBitMapClosure* live_closure,
321 HeapWord* range_beg,
322 HeapWord* range_end) const
323 {
324 return iterate(live_closure, addr_to_bit(range_beg), addr_to_bit(range_end));
325 }
326
327 inline ParMarkBitMap::IterationStatus
328 ParMarkBitMap::iterate(ParMarkBitMapClosure* live_closure,
342 return mark_obj((HeapWord*)obj, (size_t)size);
343 }
344
345 inline BitMap::idx_t
346 ParMarkBitMap::addr_to_bit(HeapWord* addr) const
347 {
348 DEBUG_ONLY(verify_addr(addr);)
349 return words_to_bits(pointer_delta(addr, region_start()));
350 }
351
352 inline HeapWord*
353 ParMarkBitMap::bit_to_addr(idx_t bit) const
354 {
355 DEBUG_ONLY(verify_bit(bit);)
356 return region_start() + bits_to_words(bit);
357 }
358
359 inline ParMarkBitMap::idx_t
360 ParMarkBitMap::find_obj_beg(idx_t beg, idx_t end) const
361 {
362 return _beg_bits.get_next_one_offset_aligned_right(beg, end);
363 }
364
365 inline ParMarkBitMap::idx_t
366 ParMarkBitMap::find_obj_end(idx_t beg, idx_t end) const
367 {
368 return _end_bits.get_next_one_offset_aligned_right(beg, end);
369 }
370
371 inline HeapWord*
372 ParMarkBitMap::find_obj_beg(HeapWord* beg, HeapWord* end) const
373 {
374 const idx_t beg_bit = addr_to_bit(beg);
375 const idx_t end_bit = addr_to_bit(end);
376 const idx_t search_end = BitMap::word_align_up(end_bit);
377 const idx_t res_bit = MIN2(find_obj_beg(beg_bit, search_end), end_bit);
378 return bit_to_addr(res_bit);
379 }
380
381 inline HeapWord*
382 ParMarkBitMap::find_obj_end(HeapWord* beg, HeapWord* end) const
383 {
384 const idx_t beg_bit = addr_to_bit(beg);
385 const idx_t end_bit = addr_to_bit(end);
386 const idx_t search_end = BitMap::word_align_up(end_bit);
387 const idx_t res_bit = MIN2(find_obj_end(beg_bit, search_end), end_bit);
388 return bit_to_addr(res_bit);
|