author | kbarrett |
Tue, 12 Jun 2018 18:12:59 -0400 | |
changeset 50532 | a18c60527166 |
parent 49595 | e3e2fb5cc799 |
child 50728 | 9375184cec98 |
permissions | -rw-r--r-- |
35862
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
1 |
/* |
48628
69d65d9dcadb
8193063: Enabling narrowOop values for RawAccess accesses
eosterlund
parents:
47998
diff
changeset
|
2 |
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. |
35862
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
4 |
* |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
8 |
* |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
13 |
* accompanied this code). |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
14 |
* |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
18 |
* |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
21 |
* questions. |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
22 |
* |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
23 |
*/ |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
24 |
|
49347
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
25 |
#ifndef SHARE_VM_GC_G1_G1BARRIERSET_INLINE_HPP |
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
26 |
#define SHARE_VM_GC_G1_G1BARRIERSET_INLINE_HPP |
35862
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
27 |
|
49347
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
28 |
#include "gc/g1/g1BarrierSet.hpp" |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48966
diff
changeset
|
29 |
#include "gc/g1/g1CardTable.hpp" |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
30 |
#include "gc/shared/accessBarrierSupport.inline.hpp" |
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49347
diff
changeset
|
31 |
#include "oops/access.inline.hpp" |
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49347
diff
changeset
|
32 |
#include "oops/compressedOops.inline.hpp" |
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49347
diff
changeset
|
33 |
#include "oops/oop.hpp" |
35862
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
34 |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
35 |
template <DecoratorSet decorators, typename T> |
49347
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
36 |
inline void G1BarrierSet::write_ref_field_pre(T* field) { |
48966
e6eb66d2e765
8197454: Need Access decorator for storing oop into uninitialized location
kbarrett
parents:
48784
diff
changeset
|
37 |
if (HasDecorator<decorators, AS_DEST_NOT_INITIALIZED>::value || |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
38 |
HasDecorator<decorators, AS_NO_KEEPALIVE>::value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
39 |
return; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
40 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
41 |
|
49347
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
42 |
T heap_oop = RawAccess<MO_VOLATILE>::oop_load(field); |
49592
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49347
diff
changeset
|
43 |
if (!CompressedOops::is_null(heap_oop)) { |
77fb0be7d19f
8199946: Move load/store and encode/decode out of oopDesc
stefank
parents:
49347
diff
changeset
|
44 |
enqueue(CompressedOops::decode_not_null(heap_oop)); |
35862
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
45 |
} |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
46 |
} |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
47 |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
48 |
template <DecoratorSet decorators, typename T> |
49347
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
49 |
inline void G1BarrierSet::write_ref_field_post(T* field, oop new_val) { |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48966
diff
changeset
|
50 |
volatile jbyte* byte = _card_table->byte_for(field); |
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48966
diff
changeset
|
51 |
if (*byte != G1CardTable::g1_young_card_val()) { |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
52 |
// Take a slow path for cards in old |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
53 |
write_ref_field_post_slow(byte); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
54 |
} |
35862
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
55 |
} |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
diff
changeset
|
56 |
|
50532 | 57 |
inline void G1BarrierSet::enqueue_if_weak(DecoratorSet decorators, oop value) { |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
58 |
assert((decorators & ON_UNKNOWN_OOP_REF) == 0, "Reference strength must be known"); |
50532 | 59 |
// Loading from a weak or phantom reference needs enqueueing, as |
60 |
// the object may not have been reachable (part of the snapshot) |
|
61 |
// when marking started. |
|
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
62 |
const bool on_strong_oop_ref = (decorators & ON_STRONG_OOP_REF) != 0; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
63 |
const bool peek = (decorators & AS_NO_KEEPALIVE) != 0; |
50532 | 64 |
const bool needs_enqueue = (!peek && !on_strong_oop_ref); |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
65 |
|
48784
899b522ed65c
8194741: Refactor oops in constant pool from CDS to use the Access API
eosterlund
parents:
48628
diff
changeset
|
66 |
if (needs_enqueue && value != NULL) { |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
67 |
enqueue(value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
68 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
69 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
70 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
71 |
template <DecoratorSet decorators, typename BarrierSetT> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
72 |
template <typename T> |
49347
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
73 |
inline oop G1BarrierSet::AccessBarrier<decorators, BarrierSetT>:: |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
74 |
oop_load_not_in_heap(T* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
75 |
oop value = ModRef::oop_load_not_in_heap(addr); |
50532 | 76 |
enqueue_if_weak(decorators, value); |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
77 |
return value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
78 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
79 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
80 |
template <DecoratorSet decorators, typename BarrierSetT> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
81 |
template <typename T> |
49347
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
82 |
inline oop G1BarrierSet::AccessBarrier<decorators, BarrierSetT>:: |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
83 |
oop_load_in_heap(T* addr) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
84 |
oop value = ModRef::oop_load_in_heap(addr); |
50532 | 85 |
enqueue_if_weak(decorators, value); |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
86 |
return value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
87 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
88 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
89 |
template <DecoratorSet decorators, typename BarrierSetT> |
49347
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
90 |
inline oop G1BarrierSet::AccessBarrier<decorators, BarrierSetT>:: |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
91 |
oop_load_in_heap_at(oop base, ptrdiff_t offset) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
92 |
oop value = ModRef::oop_load_in_heap_at(base, offset); |
50532 | 93 |
enqueue_if_weak(AccessBarrierSupport::resolve_possibly_unknown_oop_ref_strength<decorators>(base, offset), value); |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
94 |
return value; |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
95 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
96 |
|
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
97 |
template <DecoratorSet decorators, typename BarrierSetT> |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
98 |
template <typename T> |
49347
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
99 |
inline void G1BarrierSet::AccessBarrier<decorators, BarrierSetT>:: |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
100 |
oop_store_not_in_heap(T* addr, oop new_value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
101 |
if (HasDecorator<decorators, IN_CONCURRENT_ROOT>::value) { |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
102 |
// For roots not scanned in a safepoint, we have to apply SATB barriers |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
103 |
// even for roots. |
49347
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
104 |
G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set()); |
47998
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
105 |
bs->write_ref_field_pre<decorators>(addr); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
106 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
107 |
Raw::oop_store(addr, new_value); |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
108 |
} |
fb0275c320a0
8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents:
47216
diff
changeset
|
109 |
|
49347
edb65305d3ac
8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet
eosterlund
parents:
49164
diff
changeset
|
110 |
#endif // SHARE_VM_GC_G1_G1BARRIERSET_INLINE_HPP |