author | stefank |
Tue, 26 Nov 2019 10:47:46 +0100 | |
changeset 59290 | 97d13893ec3c |
parent 59270 | d5a1c6545a2b |
permissions | -rw-r--r-- |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1 |
/* |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, 2018, Red Hat, Inc. All rights reserved. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
3 |
* |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
4 |
* This code is free software; you can redistribute it and/or modify it |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
5 |
* under the terms of the GNU General Public License version 2 only, as |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
6 |
* published by the Free Software Foundation. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
7 |
* |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
8 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
9 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
10 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
11 |
* version 2 for more details (a copy is included in the LICENSE file that |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
12 |
* accompanied this code). |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
13 |
* |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License version |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
15 |
* 2 along with this work; if not, write to the Free Software Foundation, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
16 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
17 |
* |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
18 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
19 |
* or visit www.oracle.com if you need additional information or have any |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
20 |
* questions. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
21 |
* |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
22 |
*/ |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
23 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52925
diff
changeset
|
24 |
#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHBARRIERSET_INLINE_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52925
diff
changeset
|
25 |
#define SHARE_GC_SHENANDOAH_SHENANDOAHBARRIERSET_INLINE_HPP |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
26 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
27 |
#include "gc/shared/barrierSet.hpp" |
55681 | 28 |
#include "gc/shenandoah/shenandoahAsserts.hpp" |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
29 |
#include "gc/shenandoah/shenandoahBarrierSet.hpp" |
58218
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
30 |
#include "gc/shenandoah/shenandoahCollectionSet.inline.hpp" |
54766
1321f8cf9de5
8223567: Rename ShenandoahBrooksPointer to ShenandoahForwarding
rkennke
parents:
54425
diff
changeset
|
31 |
#include "gc/shenandoah/shenandoahForwarding.inline.hpp" |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
32 |
#include "gc/shenandoah/shenandoahHeap.inline.hpp" |
54383 | 33 |
#include "gc/shenandoah/shenandoahHeapRegion.hpp" |
34 |
#include "gc/shenandoah/shenandoahMarkingContext.inline.hpp" |
|
35 |
#include "gc/shenandoah/shenandoahThreadLocalData.hpp" |
|
58218
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
36 |
#include "memory/iterator.inline.hpp" |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
37 |
#include "oops/oop.inline.hpp" |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
38 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
39 |
inline oop ShenandoahBarrierSet::resolve_forwarded_not_null(oop p) { |
54766
1321f8cf9de5
8223567: Rename ShenandoahBrooksPointer to ShenandoahForwarding
rkennke
parents:
54425
diff
changeset
|
40 |
return ShenandoahForwarding::get_forwardee(p); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
41 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
42 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
43 |
inline oop ShenandoahBarrierSet::resolve_forwarded(oop p) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
44 |
if (((HeapWord*) p) != NULL) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
45 |
return resolve_forwarded_not_null(p); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
46 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
47 |
return p; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
48 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
49 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
50 |
|
59270
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
51 |
inline void ShenandoahBarrierSet::enqueue(oop obj) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
52 |
shenandoah_assert_not_forwarded_if(NULL, obj, _heap->is_concurrent_traversal_in_progress()); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
53 |
assert(_satb_mark_queue_set.is_active(), "only get here when SATB active"); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
54 |
|
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
55 |
// Filter marked objects before hitting the SATB queues. The same predicate would |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
56 |
// be used by SATBMQ::filter to eliminate already marked objects downstream, but |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
57 |
// filtering here helps to avoid wasteful SATB queueing work to begin with. |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
58 |
if (!_heap->requires_marking<false>(obj)) return; |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
59 |
|
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
60 |
ShenandoahThreadLocalData::satb_mark_queue(Thread::current()).enqueue_known_active(obj); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
61 |
} |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
62 |
|
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
63 |
template <DecoratorSet decorators, typename T> |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
64 |
inline void ShenandoahBarrierSet::satb_barrier(T *field) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
65 |
if (HasDecorator<decorators, IS_DEST_UNINITIALIZED>::value || |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
66 |
HasDecorator<decorators, AS_NO_KEEPALIVE>::value) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
67 |
return; |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
68 |
} |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
69 |
if (ShenandoahSATBBarrier && _heap->is_concurrent_mark_in_progress()) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
70 |
T heap_oop = RawAccess<>::oop_load(field); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
71 |
if (!CompressedOops::is_null(heap_oop)) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
72 |
enqueue(CompressedOops::decode(heap_oop)); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
73 |
} |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
74 |
} |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
75 |
} |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
76 |
|
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
77 |
inline void ShenandoahBarrierSet::satb_enqueue(oop value) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
78 |
assert(value != NULL, "checked before"); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
79 |
if (ShenandoahSATBBarrier && _heap->is_concurrent_mark_in_progress()) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
80 |
enqueue(value); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
81 |
} |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
82 |
} |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
83 |
|
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
84 |
inline void ShenandoahBarrierSet::storeval_barrier(oop obj) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
85 |
if (obj != NULL && ShenandoahStoreValEnqueueBarrier && _heap->is_concurrent_traversal_in_progress()) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
86 |
enqueue(obj); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
87 |
} |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
88 |
} |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
89 |
|
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
90 |
inline void ShenandoahBarrierSet::keep_alive_barrier(oop value) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
91 |
assert(value != NULL, "checked before"); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
92 |
if (ShenandoahKeepAliveBarrier && _heap->is_concurrent_mark_in_progress()) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
93 |
enqueue(value); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
94 |
} |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
95 |
} |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
96 |
|
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
97 |
inline void ShenandoahBarrierSet::keep_alive_if_weak(DecoratorSet decorators, oop value) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
98 |
assert((decorators & ON_UNKNOWN_OOP_REF) == 0, "Reference strength must be known"); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
99 |
const bool on_strong_oop_ref = (decorators & ON_STRONG_OOP_REF) != 0; |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
100 |
const bool peek = (decorators & AS_NO_KEEPALIVE) != 0; |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
101 |
if (!peek && !on_strong_oop_ref) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
102 |
keep_alive_barrier(value); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
103 |
} |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
104 |
} |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
105 |
|
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
106 |
template <DecoratorSet decorators> |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
107 |
inline void ShenandoahBarrierSet::keep_alive_if_weak(oop value) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
108 |
assert((decorators & ON_UNKNOWN_OOP_REF) == 0, "Reference strength must be known"); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
109 |
if (!HasDecorator<decorators, ON_STRONG_OOP_REF>::value && |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
110 |
!HasDecorator<decorators, AS_NO_KEEPALIVE>::value) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
111 |
keep_alive_barrier(value); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
112 |
} |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
113 |
} |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
114 |
|
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
115 |
template <DecoratorSet decorators, typename BarrierSetT> |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
116 |
template <typename T> |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
117 |
inline oop ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_load_not_in_heap(T* addr) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
118 |
oop value = Raw::oop_load_not_in_heap(addr); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
119 |
if (value != NULL) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
120 |
ShenandoahBarrierSet *const bs = ShenandoahBarrierSet::barrier_set(); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
121 |
value = bs->load_reference_barrier_native(value, addr); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
122 |
bs->keep_alive_if_weak<decorators>(value); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
123 |
} |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
124 |
return value; |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
125 |
} |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
126 |
|
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
127 |
template <DecoratorSet decorators, typename BarrierSetT> |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
128 |
template <typename T> |
54423 | 129 |
inline oop ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_load_in_heap(T* addr) { |
130 |
oop value = Raw::oop_load_in_heap(addr); |
|
59270
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
131 |
if (value != NULL) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
132 |
ShenandoahBarrierSet *const bs = ShenandoahBarrierSet::barrier_set(); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
133 |
value = bs->load_reference_barrier_not_null(value); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
134 |
bs->keep_alive_if_weak<decorators>(value); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
135 |
} |
54423 | 136 |
return value; |
137 |
} |
|
138 |
||
139 |
template <DecoratorSet decorators, typename BarrierSetT> |
|
140 |
inline oop ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_load_in_heap_at(oop base, ptrdiff_t offset) { |
|
141 |
oop value = Raw::oop_load_in_heap_at(base, offset); |
|
59270
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
142 |
if (value != NULL) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
143 |
ShenandoahBarrierSet *const bs = ShenandoahBarrierSet::barrier_set(); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
144 |
value = bs->load_reference_barrier_not_null(value); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
145 |
bs->keep_alive_if_weak(AccessBarrierSupport::resolve_possibly_unknown_oop_ref_strength<decorators>(base, offset), |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
146 |
value); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
147 |
} |
54423 | 148 |
return value; |
149 |
} |
|
150 |
||
151 |
template <DecoratorSet decorators, typename BarrierSetT> |
|
152 |
template <typename T> |
|
59270
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
153 |
inline void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_store_not_in_heap(T* addr, oop value) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
154 |
shenandoah_assert_marked_if(NULL, value, !CompressedOops::is_null(value) && ShenandoahHeap::heap()->is_evacuation_in_progress()); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
155 |
ShenandoahBarrierSet* const bs = ShenandoahBarrierSet::barrier_set(); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
156 |
bs->storeval_barrier(value); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
157 |
bs->satb_barrier<decorators>(addr); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
158 |
Raw::oop_store(addr, value); |
54423 | 159 |
} |
160 |
||
161 |
template <DecoratorSet decorators, typename BarrierSetT> |
|
162 |
template <typename T> |
|
163 |
inline void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_store_in_heap(T* addr, oop value) { |
|
59270
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
164 |
shenandoah_assert_not_in_cset_loc_except(addr, ShenandoahHeap::heap()->cancelled_gc()); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
165 |
shenandoah_assert_not_forwarded_except (addr, value, value == NULL || ShenandoahHeap::heap()->cancelled_gc() || !ShenandoahHeap::heap()->is_concurrent_mark_in_progress()); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
166 |
shenandoah_assert_not_in_cset_except (addr, value, value == NULL || ShenandoahHeap::heap()->cancelled_gc() || !ShenandoahHeap::heap()->is_concurrent_mark_in_progress()); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
167 |
|
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
168 |
oop_store_not_in_heap(addr, value); |
54423 | 169 |
} |
170 |
||
171 |
template <DecoratorSet decorators, typename BarrierSetT> |
|
172 |
inline void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_store_in_heap_at(oop base, ptrdiff_t offset, oop value) { |
|
173 |
oop_store_in_heap(AccessInternal::oop_field_addr<decorators>(base, offset), value); |
|
174 |
} |
|
175 |
||
176 |
template <DecoratorSet decorators, typename BarrierSetT> |
|
177 |
template <typename T> |
|
59270
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
178 |
inline oop ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_cmpxchg_not_in_heap(T* addr, oop compare_value, oop new_value) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
179 |
ShenandoahBarrierSet* bs = ShenandoahBarrierSet::barrier_set(); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
180 |
bs->storeval_barrier(new_value); |
55681 | 181 |
|
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
182 |
oop res; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
183 |
oop expected = compare_value; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
184 |
do { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
185 |
compare_value = expected; |
59252
623722a6aeb9
8234740: Harmonize parameter order in Atomic - cmpxchg
stefank
parents:
59251
diff
changeset
|
186 |
res = Raw::oop_atomic_cmpxchg(addr, compare_value, new_value); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
187 |
expected = res; |
58177 | 188 |
} while ((compare_value != expected) && (resolve_forwarded(compare_value) == resolve_forwarded(expected))); |
59270
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
189 |
|
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
190 |
// Note: We don't need a keep-alive-barrier here. We already enqueue any loaded reference for SATB anyway, |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
191 |
// because it must be the previous value. |
54423 | 192 |
if (res != NULL) { |
59270
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
193 |
res = ShenandoahBarrierSet::barrier_set()->load_reference_barrier_not_null(res); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
194 |
bs->satb_enqueue(res); |
54423 | 195 |
} |
59270
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
196 |
return res; |
54423 | 197 |
} |
198 |
||
199 |
template <DecoratorSet decorators, typename BarrierSetT> |
|
200 |
template <typename T> |
|
59252
623722a6aeb9
8234740: Harmonize parameter order in Atomic - cmpxchg
stefank
parents:
59251
diff
changeset
|
201 |
inline oop ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_cmpxchg_in_heap(T* addr, oop compare_value, oop new_value) { |
59270
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
202 |
return oop_atomic_cmpxchg_not_in_heap(addr, compare_value, new_value); |
54423 | 203 |
} |
204 |
||
205 |
template <DecoratorSet decorators, typename BarrierSetT> |
|
59252
623722a6aeb9
8234740: Harmonize parameter order in Atomic - cmpxchg
stefank
parents:
59251
diff
changeset
|
206 |
inline oop ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_cmpxchg_in_heap_at(oop base, ptrdiff_t offset, oop compare_value, oop new_value) { |
59270
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
207 |
return oop_atomic_cmpxchg_in_heap(AccessInternal::oop_field_addr<decorators>(base, offset), compare_value, new_value); |
54423 | 208 |
} |
209 |
||
210 |
template <DecoratorSet decorators, typename BarrierSetT> |
|
211 |
template <typename T> |
|
59251
4cbfa5077d68
8234739: Harmonize parameter order in Atomic - xchg
stefank
parents:
58710
diff
changeset
|
212 |
inline oop ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_xchg_not_in_heap(T* addr, oop new_value) { |
59270
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
213 |
ShenandoahBarrierSet* bs = ShenandoahBarrierSet::barrier_set(); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
214 |
bs->storeval_barrier(new_value); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
215 |
|
59251
4cbfa5077d68
8234739: Harmonize parameter order in Atomic - xchg
stefank
parents:
58710
diff
changeset
|
216 |
oop previous = Raw::oop_atomic_xchg(addr, new_value); |
54423 | 217 |
|
59270
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
218 |
// Note: We don't need a keep-alive-barrier here. We already enqueue any loaded reference for SATB anyway, |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
219 |
// because it must be the previous value. |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
220 |
if (previous != NULL) { |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
221 |
previous = ShenandoahBarrierSet::barrier_set()->load_reference_barrier_not_null(previous); |
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
222 |
bs->satb_enqueue(previous); |
54423 | 223 |
} |
59270
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
224 |
return previous; |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
225 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
226 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
227 |
template <DecoratorSet decorators, typename BarrierSetT> |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
228 |
template <typename T> |
59251
4cbfa5077d68
8234739: Harmonize parameter order in Atomic - xchg
stefank
parents:
58710
diff
changeset
|
229 |
inline oop ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_xchg_in_heap(T* addr, oop new_value) { |
59270
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
230 |
return oop_atomic_xchg_not_in_heap(addr, new_value); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
231 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
232 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
233 |
template <DecoratorSet decorators, typename BarrierSetT> |
59251
4cbfa5077d68
8234739: Harmonize parameter order in Atomic - xchg
stefank
parents:
58710
diff
changeset
|
234 |
inline oop ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_xchg_in_heap_at(oop base, ptrdiff_t offset, oop new_value) { |
59270
d5a1c6545a2b
8234768: Shenandoah: Streamline enqueueing runtime barriers
rkennke
parents:
59252
diff
changeset
|
235 |
return oop_atomic_xchg_in_heap(AccessInternal::oop_field_addr<decorators>(base, offset), new_value); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
236 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
237 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
238 |
// Clone barrier support |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
239 |
template <DecoratorSet decorators, typename BarrierSetT> |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
240 |
void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::clone_in_heap(oop src, oop dst, size_t size) { |
58218
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
241 |
if (ShenandoahCloneBarrier) { |
58334
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
58218
diff
changeset
|
242 |
ShenandoahBarrierSet::barrier_set()->clone_barrier_runtime(src); |
58218
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
243 |
} |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
244 |
Raw::clone(src, dst, size); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
245 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
246 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
247 |
template <DecoratorSet decorators, typename BarrierSetT> |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
248 |
template <typename T> |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
249 |
bool ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
250 |
arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
251 |
size_t length) { |
58218
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
252 |
ShenandoahBarrierSet* bs = ShenandoahBarrierSet::barrier_set(); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
253 |
bs->arraycopy_pre(arrayOopDesc::obj_offset_to_raw(src_obj, src_offset_in_bytes, src_raw), |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
254 |
arrayOopDesc::obj_offset_to_raw(dst_obj, dst_offset_in_bytes, dst_raw), |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
255 |
length); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
256 |
return Raw::oop_arraycopy_in_heap(src_obj, src_offset_in_bytes, src_raw, dst_obj, dst_offset_in_bytes, dst_raw, length); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
257 |
} |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
258 |
|
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
259 |
template <class T, bool HAS_FWD, bool EVAC, bool ENQUEUE> |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
260 |
void ShenandoahBarrierSet::arraycopy_work(T* src, size_t count) { |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
261 |
Thread* thread = Thread::current(); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
262 |
SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
263 |
ShenandoahMarkingContext* ctx = _heap->marking_context(); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
264 |
const ShenandoahCollectionSet* const cset = _heap->collection_set(); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
265 |
T* end = src + count; |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
266 |
for (T* elem_ptr = src; elem_ptr < end; elem_ptr++) { |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
267 |
T o = RawAccess<>::oop_load(elem_ptr); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
268 |
if (!CompressedOops::is_null(o)) { |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
269 |
oop obj = CompressedOops::decode_not_null(o); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
270 |
if (HAS_FWD && cset->is_in((HeapWord *) obj)) { |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
271 |
assert(_heap->has_forwarded_objects(), "only get here with forwarded objects"); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
272 |
oop fwd = resolve_forwarded_not_null(obj); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
273 |
if (EVAC && obj == fwd) { |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
274 |
fwd = _heap->evacuate_object(obj, thread); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
275 |
} |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
276 |
assert(obj != fwd || _heap->cancelled_gc(), "must be forwarded"); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
277 |
oop witness = ShenandoahHeap::cas_oop(fwd, elem_ptr, o); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
278 |
obj = fwd; |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
279 |
} |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
280 |
if (ENQUEUE && !ctx->is_marked(obj)) { |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
281 |
queue.enqueue_known_active(obj); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
282 |
} |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
283 |
} |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
284 |
} |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
285 |
} |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
286 |
|
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
287 |
template <class T> |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
288 |
void ShenandoahBarrierSet::arraycopy_pre_work(T* src, T* dst, size_t count) { |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
289 |
if (_heap->is_concurrent_mark_in_progress()) { |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
290 |
if (_heap->has_forwarded_objects()) { |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
291 |
arraycopy_work<T, true, false, true>(dst, count); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
292 |
} else { |
58218
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
293 |
arraycopy_work<T, false, false, true>(dst, count); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
294 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
295 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
296 |
|
58218
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
297 |
arraycopy_update_impl(src, count); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
298 |
} |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
299 |
|
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
300 |
void ShenandoahBarrierSet::arraycopy_pre(oop* src, oop* dst, size_t count) { |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
301 |
arraycopy_pre_work(src, dst, count); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
302 |
} |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
303 |
|
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
304 |
void ShenandoahBarrierSet::arraycopy_pre(narrowOop* src, narrowOop* dst, size_t count) { |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
305 |
arraycopy_pre_work(src, dst, count); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
306 |
} |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
307 |
|
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
308 |
template <class T> |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
309 |
void ShenandoahBarrierSet::arraycopy_update_impl(T* src, size_t count) { |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
310 |
if (_heap->is_evacuation_in_progress()) { |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
311 |
ShenandoahEvacOOMScope oom_evac; |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
312 |
arraycopy_work<T, true, true, false>(src, count); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
313 |
} else if (_heap->is_concurrent_traversal_in_progress()){ |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
314 |
ShenandoahEvacOOMScope oom_evac; |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
315 |
arraycopy_work<T, true, true, true>(src, count); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
316 |
} else if (_heap->has_forwarded_objects()) { |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
317 |
arraycopy_work<T, true, false, false>(src, count); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
318 |
} |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
319 |
} |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
320 |
|
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
321 |
void ShenandoahBarrierSet::arraycopy_update(oop* src, size_t count) { |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
322 |
arraycopy_update_impl(src, count); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
323 |
} |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
324 |
|
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
325 |
void ShenandoahBarrierSet::arraycopy_update(narrowOop* src, size_t count) { |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
326 |
arraycopy_update_impl(src, count); |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
327 |
} |
0d7877278adf
8231086: Shenandoah: Stronger invariant for object-arraycopy
rkennke
parents:
58177
diff
changeset
|
328 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52925
diff
changeset
|
329 |
#endif // SHARE_GC_SHENANDOAH_SHENANDOAHBARRIERSET_INLINE_HPP |