28
28
#include " gc/g1/g1BarrierSet.hpp"
29
29
30
30
#include " gc/g1/g1CardTable.hpp"
31
+ #include " gc/g1/g1ThreadLocalData.hpp"
31
32
#include " gc/shared/accessBarrierSupport.inline.hpp"
32
33
#include " oops/access.inline.hpp"
33
34
#include " oops/compressedOops.inline.hpp"
34
35
#include " oops/oop.hpp"
35
36
37
+ inline void G1BarrierSet::enqueue_preloaded (oop pre_val) {
38
+ // Nulls should have been already filtered.
39
+ assert (oopDesc::is_oop (pre_val, true ), " Error" );
40
+
41
+ G1SATBMarkQueueSet& queue_set = G1BarrierSet::satb_mark_queue_set ();
42
+ if (!queue_set.is_active ()) return ;
43
+
44
+ SATBMarkQueue& queue = G1ThreadLocalData::satb_mark_queue (Thread::current ());
45
+ queue_set.enqueue_known_active (queue, pre_val);
46
+ }
47
+
48
+ template <class T >
49
+ inline void G1BarrierSet::enqueue (T* dst) {
50
+ G1SATBMarkQueueSet& queue_set = G1BarrierSet::satb_mark_queue_set ();
51
+ if (!queue_set.is_active ()) return ;
52
+
53
+ T heap_oop = RawAccess<MO_RELAXED>::oop_load (dst);
54
+ if (!CompressedOops::is_null (heap_oop)) {
55
+ SATBMarkQueue& queue = G1ThreadLocalData::satb_mark_queue (Thread::current ());
56
+ queue_set.enqueue_known_active (queue, CompressedOops::decode_not_null (heap_oop));
57
+ }
58
+ }
59
+
36
60
template <DecoratorSet decorators, typename T>
37
61
inline void G1BarrierSet::write_ref_field_pre (T* field) {
38
62
if (HasDecorator<decorators, IS_DEST_UNINITIALIZED>::value ||
39
63
HasDecorator<decorators, AS_NO_KEEPALIVE>::value) {
40
64
return ;
41
65
}
42
66
43
- T heap_oop = RawAccess<MO_RELAXED>::oop_load (field);
44
- if (!CompressedOops::is_null (heap_oop)) {
45
- enqueue (CompressedOops::decode_not_null (heap_oop));
46
- }
67
+ enqueue (field);
47
68
}
48
69
49
70
template <DecoratorSet decorators, typename T>
@@ -55,7 +76,7 @@ inline void G1BarrierSet::write_ref_field_post(T* field, oop new_val) {
55
76
}
56
77
}
57
78
58
- inline void G1BarrierSet::enqueue_if_weak (DecoratorSet decorators, oop value) {
79
+ inline void G1BarrierSet::enqueue_preloaded_if_weak (DecoratorSet decorators, oop value) {
59
80
assert ((decorators & ON_UNKNOWN_OOP_REF) == 0 , " Reference strength must be known" );
60
81
// Loading from a weak or phantom reference needs enqueueing, as
61
82
// the object may not have been reachable (part of the snapshot)
@@ -65,7 +86,7 @@ inline void G1BarrierSet::enqueue_if_weak(DecoratorSet decorators, oop value) {
65
86
const bool needs_enqueue = (!peek && !on_strong_oop_ref);
66
87
67
88
if (needs_enqueue && value != NULL ) {
68
- enqueue (value);
89
+ enqueue_preloaded (value);
69
90
}
70
91
}
71
92
@@ -74,7 +95,7 @@ template <typename T>
74
95
inline oop G1BarrierSet::AccessBarrier<decorators, BarrierSetT>::
75
96
oop_load_not_in_heap (T* addr) {
76
97
oop value = ModRef::oop_load_not_in_heap (addr);
77
- enqueue_if_weak (decorators, value);
98
+ enqueue_preloaded_if_weak (decorators, value);
78
99
return value;
79
100
}
80
101
@@ -83,15 +104,15 @@ template <typename T>
83
104
inline oop G1BarrierSet::AccessBarrier<decorators, BarrierSetT>::
84
105
oop_load_in_heap (T* addr) {
85
106
oop value = ModRef::oop_load_in_heap (addr);
86
- enqueue_if_weak (decorators, value);
107
+ enqueue_preloaded_if_weak (decorators, value);
87
108
return value;
88
109
}
89
110
90
111
template <DecoratorSet decorators, typename BarrierSetT>
91
112
inline oop G1BarrierSet::AccessBarrier<decorators, BarrierSetT>::
92
113
oop_load_in_heap_at (oop base, ptrdiff_t offset) {
93
114
oop value = ModRef::oop_load_in_heap_at (base, offset);
94
- enqueue_if_weak (AccessBarrierSupport::resolve_possibly_unknown_oop_ref_strength<decorators>(base, offset), value);
115
+ enqueue_preloaded_if_weak (AccessBarrierSupport::resolve_possibly_unknown_oop_ref_strength<decorators>(base, offset), value);
95
116
return value;
96
117
}
97
118
0 commit comments