11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
23
24 #ifndef SHARE_VM_GC_SHENANDOAH_SHENANDOAHBARRIERSET_INLINE_HPP
25 #define SHARE_VM_GC_SHENANDOAH_SHENANDOAHBARRIERSET_INLINE_HPP
26
27 #include "gc/shared/barrierSet.hpp"
28 #include "gc/shenandoah/brooksPointer.inline.hpp"
29 #include "gc/shenandoah/shenandoahBarrierSet.hpp"
30 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
31
32 bool ShenandoahBarrierSet::need_update_refs_barrier() {
33 return _heap->is_update_refs_in_progress() ||
34 _heap->is_concurrent_traversal_in_progress() ||
35 (_heap->is_concurrent_mark_in_progress() && _heap->has_forwarded_objects());
36 }
37
38 inline oop ShenandoahBarrierSet::resolve_forwarded_not_null(oop p) {
39 return BrooksPointer::forwardee(p);
40 }
41
42 inline oop ShenandoahBarrierSet::resolve_forwarded(oop p) {
43 if (((HeapWord*) p) != NULL) {
44 return resolve_forwarded_not_null(p);
45 } else {
46 return p;
47 }
48 }
49
50 template <DecoratorSet decorators, typename BarrierSetT>
257 } else {
258 assert(heap->is_idle() || heap->is_evacuation_in_progress(), "must not have anything in progress");
259 storeval_mode = NONE; // E.g. during evac or outside cycle
260 }
261 } else {
262 assert(heap->is_stable() || heap->is_concurrent_mark_in_progress(), "must not have anything in progress");
263 storeval_mode = NONE;
264 }
265
266 if (!satb && !checkcast && storeval_mode == NONE) {
267 // Short-circuit to bulk copy.
268 return Raw::oop_arraycopy(src_obj, src_offset_in_bytes, src_raw, dst_obj, dst_offset_in_bytes, dst_raw, length);
269 }
270
271 src_raw = arrayOopDesc::obj_offset_to_raw(src_obj, src_offset_in_bytes, src_raw);
272 dst_raw = arrayOopDesc::obj_offset_to_raw(dst_obj, dst_offset_in_bytes, dst_raw);
273
274 Klass* bound = objArrayOop(dst_obj)->element_klass();
275 ShenandoahBarrierSet* bs = ShenandoahBarrierSet::barrier_set();
276 return bs->arraycopy_loop_1(src_raw, dst_raw, length, bound, checkcast, satb, storeval_mode);
277 }
278
279 #endif //SHARE_VM_GC_SHENANDOAH_SHENANDOAHBARRIERSET_INLINE_HPP
|
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
23
24 #ifndef SHARE_VM_GC_SHENANDOAH_SHENANDOAHBARRIERSET_INLINE_HPP
25 #define SHARE_VM_GC_SHENANDOAH_SHENANDOAHBARRIERSET_INLINE_HPP
26
27 #include "gc/shared/barrierSet.hpp"
28 #include "gc/shenandoah/brooksPointer.inline.hpp"
29 #include "gc/shenandoah/shenandoahBarrierSet.hpp"
30 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
31 #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp"
32
33 bool ShenandoahBarrierSet::need_update_refs_barrier() {
34 return _heap->is_update_refs_in_progress() ||
35 _heap->is_concurrent_traversal_in_progress() ||
36 (_heap->is_concurrent_mark_in_progress() && _heap->has_forwarded_objects());
37 }
38
39 inline oop ShenandoahBarrierSet::resolve_forwarded_not_null(oop p) {
40 return BrooksPointer::forwardee(p);
41 }
42
43 inline oop ShenandoahBarrierSet::resolve_forwarded(oop p) {
44 if (((HeapWord*) p) != NULL) {
45 return resolve_forwarded_not_null(p);
46 } else {
47 return p;
48 }
49 }
50
51 template <DecoratorSet decorators, typename BarrierSetT>
258 } else {
259 assert(heap->is_idle() || heap->is_evacuation_in_progress(), "must not have anything in progress");
260 storeval_mode = NONE; // E.g. during evac or outside cycle
261 }
262 } else {
263 assert(heap->is_stable() || heap->is_concurrent_mark_in_progress(), "must not have anything in progress");
264 storeval_mode = NONE;
265 }
266
267 if (!satb && !checkcast && storeval_mode == NONE) {
268 // Short-circuit to bulk copy.
269 return Raw::oop_arraycopy(src_obj, src_offset_in_bytes, src_raw, dst_obj, dst_offset_in_bytes, dst_raw, length);
270 }
271
272 src_raw = arrayOopDesc::obj_offset_to_raw(src_obj, src_offset_in_bytes, src_raw);
273 dst_raw = arrayOopDesc::obj_offset_to_raw(dst_obj, dst_offset_in_bytes, dst_raw);
274
275 Klass* bound = objArrayOop(dst_obj)->element_klass();
276 ShenandoahBarrierSet* bs = ShenandoahBarrierSet::barrier_set();
277 return bs->arraycopy_loop_1(src_raw, dst_raw, length, bound, checkcast, satb, storeval_mode);
278 }
279
280 template <DecoratorSet decorators, typename BarrierSetT>
281 template <typename T>
282 oop ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_load_not_in_heap(T* addr) {
283 oop value = Raw::oop_load_not_in_heap(addr);
284 // In order to support concurrent reference cleaning (and similar
285 // constructs like concurrent string table cleaning) return
286 // logical NULL here if phantom ref and real oop is unreachable.
287 ShenandoahHeap* heap = ShenandoahHeap::heap();
288 if (heap->is_refcleaning_in_progress() &&
289 (decorators & ON_PHANTOM_OOP_REF) != 0 &&
290 value != NULL &&
291 !heap->complete_marking_context()->is_marked(value)) {
292 return NULL;
293 }
294 keep_alive_if_weak(decorators, value);
295 return value;
296 }
297
298 template <DecoratorSet decorators, typename BarrierSetT>
299 template <typename T>
300 void ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_store_not_in_heap(T* addr, oop value) {
301 value = ShenandoahBarrierSet::barrier_set()->storeval_barrier(value);
302 Raw::oop_store_not_in_heap(addr, value);
303 }
304
305 #endif //SHARE_VM_GC_SHENANDOAH_SHENANDOAHBARRIERSET_INLINE_HPP
|