author | rkennke |
Wed, 18 Oct 2017 21:17:46 +0200 | |
changeset 47647 | 64dba69fc528 |
parent 47216 | 71c04702a3d5 |
child 47678 | c84eeb55c55e |
permissions | -rw-r--r-- |
9994 | 1 |
/* |
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
2 |
* Copyright (c) 2001, 2017, 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" |
47647
64dba69fc528
8189276: Make SuspendibleThreadSet and related code available to other GCs
rkennke
parents:
47216
diff
changeset
|
32 |
#include "gc/shared/suspendibleThreadSet.hpp" |
30764 | 33 |
#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
|
34 |
#include "utilities/bitMap.inline.hpp" |
9994 | 35 |
|
46752
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
36 |
inline bool G1ConcurrentMark::mark_in_next_bitmap(oop const obj) { |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
37 |
HeapRegion* const hr = _g1h->heap_region_containing(obj); |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
38 |
return mark_in_next_bitmap(hr, obj); |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
39 |
} |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
40 |
|
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
41 |
inline bool G1ConcurrentMark::mark_in_next_bitmap(HeapRegion* const hr, oop const obj) { |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
42 |
assert(hr != NULL, "just checking"); |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
43 |
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
|
44 |
|
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
45 |
if (hr->obj_allocated_since_next_marking(obj)) { |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
46 |
return false; |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
47 |
} |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
48 |
|
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
49 |
// 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
|
50 |
// 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
|
51 |
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
|
52 |
|
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
53 |
HeapWord* const obj_addr = (HeapWord*)obj; |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
54 |
// Dirty read to avoid CAS. |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
55 |
if (_nextMarkBitMap->is_marked(obj_addr)) { |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
56 |
return false; |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
57 |
} |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
58 |
|
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
59 |
return _nextMarkBitMap->par_mark(obj_addr); |
11584
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11583
diff
changeset
|
60 |
} |
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11583
diff
changeset
|
61 |
|
41176
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
62 |
#ifndef PRODUCT |
31994
3721b7aa3a0d
8079082: VerifyNoCSetOopsClosure is derived twice from Closure
kbarrett
parents:
31592
diff
changeset
|
63 |
template<typename Fn> |
41176
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
64 |
inline void G1CMMarkStack::iterate(Fn fn) const { |
39966
43c7f35b800e
8160897: Concurrent mark mark stack memory allocation leaks memory
tschatzl
parents:
37414
diff
changeset
|
65 |
assert_at_safepoint(true); |
41176
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
66 |
|
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
67 |
size_t num_chunks = 0; |
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
68 |
|
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
69 |
TaskQueueEntryChunk* cur = _chunk_list; |
41176
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
70 |
while (cur != NULL) { |
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
71 |
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
|
72 |
|
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
73 |
for (size_t i = 0; i < EntriesPerChunk; ++i) { |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
74 |
if (cur->data[i].is_null()) { |
41176
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
75 |
break; |
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
76 |
} |
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
77 |
fn(cur->data[i]); |
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
78 |
} |
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
79 |
cur = cur->next; |
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
80 |
num_chunks++; |
31994
3721b7aa3a0d
8079082: VerifyNoCSetOopsClosure is derived twice from Closure
kbarrett
parents:
31592
diff
changeset
|
81 |
} |
3721b7aa3a0d
8079082: VerifyNoCSetOopsClosure is derived twice from Closure
kbarrett
parents:
31592
diff
changeset
|
82 |
} |
41176
ff9f64534cff
8159422: Very high Concurrent Mark mark stack contention
tschatzl
parents:
39966
diff
changeset
|
83 |
#endif |
31994
3721b7aa3a0d
8079082: VerifyNoCSetOopsClosure is derived twice from Closure
kbarrett
parents:
31592
diff
changeset
|
84 |
|
32350
fec57eb3f599
8133121: Move implementation of process_grey_object to concurrentMark.inline.hpp
asiebenborn
parents:
31994
diff
changeset
|
85 |
// It scans an object and visits its children. |
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
86 |
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
|
87 |
|
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
88 |
inline void G1CMTask::push(G1TaskQueueEntry task_entry) { |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
89 |
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
|
90 |
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
|
91 |
_g1h->heap_region_containing(task_entry.obj())), "invariant"); |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
92 |
assert(task_entry.is_array_slice() || !_g1h->is_obj_ill(task_entry.obj()), "invariant"); // FIXME!!! |
46750 | 93 |
assert(task_entry.is_array_slice() || _nextMarkBitMap->is_marked((HeapWord*)task_entry.obj()), "invariant"); |
9994 | 94 |
|
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
95 |
if (!_task_queue->push(task_entry)) { |
9994 | 96 |
// The local task queue looks full. We need to push some entries |
97 |
// to the global stack. |
|
98 |
move_entries_to_global_stack(); |
|
99 |
||
100 |
// this should succeed since, even if we overflow the global |
|
101 |
// stack, we should have definitely removed some entries from the |
|
102 |
// local queue. So, there must be space on it. |
|
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
103 |
bool success = _task_queue->push(task_entry); |
9994 | 104 |
assert(success, "invariant"); |
105 |
} |
|
106 |
} |
|
107 |
||
35943
e726308008c0
8148973: Rename g1/concurrentMark.{hpp,cpp,inline.hpp} to g1/g1ConcurrentMark.{hpp,cpp,inline.hpp}
ehelin
parents:
35862
diff
changeset
|
108 |
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
|
109 |
// If obj is above the global finger, then the mark bitmap scan |
30162 | 110 |
// 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
|
111 |
// a current region and obj is between the local finger and the |
30162 | 112 |
// end of the current region, then no push is needed. The tradeoff |
113 |
// of checking both vs only checking the global finger is that the |
|
114 |
// local check will be more accurate and so result in fewer pushes, |
|
115 |
// but may also be a little slower. |
|
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30566
diff
changeset
|
116 |
HeapWord* objAddr = (HeapWord*)obj; |
30162 | 117 |
if (_finger != NULL) { |
118 |
// We have a current region. |
|
9994 | 119 |
|
30162 | 120 |
// Finger and region values are all NULL or all non-NULL. We |
121 |
// use _finger to check since we immediately use its value. |
|
122 |
assert(_curr_region != NULL, "invariant"); |
|
123 |
assert(_region_limit != NULL, "invariant"); |
|
124 |
assert(_region_limit <= global_finger, "invariant"); |
|
125 |
||
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30566
diff
changeset
|
126 |
// True if obj is less than the local finger, or is between |
30162 | 127 |
// the region limit and the global finger. |
128 |
if (objAddr < _finger) { |
|
129 |
return true; |
|
130 |
} else if (objAddr < _region_limit) { |
|
131 |
return false; |
|
132 |
} // Else check global finger. |
|
133 |
} |
|
134 |
// Check global finger. |
|
135 |
return objAddr < global_finger; |
|
136 |
} |
|
9994 | 137 |
|
32350
fec57eb3f599
8133121: Move implementation of process_grey_object to concurrentMark.inline.hpp
asiebenborn
parents:
31994
diff
changeset
|
138 |
template<bool scan> |
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
139 |
inline void G1CMTask::process_grey_task_entry(G1TaskQueueEntry task_entry) { |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
140 |
assert(scan || (task_entry.is_oop() && task_entry.obj()->is_typeArray()), "Skipping scan of grey non-typeArray"); |
46750 | 141 |
assert(task_entry.is_array_slice() || _nextMarkBitMap->is_marked((HeapWord*)task_entry.obj()), |
42597
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
41176
diff
changeset
|
142 |
"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
|
143 |
|
fec57eb3f599
8133121: Move implementation of process_grey_object to concurrentMark.inline.hpp
asiebenborn
parents:
31994
diff
changeset
|
144 |
if (scan) { |
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
145 |
if (task_entry.is_array_slice()) { |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
146 |
_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
|
147 |
} else { |
46328
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
148 |
oop obj = task_entry.obj(); |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
149 |
if (G1CMObjArrayProcessor::should_be_sliced(obj)) { |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
150 |
_words_scanned += _objArray_processor.process_obj(obj); |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
151 |
} else { |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
152 |
_words_scanned += obj->oop_iterate_size(_cm_oop_closure);; |
6061df52d610
8168467: Use TaskEntry as task mark queue elements
tschatzl
parents:
42597
diff
changeset
|
153 |
} |
42597
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
41176
diff
changeset
|
154 |
} |
32350
fec57eb3f599
8133121: Move implementation of process_grey_object to concurrentMark.inline.hpp
asiebenborn
parents:
31994
diff
changeset
|
155 |
} |
fec57eb3f599
8133121: Move implementation of process_grey_object to concurrentMark.inline.hpp
asiebenborn
parents:
31994
diff
changeset
|
156 |
check_limits(); |
fec57eb3f599
8133121: Move implementation of process_grey_object to concurrentMark.inline.hpp
asiebenborn
parents:
31994
diff
changeset
|
157 |
} |
fec57eb3f599
8133121: Move implementation of process_grey_object to concurrentMark.inline.hpp
asiebenborn
parents:
31994
diff
changeset
|
158 |
|
42597
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
41176
diff
changeset
|
159 |
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
|
160 |
obj->oop_iterate(_cm_oop_closure, mr); |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
41176
diff
changeset
|
161 |
return mr.word_size(); |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
41176
diff
changeset
|
162 |
} |
a9611bab7578
8057003: Large reference arrays cause extremely long synchronization times
tschatzl
parents:
41176
diff
changeset
|
163 |
|
37413
2f71679d06dd
8077144: Concurrent mark initialization takes too long
tschatzl
parents:
35943
diff
changeset
|
164 |
inline void G1CMTask::make_reference_grey(oop obj) { |
46752
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
165 |
if (!_cm->mark_in_next_bitmap(obj)) { |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
166 |
return; |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
167 |
} |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
168 |
|
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
169 |
// 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
|
170 |
// CAS done in G1CMBitMap::parMark() call in the routine above. |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
171 |
HeapWord* global_finger = _cm->finger(); |
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30566
diff
changeset
|
172 |
|
46752
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
173 |
// 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
|
174 |
// 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
|
175 |
// scan has already examined. Mark bitmap scanning |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
176 |
// maintains progress "fingers" for determining that. |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
177 |
// |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
178 |
// Notice that the global finger might be moving forward |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
179 |
// 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
|
180 |
// 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
|
181 |
// 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
|
182 |
// past this object. In this case, the object will probably |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
183 |
// 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
|
184 |
// 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
|
185 |
// correctness problems. |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
186 |
if (is_below_finger(obj, global_finger)) { |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
187 |
G1TaskQueueEntry entry = G1TaskQueueEntry::from_oop(obj); |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
188 |
if (obj->is_typeArray()) { |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
189 |
// Immediately process arrays of primitive types, rather |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
190 |
// than pushing on the mark stack. This keeps us from |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
191 |
// adding humongous objects to the mark stack that might |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
192 |
// be reclaimed before the entry is processed - see |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
193 |
// selection of candidates for eager reclaim of humongous |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
194 |
// objects. The cost of the additional type test is |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
195 |
// mitigated by avoiding a trip through the mark stack, |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
196 |
// by only doing a bookkeeping update and avoiding the |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
197 |
// actual scan of the object - a typeArray contains no |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
198 |
// references, and the metadata is built-in. |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
199 |
process_grey_task_entry<false>(entry); |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
200 |
} else { |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
201 |
push(entry); |
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30566
diff
changeset
|
202 |
} |
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30566
diff
changeset
|
203 |
} |
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30566
diff
changeset
|
204 |
} |
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30566
diff
changeset
|
205 |
|
35943
e726308008c0
8148973: Rename g1/concurrentMark.{hpp,cpp,inline.hpp} to g1/g1ConcurrentMark.{hpp,cpp,inline.hpp}
ehelin
parents:
35862
diff
changeset
|
206 |
inline void G1CMTask::deal_with_reference(oop obj) { |
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30566
diff
changeset
|
207 |
increment_refs_reached(); |
46752
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
208 |
if (obj == NULL) { |
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
209 |
return; |
9994 | 210 |
} |
46752
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46751
diff
changeset
|
211 |
make_reference_grey(obj); |
9994 | 212 |
} |
213 |
||
35943
e726308008c0
8148973: Rename g1/concurrentMark.{hpp,cpp,inline.hpp} to g1/g1ConcurrentMark.{hpp,cpp,inline.hpp}
ehelin
parents:
35862
diff
changeset
|
214 |
inline void G1ConcurrentMark::markPrev(oop p) { |
46750 | 215 |
assert(!_prevMarkBitMap->is_marked((HeapWord*) p), "sanity"); |
216 |
_prevMarkBitMap->mark((HeapWord*) p); |
|
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
9999
diff
changeset
|
217 |
} |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
9999
diff
changeset
|
218 |
|
35943
e726308008c0
8148973: Rename g1/concurrentMark.{hpp,cpp,inline.hpp} to g1/g1ConcurrentMark.{hpp,cpp,inline.hpp}
ehelin
parents:
35862
diff
changeset
|
219 |
bool G1ConcurrentMark::isPrevMarked(oop p) const { |
46968
9119841280f4
8160399: is_oop_or_null involves undefined behavior
coleenp
parents:
46800
diff
changeset
|
220 |
assert(p != NULL && oopDesc::is_oop(p), "expected an oop"); |
46750 | 221 |
return _prevMarkBitMap->is_marked((HeapWord*)p); |
35862
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
34282
diff
changeset
|
222 |
} |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
34282
diff
changeset
|
223 |
|
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37413
diff
changeset
|
224 |
inline bool G1ConcurrentMark::do_yield_check() { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37413
diff
changeset
|
225 |
if (SuspendibleThreadSet::should_yield()) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37413
diff
changeset
|
226 |
SuspendibleThreadSet::yield(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37413
diff
changeset
|
227 |
return true; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37413
diff
changeset
|
228 |
} else { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37413
diff
changeset
|
229 |
return false; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37413
diff
changeset
|
230 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37413
diff
changeset
|
231 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37413
diff
changeset
|
232 |
|
35943
e726308008c0
8148973: Rename g1/concurrentMark.{hpp,cpp,inline.hpp} to g1/g1ConcurrentMark.{hpp,cpp,inline.hpp}
ehelin
parents:
35862
diff
changeset
|
233 |
#endif // SHARE_VM_GC_G1_G1CONCURRENTMARK_INLINE_HPP |