Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/shenandoah/shenandoahBarrierSet.hpp
38920 views
/*1* Copyright (c) 2013, 2018, Red Hat, Inc. All rights reserved.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation.6*7* This code is distributed in the hope that it will be useful, but WITHOUT8* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or9* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License10* version 2 for more details (a copy is included in the LICENSE file that11* accompanied this code).12*13* You should have received a copy of the GNU General Public License version14* 2 along with this work; if not, write to the Free Software Foundation,15* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.16*17* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA18* or visit www.oracle.com if you need additional information or have any19* questions.20*21*/2223#ifndef SHARE_VM_GC_SHENANDOAH_SHENANDOAHBARRIERSET_HPP24#define SHARE_VM_GC_SHENANDOAH_SHENANDOAHBARRIERSET_HPP2526#include "memory/barrierSet.hpp"27#include "gc_implementation/shenandoah/shenandoahAsserts.hpp"2829class ShenandoahBarrierSetAssembler;30class ShenandoahBarrierSetC1;31class ShenandoahBarrierSetC2;32class ShenandoahHeap;3334class ShenandoahBarrierSet: public BarrierSet {35private:36ShenandoahHeap* _heap;37ShenandoahBarrierSetAssembler* const _bsasm;38ShenandoahBarrierSetC1* const _bsc1;39ShenandoahBarrierSetC2* const _bsc2;4041inline bool need_bulk_update(HeapWord* dst);42public:43ShenandoahBarrierSet(ShenandoahHeap* heap);4445inline static ShenandoahBarrierSet* barrier_set() {46BarrierSet *bs = oopDesc::bs();47assert(bs->kind() == BarrierSet::ShenandoahBarrierSet, "sanity");48return (ShenandoahBarrierSet*)bs;49}5051ShenandoahBarrierSetAssembler* bsasm() const;52ShenandoahBarrierSetC1* bsc1() const;53ShenandoahBarrierSetC2* bsc2() const;5455void print_on(outputStream* st) const;5657bool is_a(BarrierSet::Name bsn);5859bool has_read_prim_array_opt();60bool has_read_prim_barrier();61bool has_read_ref_array_opt();62bool has_read_ref_barrier();63bool has_read_region_opt();64bool has_write_prim_array_opt();65bool has_write_prim_barrier();66bool has_write_ref_array_opt();67bool has_write_ref_barrier();68bool has_write_ref_pre_barrier();69bool has_write_region_opt();70bool is_aligned(HeapWord* hw);71void read_prim_array(MemRegion mr) shenandoah_not_implemented;72void read_prim_field(HeapWord* hw, size_t s) shenandoah_not_implemented;73bool read_prim_needs_barrier(HeapWord* hw, size_t s);74void read_ref_array(MemRegion mr) shenandoah_not_implemented;7576void read_ref_field(void* v);7778bool read_ref_needs_barrier(void* v) shenandoah_not_implemented_return(false);79void read_region(MemRegion mr) shenandoah_not_implemented;80void resize_covered_region(MemRegion mr) shenandoah_not_implemented;81void write_prim_array(MemRegion mr) shenandoah_not_implemented;82void write_prim_field(HeapWord* hw, size_t s , juint x, juint y) shenandoah_not_implemented;83bool write_prim_needs_barrier(HeapWord* hw, size_t s, juint x, juint y) shenandoah_not_implemented_return(false);8485void write_ref_array_work(MemRegion mr) {}8687template <class T>88inline void arraycopy_barrier(T* src, T* dst, size_t count);89inline void clone_barrier(oop src);90void clone_barrier_runtime(oop src);9192// We export this to make it available in cases where the static93// type of the barrier set is known. Note that it is non-virtual.94template <class T> inline void inline_write_ref_field_pre(T* field, oop newVal);9596// These are the more general virtual versions.97void write_ref_field_pre_work(oop* field, oop new_val);98void write_ref_field_pre_work(narrowOop* field, oop new_val);99void write_ref_field_pre_work(void* field, oop new_val) shenandoah_not_implemented;100101void write_ref_field_work(void* v, oop o, bool release = false);102void write_region_work(MemRegion mr) {};103104static inline oop resolve_forwarded_not_null(oop p);105static inline oop resolve_forwarded_not_null_mutator(oop p);106static inline oop resolve_forwarded(oop p);107108void storeval_barrier(oop obj);109110oop load_reference_barrier(oop obj);111oop load_reference_barrier_not_null(oop obj);112inline oop load_reference_barrier_mutator(oop obj, oop* load_addr);113inline oop load_reference_barrier_mutator(oop obj, narrowOop* load_addr);114115template <class T>116inline oop load_reference_barrier_mutator_work(oop obj, T* load_addr);117118oop oop_atomic_cmpxchg_in_heap(oop new_value, volatile HeapWord* dest, oop compare_value);119120void enqueue(oop obj);121void keep_alive_barrier(oop obj);122123private:124template <class T>125inline void arraycopy_marking(T* src, T* dst, size_t count);126template <class T>127inline void arraycopy_evacuation(T* src, size_t count);128template <class T>129inline void arraycopy_update(T* src, size_t count);130131inline void clone_marking(oop src);132inline void clone_evacuation(oop src);133inline void clone_update(oop src);134135template <class T, bool HAS_FWD, bool EVAC, bool ENQUEUE>136inline void arraycopy_work(T* src, size_t count);137138oop load_reference_barrier_impl(oop obj);139140oop atomic_compare_exchange_oop(oop exchange_value,141volatile HeapWord *dest,142oop compare_value);143};144145#endif //SHARE_VM_GC_SHENANDOAH_SHENANDOAHBARRIERSET_HPP146147148