author | tschatzl |
Wed, 18 Apr 2018 11:36:48 +0200 | |
changeset 49806 | 2d62570a615c |
parent 49744 | 5dcc893ad119 |
child 49911 | 358be4680d12 |
permissions | -rw-r--r-- |
1374 | 1 |
/* |
49606
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49592
diff
changeset
|
2 |
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. |
1374 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4902
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4902
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4902
diff
changeset
|
21 |
* questions. |
1374 | 22 |
* |
23 |
*/ |
|
24 |
||
30764 | 25 |
#ifndef SHARE_VM_GC_G1_G1OOPCLOSURES_INLINE_HPP |
26 |
#define SHARE_VM_GC_G1_G1OOPCLOSURES_INLINE_HPP |
|
7397 | 27 |
|
30764 | 28 |
#include "gc/g1/g1CollectedHeap.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.inline.hpp" |
30764 | 30 |
#include "gc/g1/g1OopClosures.hpp" |
31 |
#include "gc/g1/g1ParScanThreadState.inline.hpp" |
|
32 |
#include "gc/g1/g1RemSet.hpp" |
|
32185
49a57ff2c3cb
8073052: Rename and clean up the allocation manager hierarchy in g1Allocator.?pp
tschatzl
parents:
31592
diff
changeset
|
33 |
#include "gc/g1/heapRegion.inline.hpp" |
30764 | 34 |
#include "gc/g1/heapRegionRemSet.hpp" |
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
35 |
#include "memory/iterator.inline.hpp" |
48633
2569f227ae8e
8129440: G1 crash during concurrent root region scan
tschatzl
parents:
47885
diff
changeset
|
36 |
#include "oops/access.inline.hpp" |
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49337
diff
changeset
|
37 |
#include "oops/compressedOops.inline.hpp" |
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49337
diff
changeset
|
38 |
#include "oops/oopsHierarchy.hpp" |
49722
a47d1e21b3f1
8199735: Mark word updates need to use Access API
rkennke
parents:
49607
diff
changeset
|
39 |
#include "oops/oop.inline.hpp" |
24487
71ff0bd674eb
8042737: Introduce umbrella header prefetch.inline.hpp
goetz
parents:
24424
diff
changeset
|
40 |
#include "runtime/prefetch.inline.hpp" |
7397 | 41 |
|
11584
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11202
diff
changeset
|
42 |
template <class T> |
46572 | 43 |
inline void G1ScanClosureBase::prefetch_and_push(T* p, const oop obj) { |
44 |
// We're not going to even bother checking whether the object is |
|
45 |
// already forwarded or not, as this usually causes an immediate |
|
46 |
// stall. We'll try to prefetch the object (for write, given that |
|
47 |
// we might need to install the forwarding reference) and we'll |
|
48 |
// get back to it when pop it from the queue |
|
49722
a47d1e21b3f1
8199735: Mark word updates need to use Access API
rkennke
parents:
49607
diff
changeset
|
49 |
Prefetch::write(obj->mark_addr_raw(), 0); |
a47d1e21b3f1
8199735: Mark word updates need to use Access API
rkennke
parents:
49607
diff
changeset
|
50 |
Prefetch::read(obj->mark_addr_raw(), (HeapWordSize*2)); |
3262
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
1374
diff
changeset
|
51 |
|
46572 | 52 |
// slightly paranoid test; I'm trying to catch potential |
53 |
// problems before we go into push_on_queue to know where the |
|
54 |
// problem is coming from |
|
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49337
diff
changeset
|
55 |
assert((obj == RawAccess<>::oop_load(p)) || |
46572 | 56 |
(obj->is_forwarded() && |
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49337
diff
changeset
|
57 |
obj->forwardee() == RawAccess<>::oop_load(p)), |
46572 | 58 |
"p should still be pointing to obj or to its forwardee"); |
11202
6be05533238b
7114095: G1: assert(obj == oopDesc::load_decode_heap_oop(p)) failed: p should still be pointing to obj
johnc
parents:
9994
diff
changeset
|
59 |
|
46572 | 60 |
_par_scan_state->push_on_queue(p); |
61 |
} |
|
62 |
||
63 |
template <class T> |
|
64 |
inline void G1ScanClosureBase::handle_non_cset_obj_common(InCSetState const state, T* p, oop const obj) { |
|
65 |
if (state.is_humongous()) { |
|
49806 | 66 |
_g1h->set_humongous_is_live(obj); |
1374 | 67 |
} |
68 |
} |
|
4902
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
3262
diff
changeset
|
69 |
|
11584
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11202
diff
changeset
|
70 |
template <class T> |
46572 | 71 |
inline void G1ScanEvacuatedObjClosure::do_oop_nv(T* p) { |
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49337
diff
changeset
|
72 |
T heap_oop = RawAccess<>::oop_load(p); |
4902
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
3262
diff
changeset
|
73 |
|
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49337
diff
changeset
|
74 |
if (CompressedOops::is_null(heap_oop)) { |
46572 | 75 |
return; |
76 |
} |
|
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49337
diff
changeset
|
77 |
oop obj = CompressedOops::decode_not_null(heap_oop); |
49806 | 78 |
const InCSetState state = _g1h->in_cset_state(obj); |
46572 | 79 |
if (state.is_in_cset()) { |
80 |
prefetch_and_push(p, obj); |
|
81 |
} else { |
|
46646
5165b3a5b44a
8183397: Ensure consistent closure filtering during evacuation
tschatzl
parents:
46572
diff
changeset
|
82 |
if (HeapRegion::is_in_same_region(p, obj)) { |
5165b3a5b44a
8183397: Ensure consistent closure filtering during evacuation
tschatzl
parents:
46572
diff
changeset
|
83 |
return; |
5165b3a5b44a
8183397: Ensure consistent closure filtering during evacuation
tschatzl
parents:
46572
diff
changeset
|
84 |
} |
46572 | 85 |
handle_non_cset_obj_common(state, p, obj); |
86 |
_par_scan_state->update_rs(_from, p, obj); |
|
4902
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
3262
diff
changeset
|
87 |
} |
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
3262
diff
changeset
|
88 |
} |
6247 | 89 |
|
11584
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11202
diff
changeset
|
90 |
template <class T> |
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11202
diff
changeset
|
91 |
inline void G1CMOopClosure::do_oop_nv(T* p) { |
49606
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49592
diff
changeset
|
92 |
_task->deal_with_reference(p); |
9994 | 93 |
} |
7397 | 94 |
|
11584
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11202
diff
changeset
|
95 |
template <class T> |
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11202
diff
changeset
|
96 |
inline void G1RootRegionScanClosure::do_oop_nv(T* p) { |
48633
2569f227ae8e
8129440: G1 crash during concurrent root region scan
tschatzl
parents:
47885
diff
changeset
|
97 |
T heap_oop = RawAccess<MO_VOLATILE>::oop_load(p); |
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49337
diff
changeset
|
98 |
if (CompressedOops::is_null(heap_oop)) { |
46752
a2b799e3f0be
8184348: Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
tschatzl
parents:
46670
diff
changeset
|
99 |
return; |
11584
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11202
diff
changeset
|
100 |
} |
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49337
diff
changeset
|
101 |
oop obj = CompressedOops::decode_not_null(heap_oop); |
49606
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49592
diff
changeset
|
102 |
_cm->mark_in_next_bitmap(_worker_id, obj); |
11584
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11202
diff
changeset
|
103 |
} |
e1df4d08a1f4
7127706: G1: re-enable survivors during the initial-mark pause
tonyp
parents:
11202
diff
changeset
|
104 |
|
11586
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11584
diff
changeset
|
105 |
template <class T> |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
106 |
inline static void check_obj_during_refinement(T* p, oop const obj) { |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
107 |
#ifdef ASSERT |
49806 | 108 |
G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
109 |
// can't do because of races |
46968
9119841280f4
8160399: is_oop_or_null involves undefined behavior
coleenp
parents:
46752
diff
changeset
|
110 |
// assert(oopDesc::is_oop_or_null(obj), "expected an oop"); |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
111 |
assert(check_obj_alignment(obj), "not oop aligned"); |
49806 | 112 |
assert(g1h->is_in_reserved(obj), "must be in heap"); |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
113 |
|
49806 | 114 |
HeapRegion* from = g1h->heap_region_containing(p); |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
115 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
116 |
assert(from != NULL, "from region must be non-NULL"); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
117 |
assert(from->is_in_reserved(p) || |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
118 |
(from->is_humongous() && |
49806 | 119 |
g1h->heap_region_containing(p)->is_humongous() && |
120 |
from->humongous_start_region() == g1h->heap_region_containing(p)->humongous_start_region()), |
|
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
121 |
"p " PTR_FORMAT " is not in the same region %u or part of the correct humongous object starting at region %u.", |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
122 |
p2i(p), from->hrm_index(), from->humongous_start_region()->hrm_index()); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
123 |
#endif // ASSERT |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
124 |
} |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
125 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
126 |
template <class T> |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
127 |
inline void G1ConcurrentRefineOopClosure::do_oop_nv(T* p) { |
48633
2569f227ae8e
8129440: G1 crash during concurrent root region scan
tschatzl
parents:
47885
diff
changeset
|
128 |
T o = RawAccess<MO_VOLATILE>::oop_load(p); |
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49337
diff
changeset
|
129 |
if (CompressedOops::is_null(o)) { |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
130 |
return; |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
131 |
} |
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49337
diff
changeset
|
132 |
oop obj = CompressedOops::decode_not_null(o); |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
133 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
134 |
check_obj_during_refinement(p, obj); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
135 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
136 |
if (HeapRegion::is_in_same_region(p, obj)) { |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
137 |
// Normally this closure should only be called with cross-region references. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
138 |
// But since Java threads are manipulating the references concurrently and we |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
139 |
// reload the values things may have changed. |
46572 | 140 |
// Also this check lets slip through references from a humongous continues region |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
141 |
// to its humongous start region, as they are in different regions, and adds a |
46572 | 142 |
// remembered set entry. This is benign (apart from memory usage), as we never |
143 |
// try to either evacuate or eager reclaim humonguous arrays of j.l.O. |
|
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
144 |
return; |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
145 |
} |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
146 |
|
49806 | 147 |
HeapRegionRemSet* to_rem_set = _g1h->heap_region_containing(obj)->rem_set(); |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
148 |
|
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
149 |
assert(to_rem_set != NULL, "Need per-region 'into' remsets."); |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
150 |
if (to_rem_set->is_tracked()) { |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
151 |
to_rem_set->add_reference(p, _worker_i); |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
152 |
} |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
153 |
} |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
154 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46307
diff
changeset
|
155 |
template <class T> |
46572 | 156 |
inline void G1ScanObjsDuringUpdateRSClosure::do_oop_nv(T* p) { |
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49337
diff
changeset
|
157 |
T o = RawAccess<>::oop_load(p); |
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49337
diff
changeset
|
158 |
if (CompressedOops::is_null(o)) { |
24106
dae9277bdf2a
8040722: G1: Clean up usages of heap_region_containing
brutisso
parents:
22905
diff
changeset
|
159 |
return; |
dae9277bdf2a
8040722: G1: Clean up usages of heap_region_containing
brutisso
parents:
22905
diff
changeset
|
160 |
} |
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49337
diff
changeset
|
161 |
oop obj = CompressedOops::decode_not_null(o); |
11586
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11584
diff
changeset
|
162 |
|
46572 | 163 |
check_obj_during_refinement(p, obj); |
11586
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11584
diff
changeset
|
164 |
|
49806 | 165 |
assert(!_g1h->is_in_cset((HeapWord*)p), "Oop originates from " PTR_FORMAT " (region: %u) which is in the collection set.", p2i(p), _g1h->addr_to_region((HeapWord*)p)); |
166 |
const InCSetState state = _g1h->in_cset_state(obj); |
|
46572 | 167 |
if (state.is_in_cset()) { |
168 |
// Since the source is always from outside the collection set, here we implicitly know |
|
169 |
// that this is a cross-region reference too. |
|
170 |
prefetch_and_push(p, obj); |
|
171 |
} else { |
|
49806 | 172 |
HeapRegion* to = _g1h->heap_region_containing(obj); |
46572 | 173 |
if (_from == to) { |
174 |
return; |
|
11586
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11584
diff
changeset
|
175 |
} |
46572 | 176 |
handle_non_cset_obj_common(state, p, obj); |
13333
f51af0093d29
7173712: G1: Duplicated code in G1UpdateRSOrPushRefOopClosure::do_oop_nv()
johnc
parents:
11586
diff
changeset
|
177 |
to->rem_set()->add_reference(p, _worker_i); |
11586
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11584
diff
changeset
|
178 |
} |
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11584
diff
changeset
|
179 |
} |
46572 | 180 |
|
181 |
template <class T> |
|
182 |
inline void G1ScanObjsDuringScanRSClosure::do_oop_nv(T* p) { |
|
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49337
diff
changeset
|
183 |
T heap_oop = RawAccess<>::oop_load(p); |
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49337
diff
changeset
|
184 |
if (CompressedOops::is_null(heap_oop)) { |
46572 | 185 |
return; |
186 |
} |
|
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49337
diff
changeset
|
187 |
oop obj = CompressedOops::decode_not_null(heap_oop); |
46572 | 188 |
|
49806 | 189 |
const InCSetState state = _g1h->in_cset_state(obj); |
46572 | 190 |
if (state.is_in_cset()) { |
191 |
prefetch_and_push(p, obj); |
|
192 |
} else { |
|
46646
5165b3a5b44a
8183397: Ensure consistent closure filtering during evacuation
tschatzl
parents:
46572
diff
changeset
|
193 |
if (HeapRegion::is_in_same_region(p, obj)) { |
5165b3a5b44a
8183397: Ensure consistent closure filtering during evacuation
tschatzl
parents:
46572
diff
changeset
|
194 |
return; |
5165b3a5b44a
8183397: Ensure consistent closure filtering during evacuation
tschatzl
parents:
46572
diff
changeset
|
195 |
} |
46572 | 196 |
handle_non_cset_obj_common(state, p, obj); |
197 |
} |
|
198 |
} |
|
11586
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11584
diff
changeset
|
199 |
|
47580 | 200 |
void G1ParCopyHelper::do_cld_barrier(oop new_obj) { |
49806 | 201 |
if (_g1h->heap_region_containing(new_obj)->is_young()) { |
47580 | 202 |
_scanned_cld->record_modified_oops(); |
33213
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
203 |
} |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
204 |
} |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
205 |
|
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
206 |
void G1ParCopyHelper::mark_object(oop obj) { |
49806 | 207 |
assert(!_g1h->heap_region_containing(obj)->in_collection_set(), "should not mark objects in the CSet"); |
33213
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
208 |
|
49606
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49592
diff
changeset
|
209 |
// We know that the object is not moving so it's safe to read its size. |
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49592
diff
changeset
|
210 |
_cm->mark_in_next_bitmap(_worker_id, obj); |
33213
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
211 |
} |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
212 |
|
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
213 |
void G1ParCopyHelper::mark_forwarded_object(oop from_obj, oop to_obj) { |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
214 |
assert(from_obj->is_forwarded(), "from obj should be forwarded"); |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
215 |
assert(from_obj->forwardee() == to_obj, "to obj should be the forwardee"); |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
216 |
assert(from_obj != to_obj, "should not be self-forwarded"); |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
217 |
|
49806 | 218 |
assert(_g1h->heap_region_containing(from_obj)->in_collection_set(), "from obj should be in the CSet"); |
219 |
assert(!_g1h->heap_region_containing(to_obj)->in_collection_set(), "should not mark objects in the CSet"); |
|
33213
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
220 |
|
49606
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49592
diff
changeset
|
221 |
// The object might be in the process of being copied by another |
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49592
diff
changeset
|
222 |
// worker so we cannot trust that its to-space image is |
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49592
diff
changeset
|
223 |
// well-formed. So we have to read its size from its from-space |
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49592
diff
changeset
|
224 |
// image which we know should not be changing. |
9ae8719efcae
8197850: Calculate liveness in regions during marking
tschatzl
parents:
49592
diff
changeset
|
225 |
_cm->mark_in_next_bitmap(_worker_id, to_obj, from_obj->size()); |
33213
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
226 |
} |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
227 |
|
49337
e4fdca451542
8197847: Remove unused file g1ParScanThreadState_ext.cpp
ehelin
parents:
48633
diff
changeset
|
228 |
template <G1Barrier barrier, G1Mark do_mark_object> |
33213
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
229 |
template <class T> |
49337
e4fdca451542
8197847: Remove unused file g1ParScanThreadState_ext.cpp
ehelin
parents:
48633
diff
changeset
|
230 |
void G1ParCopyClosure<barrier, do_mark_object>::do_oop_work(T* p) { |
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49337
diff
changeset
|
231 |
T heap_oop = RawAccess<>::oop_load(p); |
33213
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
232 |
|
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49337
diff
changeset
|
233 |
if (CompressedOops::is_null(heap_oop)) { |
33213
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
234 |
return; |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
235 |
} |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
236 |
|
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49337
diff
changeset
|
237 |
oop obj = CompressedOops::decode_not_null(heap_oop); |
33213
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
238 |
|
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
239 |
assert(_worker_id == _par_scan_state->worker_id(), "sanity"); |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
240 |
|
49806 | 241 |
const InCSetState state = _g1h->in_cset_state(obj); |
33213
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
242 |
if (state.is_in_cset()) { |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
243 |
oop forwardee; |
49722
a47d1e21b3f1
8199735: Mark word updates need to use Access API
rkennke
parents:
49607
diff
changeset
|
244 |
markOop m = obj->mark_raw(); |
33213
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
245 |
if (m->is_marked()) { |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
246 |
forwardee = (oop) m->decode_pointer(); |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
247 |
} else { |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
248 |
forwardee = _par_scan_state->copy_to_survivor_space(state, obj, m); |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
249 |
} |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
250 |
assert(forwardee != NULL, "forwardee should not be NULL"); |
49744
5dcc893ad119
8200233: Simple G1 evacuation path performance enhancements
tschatzl
parents:
49722
diff
changeset
|
251 |
RawAccess<OOP_NOT_NULL>::oop_store(p, forwardee); |
33213
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
252 |
if (do_mark_object != G1MarkNone && forwardee != obj) { |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
253 |
// If the object is self-forwarded we don't need to explicitly |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
254 |
// mark it, the evacuation failure protocol will do so. |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
255 |
mark_forwarded_object(obj, forwardee); |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
256 |
} |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
257 |
|
47580 | 258 |
if (barrier == G1BarrierCLD) { |
259 |
do_cld_barrier(forwardee); |
|
33213
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
260 |
} |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
261 |
} else { |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
262 |
if (state.is_humongous()) { |
49806 | 263 |
_g1h->set_humongous_is_live(obj); |
33213
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
264 |
} |
35051
002d874a4284
8144714: Add extension point to G1 evacuation closures
mgerdin
parents:
34616
diff
changeset
|
265 |
|
33213
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
266 |
// The object is not in collection set. If we're a root scanning |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
267 |
// closure during an initial mark pause then attempt to mark the object. |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
268 |
if (do_mark_object == G1MarkFromRoot) { |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
269 |
mark_object(obj); |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
270 |
} |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
271 |
} |
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
32185
diff
changeset
|
272 |
} |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
273 |
|
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
274 |
template <class T> void G1RebuildRemSetClosure::do_oop_nv(T* p) { |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
275 |
oop const obj = RawAccess<MO_VOLATILE>::oop_load(p); |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
276 |
if (obj == NULL) { |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
277 |
return; |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
278 |
} |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
279 |
|
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
280 |
if (HeapRegion::is_in_same_region(p, obj)) { |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
281 |
return; |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
282 |
} |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
283 |
|
49806 | 284 |
HeapRegion* to = _g1h->heap_region_containing(obj); |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
285 |
HeapRegionRemSet* rem_set = to->rem_set(); |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
286 |
rem_set->add_reference(p, _worker_id); |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
287 |
} |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49606
diff
changeset
|
288 |
|
30764 | 289 |
#endif // SHARE_VM_GC_G1_G1OOPCLOSURES_INLINE_HPP |