author | kbarrett |
Tue, 12 Jun 2018 18:12:59 -0400 | |
changeset 50532 | a18c60527166 |
parent 49964 | 99e698e94cc7 |
child 50752 | 9d62da00bf15 |
permissions | -rw-r--r-- |
9994 | 1 |
/* |
49333
489f1dd40582
8196876: OopStorage::assert_at_safepoint clashes with assert_at_safepoint macros in g1CollectedHeap.hpp
kbarrett
parents:
47678
diff
changeset
|
2 |
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. |
9994 | 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 |
||
35943
e726308008c0
8148973: Rename g1/concurrentMark.{hpp,cpp,inline.hpp} to g1/g1ConcurrentMark.{hpp,cpp,inline.hpp}
ehelin
parents:
35862
diff
changeset
|
25 |
#ifndef SHARE_VM_GC_G1_G1CONCURRENTMARK_INLINE_HPP |
e726308008c0
8148973: Rename g1/concurrentMark.{hpp,cpp,inline.hpp} to g1/g1ConcurrentMark.{hpp,cpp,inline.hpp}
ehelin
parents:
35862
diff
changeset
|
26 |
#define SHARE_VM_GC_G1_G1CONCURRENTMARK_INLINE_HPP |
9994 | 27 |
|
30764 | 28 |
#include "gc/g1/g1CollectedHeap.inline.hpp" |
35943
e726308008c0
8148973: Rename g1/concurrentMark.{hpp,cpp,inline.hpp} to g1/g1ConcurrentMark.{hpp,cpp,inline.hpp}
ehelin
parents:
35862
diff
changeset
|
29 |
#include "gc/g1/g1ConcurrentMark.hpp" |
46751
d2e0cecdbcb0
8184347: Move G1CMBitMap and support classes into their own files
tschatzl
parents:
46750
diff
changeset
|
30 |
#include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp" |
42597
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
41176
diff
changeset
|
31 |
#include "gc/g1/g1ConcurrentMarkObjArrayProcessor.inline.hpp" |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
32 |
#include "gc/g1/g1Policy.hpp" |
49606
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
33 |
#include "gc/g1/g1RegionMarkStatsCache.inline.hpp" |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
34 |
#include "gc/g1/g1RemSetTrackingPolicy.hpp" |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
35 |
#include "gc/g1/heapRegionRemSet.hpp" |
49606
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
36 |
#include "gc/g1/heapRegion.hpp" |
47647
64dba69fc528
8189276: Make SuspendibleThreadSet and related code available to other GCs
rkennke
parents:
47216
diff
changeset
|
37 |
#include "gc/shared/suspendibleThreadSet.hpp" |
30764 | 38 |
#include "gc/shared/taskqueue.inline.hpp" |
46502
116a09d8f142
8180755: Remove use of bitMap.inline.hpp include from instanceKlass.hpp and c1_ValueSet.hpp
tschatzl
parents:
46328
diff
changeset
|
39 |
#include "utilities/bitMap.inline.hpp" |
9994 | 40 |
|
49964
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49809
diff
changeset
|
41 |
inline bool G1CMIsAliveClosure::do_object_b(oop obj) { |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49809
diff
changeset
|
42 |
return !_g1h->is_obj_ill(obj); |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49809
diff
changeset
|
43 |
} |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49809
diff
changeset
|
44 |
|
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49809
diff
changeset
|
45 |
inline bool G1CMSubjectToDiscoveryClosure::do_object_b(oop obj) { |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49809
diff
changeset
|
46 |
// Re-check whether the passed object is null. With ReferentBasedDiscovery the |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49809
diff
changeset
|
47 |
// mutator may have changed the referent's value (i.e. cleared it) between the |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49809
diff
changeset
|
48 |
// time the referent was determined to be potentially alive and calling this |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49809
diff
changeset
|
49 |
// method. |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49809
diff
changeset
|
50 |
if (obj == NULL) { |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49809
diff
changeset
|
51 |
return false; |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49809
diff
changeset
|
52 |
} |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49809
diff
changeset
|
53 |
assert(_g1h->is_in_reserved(obj), "Trying to discover obj " PTR_FORMAT " not in heap", p2i(obj)); |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49809
diff
changeset
|
54 |
return _g1h->heap_region_containing(obj)->is_old_or_humongous(); |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49809
diff
changeset
|
55 |
} |
99e698e94cc7
8201492: Properly implement non-contiguous generations for Reference discovery
tschatzl
parents:
49809
diff
changeset
|
56 |
|
49606
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
57 |
inline bool G1ConcurrentMark::mark_in_next_bitmap(uint const worker_id, oop const obj, size_t const obj_size) { |
46752
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
58 |
HeapRegion* const hr = _g1h->heap_region_containing(obj); |
49606
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
59 |
return mark_in_next_bitmap(worker_id, hr, obj, obj_size); |
46752
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
60 |
} |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
61 |
|
49606
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
62 |
inline bool G1ConcurrentMark::mark_in_next_bitmap(uint const worker_id, HeapRegion* const hr, oop const obj, size_t const obj_size) { |
46752
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
63 |
assert(hr != NULL, "just checking"); |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
64 |
assert(hr->is_in_reserved(obj), "Attempting to mark object at " PTR_FORMAT " that is not contained in the given region %u", p2i(obj), hr->hrm_index()); |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
65 |
|
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
66 |
if (hr->obj_allocated_since_next_marking(obj)) { |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
67 |
return false; |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
68 |
} |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
69 |
|
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
70 |
// Some callers may have stale objects to mark above nTAMS after humongous reclaim. |
46800
498d81a49f6b
8186035: Klass::decode_klass_not_null() asserted on bad oop
stefank
parents:
46752
diff
changeset
|
71 |
// Can't assert that this is a valid object at this point, since it might be in the process of being copied by another thread. |
46752
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
72 |
assert(!hr->is_continues_humongous(), "Should not try to mark object " PTR_FORMAT " in Humongous continues region %u above nTAMS " PTR_FORMAT, p2i(obj), hr->hrm_index(), p2i(hr->next_top_at_mark_start())); |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
73 |
|
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
74 |
HeapWord* const obj_addr = (HeapWord*)obj; |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
75 |
|
49606
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
76 |
bool success = _next_mark_bitmap->par_mark(obj_addr); |
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
77 |
if (success) { |
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
78 |
add_to_liveness(worker_id, obj, obj_size == 0 ? obj->size() : obj_size); |
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
79 |
} |
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
80 |
return success; |
11584
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11583
diff
changeset
|
81 |
} |
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11583
diff
changeset
|
82 |
|
41176
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
83 |
#ifndef PRODUCT |
31994
3721b7aa3a0d
8079082: VerifyNoCSetOopsClosure is derived twice from Closure
kbarrett
parents:
31592
diff
changeset
|
84 |
template<typename Fn> |
41176
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
85 |
inline void G1CMMarkStack::iterate(Fn fn) const { |
49333
489f1dd40582
8196876: OopStorage::assert_at_safepoint clashes with assert_at_safepoint macros in g1CollectedHeap.hpp
kbarrett
parents:
47678
diff
changeset
|
86 |
assert_at_safepoint_on_vm_thread(); |
41176
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
87 |
|
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
88 |
size_t num_chunks = 0; |
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
89 |
|
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
90 |
TaskQueueEntryChunk* cur = _chunk_list; |
41176
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
91 |
while (cur != NULL) { |
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
92 |
guarantee(num_chunks <= _chunks_in_chunk_list, "Found " SIZE_FORMAT " oop chunks which is more than there should be", num_chunks); |
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
93 |
|
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
94 |
for (size_t i = 0; i < EntriesPerChunk; ++i) { |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
95 |
if (cur->data[i].is_null()) { |
41176
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
96 |
break; |
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
97 |
} |
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
98 |
fn(cur->data[i]); |
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
99 |
} |
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
100 |
cur = cur->next; |
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
101 |
num_chunks++; |
31994
3721b7aa3a0d
8079082: VerifyNoCSetOopsClosure is derived twice from Closure
kbarrett
parents:
31592
diff
changeset
|
102 |
} |
3721b7aa3a0d
8079082: VerifyNoCSetOopsClosure is derived twice from Closure
kbarrett
parents:
31592
diff
changeset
|
103 |
} |
41176
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
104 |
#endif |
31994
3721b7aa3a0d
8079082: VerifyNoCSetOopsClosure is derived twice from Closure
kbarrett
parents:
31592
diff
changeset
|
105 |
|
32350
fec57eb3f599
8133121: Move implementation of process_grey_object to concurrentMark.inline.hpp
asiebenborn
parents:
31994
diff
changeset
|
106 |
// It scans an object and visits its children. |
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
107 |
inline void G1CMTask::scan_task_entry(G1TaskQueueEntry task_entry) { process_grey_task_entry<true>(task_entry); } |
32350
fec57eb3f599
8133121: Move implementation of process_grey_object to concurrentMark.inline.hpp
asiebenborn
parents:
31994
diff
changeset
|
108 |
|
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
109 |
inline void G1CMTask::push(G1TaskQueueEntry task_entry) { |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
110 |
assert(task_entry.is_array_slice() || _g1h->is_in_g1_reserved(task_entry.obj()), "invariant"); |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
111 |
assert(task_entry.is_array_slice() || !_g1h->is_on_master_free_list( |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
112 |
_g1h->heap_region_containing(task_entry.obj())), "invariant"); |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
113 |
assert(task_entry.is_array_slice() || !_g1h->is_obj_ill(task_entry.obj()), "invariant"); // FIXME!!! |
47678 | 114 |
assert(task_entry.is_array_slice() || _next_mark_bitmap->is_marked((HeapWord*)task_entry.obj()), "invariant"); |
9994 | 115 |
|
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
116 |
if (!_task_queue->push(task_entry)) { |
9994 | 117 |
// The local task queue looks full. We need to push some entries |
118 |
// to the global stack. |
|
119 |
move_entries_to_global_stack(); |
|
120 |
||
121 |
// this should succeed since, even if we overflow the global |
|
122 |
// stack, we should have definitely removed some entries from the |
|
123 |
// local queue. So, there must be space on it. |
|
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
124 |
bool success = _task_queue->push(task_entry); |
9994 | 125 |
assert(success, "invariant"); |
126 |
} |
|
127 |
} |
|
128 |
||
35943
e726308008c0
8148973: Rename g1/concurrentMark.{hpp,cpp,inline.hpp} to g1/g1ConcurrentMark.{hpp,cpp,inline.hpp}
ehelin
parents:
35862
diff
changeset
|
129 |
inline bool G1CMTask::is_below_finger(oop obj, HeapWord* global_finger) const { |
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30566
diff
changeset
|
130 |
// If obj is above the global finger, then the mark bitmap scan |
30162 | 131 |
// will find it later, and no push is needed. Similarly, if we have |
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30566
diff
changeset
|
132 |
// a current region and obj is between the local finger and the |
30162 | 133 |
// end of the current region, then no push is needed. The tradeoff |
134 |
// of checking both vs only checking the global finger is that the |
|
135 |
// local check will be more accurate and so result in fewer pushes, |
|
136 |
// but may also be a little slower. |
|
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30566
diff
changeset
|
137 |
HeapWord* objAddr = (HeapWord*)obj; |
30162 | 138 |
if (_finger != NULL) { |
139 |
// We have a current region. |
|
9994 | 140 |
|
30162 | 141 |
// Finger and region values are all NULL or all non-NULL. We |
142 |
// use _finger to check since we immediately use its value. |
|
143 |
assert(_curr_region != NULL, "invariant"); |
|
144 |
assert(_region_limit != NULL, "invariant"); |
|
145 |
assert(_region_limit <= global_finger, "invariant"); |
|
146 |
||
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30566
diff
changeset
|
147 |
// True if obj is less than the local finger, or is between |
30162 | 148 |
// the region limit and the global finger. |
149 |
if (objAddr < _finger) { |
|
150 |
return true; |
|
151 |
} else if (objAddr < _region_limit) { |
|
152 |
return false; |
|
153 |
} // Else check global finger. |
|
154 |
} |
|
155 |
// Check global finger. |
|
156 |
return objAddr < global_finger; |
|
157 |
} |
|
9994 | 158 |
|
32350
fec57eb3f599
8133121: Move implementation of process_grey_object to concurrentMark.inline.hpp
asiebenborn
parents:
31994
diff
changeset
|
159 |
template<bool scan> |
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
160 |
inline void G1CMTask::process_grey_task_entry(G1TaskQueueEntry task_entry) { |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
161 |
assert(scan || (task_entry.is_oop() && task_entry.obj()->is_typeArray()), "Skipping scan of grey non-typeArray"); |
47678 | 162 |
assert(task_entry.is_array_slice() || _next_mark_bitmap->is_marked((HeapWord*)task_entry.obj()), |
42597
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
41176
diff
changeset
|
163 |
"Any stolen object should be a slice or marked"); |
32350
fec57eb3f599
8133121: Move implementation of process_grey_object to concurrentMark.inline.hpp
asiebenborn
parents:
31994
diff
changeset
|
164 |
|
fec57eb3f599
8133121: Move implementation of process_grey_object to concurrentMark.inline.hpp
asiebenborn
parents:
31994
diff
changeset
|
165 |
if (scan) { |
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
166 |
if (task_entry.is_array_slice()) { |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
167 |
_words_scanned += _objArray_processor.process_slice(task_entry.slice()); |
42597
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
41176
diff
changeset
|
168 |
} else { |
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
169 |
oop obj = task_entry.obj(); |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
170 |
if (G1CMObjArrayProcessor::should_be_sliced(obj)) { |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
171 |
_words_scanned += _objArray_processor.process_obj(obj); |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
172 |
} else { |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
173 |
_words_scanned += obj->oop_iterate_size(_cm_oop_closure);; |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
174 |
} |
42597
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
41176
diff
changeset
|
175 |
} |
32350
fec57eb3f599
8133121: Move implementation of process_grey_object to concurrentMark.inline.hpp
asiebenborn
parents:
31994
diff
changeset
|
176 |
} |
fec57eb3f599
8133121: Move implementation of process_grey_object to concurrentMark.inline.hpp
asiebenborn
parents:
31994
diff
changeset
|
177 |
check_limits(); |
fec57eb3f599
8133121: Move implementation of process_grey_object to concurrentMark.inline.hpp
asiebenborn
parents:
31994
diff
changeset
|
178 |
} |
fec57eb3f599
8133121: Move implementation of process_grey_object to concurrentMark.inline.hpp
asiebenborn
parents:
31994
diff
changeset
|
179 |
|
42597
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
41176
diff
changeset
|
180 |
inline size_t G1CMTask::scan_objArray(objArrayOop obj, MemRegion mr) { |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
41176
diff
changeset
|
181 |
obj->oop_iterate(_cm_oop_closure, mr); |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
41176
diff
changeset
|
182 |
return mr.word_size(); |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
41176
diff
changeset
|
183 |
} |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
41176
diff
changeset
|
184 |
|
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
185 |
inline HeapWord* G1ConcurrentMark::top_at_rebuild_start(uint region) const { |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
186 |
assert(region < _g1h->max_regions(), "Tried to access TARS for region %u out of bounds", region); |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
187 |
return _top_at_rebuild_starts[region]; |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
188 |
} |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
189 |
|
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
190 |
inline void G1ConcurrentMark::update_top_at_rebuild_start(HeapRegion* r) { |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
191 |
uint const region = r->hrm_index(); |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
192 |
assert(region < _g1h->max_regions(), "Tried to access TARS for region %u out of bounds", region); |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
193 |
assert(_top_at_rebuild_starts[region] == NULL, |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
194 |
"TARS for region %u has already been set to " PTR_FORMAT " should be NULL", |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
195 |
region, p2i(_top_at_rebuild_starts[region])); |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
196 |
G1RemSetTrackingPolicy* tracker = _g1h->g1_policy()->remset_tracker(); |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
197 |
if (tracker->needs_scan_for_rebuild(r)) { |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
198 |
_top_at_rebuild_starts[region] = r->top(); |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
199 |
} else { |
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49607
diff
changeset
|
200 |
// Leave TARS at NULL. |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
201 |
} |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
202 |
} |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
203 |
|
49606
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
204 |
inline void G1CMTask::update_liveness(oop const obj, const size_t obj_size) { |
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
205 |
_mark_stats_cache.add_live_words(_g1h->addr_to_region((HeapWord*)obj), obj_size); |
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
206 |
} |
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
207 |
|
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
208 |
inline void G1ConcurrentMark::add_to_liveness(uint worker_id, oop const obj, size_t size) { |
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
209 |
task(worker_id)->update_liveness(obj, size); |
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
210 |
} |
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
211 |
|
49809
ef5220d644e3
8201490: Improve concurrent mark keep alive closure performance
tschatzl
parents:
49727
diff
changeset
|
212 |
inline bool G1CMTask::make_reference_grey(oop obj) { |
49606
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
213 |
if (!_cm->mark_in_next_bitmap(_worker_id, obj)) { |
49809
ef5220d644e3
8201490: Improve concurrent mark keep alive closure performance
tschatzl
parents:
49727
diff
changeset
|
214 |
return false; |
46752
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
215 |
} |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
216 |
|
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
217 |
// No OrderAccess:store_load() is needed. It is implicit in the |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
218 |
// CAS done in G1CMBitMap::parMark() call in the routine above. |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
219 |
HeapWord* global_finger = _cm->finger(); |
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30566
diff
changeset
|
220 |
|
46752
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
221 |
// We only need to push a newly grey object on the mark |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
222 |
// stack if it is in a section of memory the mark bitmap |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
223 |
// scan has already examined. Mark bitmap scanning |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
224 |
// maintains progress "fingers" for determining that. |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
225 |
// |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
226 |
// Notice that the global finger might be moving forward |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
227 |
// concurrently. This is not a problem. In the worst case, we |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
228 |
// mark the object while it is above the global finger and, by |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
229 |
// the time we read the global finger, it has moved forward |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
230 |
// past this object. In this case, the object will probably |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
231 |
// be visited when a task is scanning the region and will also |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
232 |
// be pushed on the stack. So, some duplicate work, but no |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
233 |
// correctness problems. |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
234 |
if (is_below_finger(obj, global_finger)) { |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
235 |
G1TaskQueueEntry entry = G1TaskQueueEntry::from_oop(obj); |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
236 |
if (obj->is_typeArray()) { |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
237 |
// Immediately process arrays of primitive types, rather |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
238 |
// than pushing on the mark stack. This keeps us from |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
239 |
// adding humongous objects to the mark stack that might |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
240 |
// be reclaimed before the entry is processed - see |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
241 |
// selection of candidates for eager reclaim of humongous |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
242 |
// objects. The cost of the additional type test is |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
243 |
// mitigated by avoiding a trip through the mark stack, |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
244 |
// by only doing a bookkeeping update and avoiding the |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
245 |
// actual scan of the object - a typeArray contains no |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
246 |
// references, and the metadata is built-in. |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
247 |
process_grey_task_entry<false>(entry); |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
248 |
} else { |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
249 |
push(entry); |
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30566
diff
changeset
|
250 |
} |
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30566
diff
changeset
|
251 |
} |
49809
ef5220d644e3
8201490: Improve concurrent mark keep alive closure performance
tschatzl
parents:
49727
diff
changeset
|
252 |
return true; |
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30566
diff
changeset
|
253 |
} |
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30566
diff
changeset
|
254 |
|
49606
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
255 |
template <class T> |
49809
ef5220d644e3
8201490: Improve concurrent mark keep alive closure performance
tschatzl
parents:
49727
diff
changeset
|
256 |
inline bool G1CMTask::deal_with_reference(T* p) { |
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30566
diff
changeset
|
257 |
increment_refs_reached(); |
49606
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49333
diff
changeset
|
258 |
oop const obj = RawAccess<MO_VOLATILE>::oop_load(p); |
46752
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
259 |
if (obj == NULL) { |
49809
ef5220d644e3
8201490: Improve concurrent mark keep alive closure performance
tschatzl
parents:
49727
diff
changeset
|
260 |
return false; |
9994 | 261 |
} |
49809
ef5220d644e3
8201490: Improve concurrent mark keep alive closure performance
tschatzl
parents:
49727
diff
changeset
|
262 |
return make_reference_grey(obj); |
9994 | 263 |
} |
264 |
||
47678 | 265 |
inline void G1ConcurrentMark::mark_in_prev_bitmap(oop p) { |
266 |
assert(!_prev_mark_bitmap->is_marked((HeapWord*) p), "sanity"); |
|
267 |
_prev_mark_bitmap->mark((HeapWord*) p); |
|
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
9999
diff
changeset
|
268 |
} |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
9999
diff
changeset
|
269 |
|
47678 | 270 |
bool G1ConcurrentMark::is_marked_in_prev_bitmap(oop p) const { |
46968
9119841280f4
8160399: is_oop_or_null involves undefined behavior
coleenp
parents:
46800
diff
changeset
|
271 |
assert(p != NULL && oopDesc::is_oop(p), "expected an oop"); |
47678 | 272 |
return _prev_mark_bitmap->is_marked((HeapWord*)p); |
35862
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
34282
diff
changeset
|
273 |
} |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
34282
diff
changeset
|
274 |
|
49727
2bbd5117d91a
8200385: Eagerly reclaimed humongous objects leave mark in prev bitmap
tschatzl
parents:
49634
diff
changeset
|
275 |
bool G1ConcurrentMark::is_marked_in_next_bitmap(oop p) const { |
2bbd5117d91a
8200385: Eagerly reclaimed humongous objects leave mark in prev bitmap
tschatzl
parents:
49634
diff
changeset
|
276 |
assert(p != NULL && oopDesc::is_oop(p), "expected an oop"); |
2bbd5117d91a
8200385: Eagerly reclaimed humongous objects leave mark in prev bitmap
tschatzl
parents:
49634
diff
changeset
|
277 |
return _next_mark_bitmap->is_marked((HeapWord*)p); |
2bbd5117d91a
8200385: Eagerly reclaimed humongous objects leave mark in prev bitmap
tschatzl
parents:
49634
diff
changeset
|
278 |
} |
2bbd5117d91a
8200385: Eagerly reclaimed humongous objects leave mark in prev bitmap
tschatzl
parents:
49634
diff
changeset
|
279 |
|
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37413
diff
changeset
|
280 |
inline bool G1ConcurrentMark::do_yield_check() { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37413
diff
changeset
|
281 |
if (SuspendibleThreadSet::should_yield()) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37413
diff
changeset
|
282 |
SuspendibleThreadSet::yield(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37413
diff
changeset
|
283 |
return true; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37413
diff
changeset
|
284 |
} else { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37413
diff
changeset
|
285 |
return false; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37413
diff
changeset
|
286 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37413
diff
changeset
|
287 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37413
diff
changeset
|
288 |
|
35943
e726308008c0
8148973: Rename g1/concurrentMark.{hpp,cpp,inline.hpp} to g1/g1ConcurrentMark.{hpp,cpp,inline.hpp}
ehelin
parents:
35862
diff
changeset
|
289 |
#endif // SHARE_VM_GC_G1_G1CONCURRENTMARK_INLINE_HPP |