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_G1_CONCURRENTMARK_INLINE_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARK_INLINE_HPP
27
28 #include "gc_implementation/g1/concurrentMark.hpp"
29 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
30
31 inline void CMTask::push(oop obj) {
32 HeapWord* objAddr = (HeapWord*) obj;
33 assert(_g1h->is_in_g1_reserved(objAddr), "invariant");
34 assert(!_g1h->is_on_master_free_list(
35 _g1h->heap_region_containing((HeapWord*) objAddr)), "invariant");
36 assert(!_g1h->is_obj_ill(obj), "invariant");
37 assert(_nextMarkBitMap->isMarked(objAddr), "invariant");
38
39 if (_cm->verbose_high()) {
40 gclog_or_tty->print_cr("[%d] pushing "PTR_FORMAT, _task_id, (void*) obj);
41 }
42
43 if (!_task_queue->push(obj)) {
44 // The local task queue looks full. We need to push some entries
45 // to the global stack.
46
47 if (_cm->verbose_medium()) {
48 gclog_or_tty->print_cr("[%d] task queue overflow, "
49 "moving entries to the global stack",
50 _task_id);
|
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_G1_CONCURRENTMARK_INLINE_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARK_INLINE_HPP
27
28 #include "gc_implementation/g1/concurrentMark.hpp"
29 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
30
31 inline bool CMBitMapRO::iterate(BitMapClosure* cl, MemRegion mr) {
32 HeapWord* left = MAX2(_bmStartWord, mr.start());
33 HeapWord* right = MIN2(_bmStartWord + _bmWordSize, mr.end());
34
35 if (right > left) {
36 // Right-open interval [left-offset, right-offset).
37 BitMap::idx_t start = heapWordToOffset(left);
38 BitMap::idx_t end = heapWordToOffset(right);
39
40 start = _bm.get_next_one_offset(start, end);
41 while (start < end) {
42 HeapWord* addr = offsetToHeapWord(start);
43 oop obj = (oop) addr;
44 if (!cl->do_bit(start)) {
45 return false;
46 }
47 HeapWord* next_addr = MIN2(addr + obj->size(), right);
48 BitMap::idx_t next = heapWordToOffset(next_addr);
49 start = _bm.get_next_one_offset(next, end);
50 }
51 }
52 return true;
53 }
54
55 inline bool CMBitMapRO::iterate(BitMapClosure* cl) {
56 MemRegion mr(startWord(), sizeInWords());
57 return iterate(cl, mr);
58 }
59
60 inline void CMTask::push(oop obj) {
61 HeapWord* objAddr = (HeapWord*) obj;
62 assert(_g1h->is_in_g1_reserved(objAddr), "invariant");
63 assert(!_g1h->is_on_master_free_list(
64 _g1h->heap_region_containing((HeapWord*) objAddr)), "invariant");
65 assert(!_g1h->is_obj_ill(obj), "invariant");
66 assert(_nextMarkBitMap->isMarked(objAddr), "invariant");
67
68 if (_cm->verbose_high()) {
69 gclog_or_tty->print_cr("[%d] pushing "PTR_FORMAT, _task_id, (void*) obj);
70 }
71
72 if (!_task_queue->push(obj)) {
73 // The local task queue looks full. We need to push some entries
74 // to the global stack.
75
76 if (_cm->verbose_medium()) {
77 gclog_or_tty->print_cr("[%d] task queue overflow, "
78 "moving entries to the global stack",
79 _task_id);
|