124 }
125
126 inline bool ZBarrier::is_good_or_null_fast_path(uintptr_t addr) {
127 return ZAddress::is_good_or_null(addr);
128 }
129
130 inline bool ZBarrier::is_weak_good_or_null_fast_path(uintptr_t addr) {
131 return ZAddress::is_weak_good_or_null(addr);
132 }
133
134 inline bool ZBarrier::is_resurrection_blocked(volatile oop* p, oop* o) {
135 const bool is_blocked = ZResurrection::is_blocked();
136
137 // Reload oop after checking the resurrection blocked state. This is
138 // done to prevent a race where we first load an oop, which is logically
139 // null but not yet cleared, then this oop is cleared by the reference
140 // processor and resurrection is unblocked. At this point the mutator
141 // would see the unblocked state and pass this invalid oop through the
142 // normal barrier path, which would incorrectly try to mark this oop.
143 if (p != NULL) {
144 *o = *p;
145 }
146
147 return is_blocked;
148 }
149
150 //
151 // Load barrier
152 //
153 inline oop ZBarrier::load_barrier_on_oop(oop o) {
154 return load_barrier_on_oop_field_preloaded((oop*)NULL, o);
155 }
156
157 inline oop ZBarrier::load_barrier_on_oop_field(volatile oop* p) {
158 const oop o = *p;
159 return load_barrier_on_oop_field_preloaded(p, o);
160 }
161
162 inline oop ZBarrier::load_barrier_on_oop_field_preloaded(volatile oop* p, oop o) {
163 return barrier<is_good_or_null_fast_path, load_barrier_on_oop_slow_path>(p, o);
164 }
|
124 }
125
126 inline bool ZBarrier::is_good_or_null_fast_path(uintptr_t addr) {
127 return ZAddress::is_good_or_null(addr);
128 }
129
130 inline bool ZBarrier::is_weak_good_or_null_fast_path(uintptr_t addr) {
131 return ZAddress::is_weak_good_or_null(addr);
132 }
133
134 inline bool ZBarrier::is_resurrection_blocked(volatile oop* p, oop* o) {
135 const bool is_blocked = ZResurrection::is_blocked();
136
137 // Reload oop after checking the resurrection blocked state. This is
138 // done to prevent a race where we first load an oop, which is logically
139 // null but not yet cleared, then this oop is cleared by the reference
140 // processor and resurrection is unblocked. At this point the mutator
141 // would see the unblocked state and pass this invalid oop through the
142 // normal barrier path, which would incorrectly try to mark this oop.
143 if (p != NULL) {
144 // First assign to reloaded_o to avoid compiler warning about
145 // implicit dereference of volatile oop.
146 const oop reloaded_o = *p;
147 *o = reloaded_o;
148 }
149
150 return is_blocked;
151 }
152
153 //
154 // Load barrier
155 //
156 inline oop ZBarrier::load_barrier_on_oop(oop o) {
157 return load_barrier_on_oop_field_preloaded((oop*)NULL, o);
158 }
159
160 inline oop ZBarrier::load_barrier_on_oop_field(volatile oop* p) {
161 const oop o = *p;
162 return load_barrier_on_oop_field_preloaded(p, o);
163 }
164
165 inline oop ZBarrier::load_barrier_on_oop_field_preloaded(volatile oop* p, oop o) {
166 return barrier<is_good_or_null_fast_path, load_barrier_on_oop_slow_path>(p, o);
167 }
|