1 /*
2 * Copyright (c) 2005, 2009, 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 *
23 */
24
25 class oopDesc;
26 class ParMarkBitMapClosure;
27
28 class ParMarkBitMap: public CHeapObj
29 {
30 public:
31 typedef BitMap::idx_t idx_t;
32
33 // Values returned by the iterate() methods.
34 enum IterationStatus { incomplete, complete, full, would_overflow };
35
36 inline ParMarkBitMap();
37 inline ParMarkBitMap(MemRegion covered_region);
38 bool initialize(MemRegion covered_region);
39
40 // Atomically mark an object as live.
41 bool mark_obj(HeapWord* addr, size_t size);
42 inline bool mark_obj(oop obj, int size);
43 inline bool mark_obj(oop obj);
44
409 {
410 const idx_t beg_bit = addr_to_bit(beg);
411 const idx_t end_bit = addr_to_bit(end);
412 const idx_t search_end = BitMap::word_align_up(end_bit);
413 const idx_t res_bit = MIN2(find_obj_end(beg_bit, search_end), end_bit);
414 return bit_to_addr(res_bit);
415 }
416
417 #ifdef ASSERT
418 inline void ParMarkBitMap::verify_bit(idx_t bit) const {
419 // Allow one past the last valid bit; useful for loop bounds.
420 assert(bit <= _beg_bits.size(), "bit out of range");
421 }
422
423 inline void ParMarkBitMap::verify_addr(HeapWord* addr) const {
424 // Allow one past the last valid address; useful for loop bounds.
425 assert(addr >= region_start(), "addr too small");
426 assert(addr <= region_start() + region_size(), "addr too big");
427 }
428 #endif // #ifdef ASSERT
|
1 /*
2 * Copyright (c) 2005, 2010, 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 *
23 */
24
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARMARKBITMAP_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARMARKBITMAP_HPP
27
28 #include "gc_implementation/parallelScavenge/psVirtualspace.hpp"
29 #include "utilities/bitMap.inline.hpp"
30
31 class oopDesc;
32 class ParMarkBitMapClosure;
33
34 class ParMarkBitMap: public CHeapObj
35 {
36 public:
37 typedef BitMap::idx_t idx_t;
38
39 // Values returned by the iterate() methods.
40 enum IterationStatus { incomplete, complete, full, would_overflow };
41
42 inline ParMarkBitMap();
43 inline ParMarkBitMap(MemRegion covered_region);
44 bool initialize(MemRegion covered_region);
45
46 // Atomically mark an object as live.
47 bool mark_obj(HeapWord* addr, size_t size);
48 inline bool mark_obj(oop obj, int size);
49 inline bool mark_obj(oop obj);
50
415 {
416 const idx_t beg_bit = addr_to_bit(beg);
417 const idx_t end_bit = addr_to_bit(end);
418 const idx_t search_end = BitMap::word_align_up(end_bit);
419 const idx_t res_bit = MIN2(find_obj_end(beg_bit, search_end), end_bit);
420 return bit_to_addr(res_bit);
421 }
422
423 #ifdef ASSERT
424 inline void ParMarkBitMap::verify_bit(idx_t bit) const {
425 // Allow one past the last valid bit; useful for loop bounds.
426 assert(bit <= _beg_bits.size(), "bit out of range");
427 }
428
429 inline void ParMarkBitMap::verify_addr(HeapWord* addr) const {
430 // Allow one past the last valid address; useful for loop bounds.
431 assert(addr >= region_start(), "addr too small");
432 assert(addr <= region_start() + region_size(), "addr too big");
433 }
434 #endif // #ifdef ASSERT
435
436 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARMARKBITMAP_HPP
|