Path: blob/master/src/hotspot/share/gc/z/zBarrierSet.hpp
40957 views
/*1* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 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 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223#ifndef SHARE_GC_Z_ZBARRIERSET_HPP24#define SHARE_GC_Z_ZBARRIERSET_HPP2526#include "gc/shared/barrierSet.hpp"2728class ZBarrierSetAssembler;2930class ZBarrierSet : public BarrierSet {31public:32ZBarrierSet();3334static ZBarrierSetAssembler* assembler();35static bool barrier_needed(DecoratorSet decorators, BasicType type);3637virtual void on_thread_create(Thread* thread);38virtual void on_thread_destroy(Thread* thread);39virtual void on_thread_attach(Thread* thread);40virtual void on_thread_detach(Thread* thread);4142virtual void print_on(outputStream* st) const;4344template <DecoratorSet decorators, typename BarrierSetT = ZBarrierSet>45class AccessBarrier : public BarrierSet::AccessBarrier<decorators, BarrierSetT> {46private:47typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw;4849template <DecoratorSet expected>50static void verify_decorators_present();5152template <DecoratorSet expected>53static void verify_decorators_absent();5455static oop* field_addr(oop base, ptrdiff_t offset);5657template <typename T>58static oop load_barrier_on_oop_field_preloaded(T* addr, oop o);5960template <typename T>61static oop load_barrier_on_unknown_oop_field_preloaded(oop base, ptrdiff_t offset, T* addr, oop o);6263public:64//65// In heap66//67template <typename T>68static oop oop_load_in_heap(T* addr);69static oop oop_load_in_heap_at(oop base, ptrdiff_t offset);7071template <typename T>72static oop oop_atomic_cmpxchg_in_heap(T* addr, oop compare_value, oop new_value);73static oop oop_atomic_cmpxchg_in_heap_at(oop base, ptrdiff_t offset, oop compare_value, oop new_value);7475template <typename T>76static oop oop_atomic_xchg_in_heap(T* addr, oop new_value);77static oop oop_atomic_xchg_in_heap_at(oop base, ptrdiff_t offset, oop new_value);7879template <typename T>80static bool oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,81arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,82size_t length);8384static void clone_in_heap(oop src, oop dst, size_t size);8586//87// Not in heap88//89template <typename T>90static oop oop_load_not_in_heap(T* addr);9192template <typename T>93static oop oop_atomic_cmpxchg_not_in_heap(T* addr, oop compare_value, oop new_value);9495template <typename T>96static oop oop_atomic_xchg_not_in_heap(T* addr, oop new_value);97};98};99100template<> struct BarrierSet::GetName<ZBarrierSet> {101static const BarrierSet::Name value = BarrierSet::ZBarrierSet;102};103104template<> struct BarrierSet::GetType<BarrierSet::ZBarrierSet> {105typedef ::ZBarrierSet type;106};107108#endif // SHARE_GC_Z_ZBARRIERSET_HPP109110111