Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp @ 4827:2e966d967c5c
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
Summary: There is a high number of mispredicted branches associated with calling BitMap::iteratate() from within CMBitMapRO::iterate(). Implement a version of CMBitMapRO::iterate() directly using inline-able routines.
Reviewed-by: tonyp, iveresov
author | johnc |
---|---|
date | Fri, 13 Jan 2012 13:27:48 -0800 |
parents | 2ace1c4ee8da |
children | d30fa85f9994 |
comparison
equal
deleted
inserted
replaced
4788:9d4f4a1825e4 | 4827:2e966d967c5c |
---|---|
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARK_INLINE_HPP | 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARK_INLINE_HPP |
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARK_INLINE_HPP | 26 #define SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARK_INLINE_HPP |
27 | 27 |
28 #include "gc_implementation/g1/concurrentMark.hpp" | 28 #include "gc_implementation/g1/concurrentMark.hpp" |
29 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" | 29 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" |
30 | |
31 inline bool CMBitMapRO::iterate(BitMapClosure* cl, MemRegion mr) { | |
32 HeapWord* start_addr = MAX2(startWord(), mr.start()); | |
33 HeapWord* end_addr = MIN2(endWord(), mr.end()); | |
34 | |
35 if (end_addr > start_addr) { | |
36 // Right-open interval [start-offset, end-offset). | |
37 BitMap::idx_t start_offset = heapWordToOffset(start_addr); | |
38 BitMap::idx_t end_offset = heapWordToOffset(end_addr); | |
39 | |
40 start_offset = _bm.get_next_one_offset(start_offset, end_offset); | |
41 while (start_offset < end_offset) { | |
42 HeapWord* obj_addr = offsetToHeapWord(start_offset); | |
43 oop obj = (oop) obj_addr; | |
44 if (!cl->do_bit(start_offset)) { | |
45 return false; | |
46 } | |
47 HeapWord* next_addr = MIN2(obj_addr + obj->size(), end_addr); | |
48 BitMap::idx_t next_offset = heapWordToOffset(next_addr); | |
49 start_offset = _bm.get_next_one_offset(next_offset, end_offset); | |
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 } | |
30 | 59 |
31 inline void CMTask::push(oop obj) { | 60 inline void CMTask::push(oop obj) { |
32 HeapWord* objAddr = (HeapWord*) obj; | 61 HeapWord* objAddr = (HeapWord*) obj; |
33 assert(_g1h->is_in_g1_reserved(objAddr), "invariant"); | 62 assert(_g1h->is_in_g1_reserved(objAddr), "invariant"); |
34 assert(!_g1h->is_on_master_free_list( | 63 assert(!_g1h->is_on_master_free_list( |