/* * Copyright (c) 2018, Red Hat, Inc. and/or its affiliates. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. * */ #ifndef SHARE_VM_GC_SHENANDOAH_SHENANDOAHLRBBARRIERSET_HPP #define SHARE_VM_GC_SHENANDOAH_SHENANDOAHLRBBARRIERSET_HPP #include "gc/shared/accessBarrierSupport.hpp" #include "gc/shenandoah/shenandoahBaseBarrierSet.hpp" class ShenandoahLRBBarrierSet: public ShenandoahBaseBarrierSet { public: ShenandoahLRBBarrierSet(ShenandoahHeap* heap); void print_on(outputStream* st) const; bool is_a(BarrierSet::Name bsn); public: // Callbacks for runtime accesses. template class AccessBarrier : public BarrierSet::AccessBarrier { typedef BarrierSet::AccessBarrier Raw; public: template static oop oop_load_in_heap(T* addr); static oop oop_load_in_heap_at(oop base, ptrdiff_t offset); template static void oop_store_in_heap(T* addr, oop value); static void oop_store_in_heap_at(oop base, ptrdiff_t offset, oop value) { oop_store_in_heap(AccessInternal::oop_field_addr(base, offset), value); } template static oop oop_atomic_cmpxchg_in_heap(oop new_value, T* addr, oop compare_value); static oop oop_atomic_cmpxchg_in_heap_at(oop new_value, oop base, ptrdiff_t offset, oop compare_value); template static oop oop_atomic_xchg_in_heap(oop new_value, T* addr); static oop oop_atomic_xchg_in_heap_at(oop new_value, oop base, ptrdiff_t offset); template static oop oop_load_not_in_heap(T* addr); template static oop oop_atomic_cmpxchg_not_in_heap(oop new_value, T* addr, oop compare_value); template static oop oop_atomic_xchg_not_in_heap(oop new_value, T* addr); template static bool oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw, arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw, size_t length); // Clone barrier support static void clone_in_heap(oop src, oop dst, size_t size); }; }; template<> struct BarrierSet::GetName { static const BarrierSet::Name value = BarrierSet::ShenandoahLRB; }; template<> struct BarrierSet::GetType { typedef ::ShenandoahLRBBarrierSet type; }; #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAHLRBBARRIERSET_HPP