author | stefank |
Tue, 26 Nov 2019 10:47:46 +0100 | |
changeset 59290 | 97d13893ec3c |
parent 58405 | 752bf4d5fbb7 |
child 58679 | 9c3209ff7550 |
permissions | -rw-r--r-- |
58334
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
1 |
/* |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, 2019, Red Hat, Inc. All rights reserved. |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
3 |
* |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
4 |
* This code is free software; you can redistribute it and/or modify it |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
5 |
* under the terms of the GNU General Public License version 2 only, as |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
6 |
* published by the Free Software Foundation. |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
7 |
* |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
8 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
9 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
10 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
11 |
* version 2 for more details (a copy is included in the LICENSE file that |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
12 |
* accompanied this code). |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
13 |
* |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License version |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
15 |
* 2 along with this work; if not, write to the Free Software Foundation, |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
16 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
17 |
* |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
18 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
19 |
* or visit www.oracle.com if you need additional information or have any |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
20 |
* questions. |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
21 |
* |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
22 |
*/ |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
23 |
|
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
24 |
#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHBARRIERSETCLONE_INLINE_HPP |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
25 |
#define SHARE_GC_SHENANDOAH_SHENANDOAHBARRIERSETCLONE_INLINE_HPP |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
26 |
|
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
27 |
#include "gc/shenandoah/shenandoahBarrierSet.inline.hpp" |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
28 |
#include "gc/shenandoah/shenandoahCollectionSet.inline.hpp" |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
29 |
#include "gc/shenandoah/shenandoahEvacOOMHandler.hpp" |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
30 |
#include "gc/shenandoah/shenandoahHeap.inline.hpp" |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
31 |
#include "memory/iterator.hpp" |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
32 |
#include "oops/access.hpp" |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
33 |
#include "oops/compressedOops.hpp" |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
34 |
|
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
35 |
template <bool EVAC, bool ENQUEUE> |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
36 |
class ShenandoahUpdateRefsForOopClosure: public BasicOopIterateClosure { |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
37 |
private: |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
38 |
ShenandoahHeap* const _heap; |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
39 |
ShenandoahBarrierSet* const _bs; |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
40 |
const ShenandoahCollectionSet* const _cset; |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
41 |
Thread* const _thread; |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
42 |
|
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
43 |
template <class T> |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
44 |
inline void do_oop_work(T* p) { |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
45 |
T o = RawAccess<>::oop_load(p); |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
46 |
if (!CompressedOops::is_null(o)) { |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
47 |
oop obj = CompressedOops::decode_not_null(o); |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
48 |
if (_cset->is_in((HeapWord *)obj)) { |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
49 |
oop fwd = _bs->resolve_forwarded_not_null(obj); |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
50 |
if (EVAC && obj == fwd) { |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
51 |
fwd = _heap->evacuate_object(obj, _thread); |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
52 |
} |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
53 |
if (ENQUEUE) { |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
54 |
_bs->enqueue(fwd); |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
55 |
} |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
56 |
assert(obj != fwd || _heap->cancelled_gc(), "must be forwarded"); |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
57 |
ShenandoahHeap::cas_oop(fwd, p, o); |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
58 |
} |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
59 |
|
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
60 |
} |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
61 |
} |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
62 |
public: |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
63 |
ShenandoahUpdateRefsForOopClosure() : |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
64 |
_heap(ShenandoahHeap::heap()), |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
65 |
_bs(ShenandoahBarrierSet::barrier_set()), |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
66 |
_cset(_heap->collection_set()), |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
67 |
_thread(Thread::current()) { |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
68 |
} |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
69 |
|
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
70 |
virtual void do_oop(oop* p) { do_oop_work(p); } |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
71 |
virtual void do_oop(narrowOop* p) { do_oop_work(p); } |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
72 |
}; |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
73 |
|
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
74 |
void ShenandoahBarrierSet::clone_barrier(oop obj) { |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
75 |
assert(ShenandoahCloneBarrier, "only get here with clone barriers enabled"); |
58405
752bf4d5fbb7
8231499: Shenandoah: compiler/arraycopy/TestDefaultMethodArrayCloneDeoptC2 fails
rkennke
parents:
58334
diff
changeset
|
76 |
assert(_heap->has_forwarded_objects(), "only when heap is unstable"); |
58334
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
77 |
|
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
78 |
// This is called for cloning an object (see jvm.cpp) after the clone |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
79 |
// has been made. We are not interested in any 'previous value' because |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
80 |
// it would be NULL in any case. But we *are* interested in any oop* |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
81 |
// that potentially need to be updated. |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
82 |
|
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
83 |
shenandoah_assert_correct(NULL, obj); |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
84 |
if (_heap->is_evacuation_in_progress()) { |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
85 |
ShenandoahEvacOOMScope evac_scope; |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
86 |
ShenandoahUpdateRefsForOopClosure</* evac = */ true, /* enqueue */ false> cl; |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
87 |
obj->oop_iterate(&cl); |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
88 |
} else if (_heap->is_concurrent_traversal_in_progress()) { |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
89 |
ShenandoahEvacOOMScope evac_scope; |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
90 |
ShenandoahUpdateRefsForOopClosure</* evac = */ true, /* enqueue */ true> cl; |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
91 |
obj->oop_iterate(&cl); |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
92 |
} else { |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
93 |
ShenandoahUpdateRefsForOopClosure</* evac = */ false, /* enqueue */ false> cl; |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
94 |
obj->oop_iterate(&cl); |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
95 |
} |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
96 |
} |
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
97 |
|
f642ad5c655f
8231447: Shenandoah: Compilation-time regression after JDK-8231086
rkennke
parents:
diff
changeset
|
98 |
#endif // SHARE_GC_SHENANDOAH_SHENANDOAHBARRIERSETCLONE_INLINE_HPP |