< prev index next >

src/hotspot/share/gc/g1/g1BarrierSet.inline.hpp

Print this page

 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #ifndef SHARE_GC_G1_G1BARRIERSET_INLINE_HPP
 26 #define SHARE_GC_G1_G1BARRIERSET_INLINE_HPP
 27 
 28 #include "gc/g1/g1BarrierSet.hpp"
 29 
 30 #include "gc/g1/g1CardTable.hpp"

 31 #include "gc/shared/accessBarrierSupport.inline.hpp"
 32 #include "oops/access.inline.hpp"
 33 #include "oops/compressedOops.inline.hpp"
 34 #include "oops/oop.hpp"
 35 
 36 template <DecoratorSet decorators, typename T>
 37 inline void G1BarrierSet::write_ref_field_pre(T* field) {
 38   if (HasDecorator<decorators, IS_DEST_UNINITIALIZED>::value ||
 39       HasDecorator<decorators, AS_NO_KEEPALIVE>::value) {
 40     return;
 41   }
 42 
 43   T heap_oop = RawAccess<MO_RELAXED>::oop_load(field);
 44   if (!CompressedOops::is_null(heap_oop)) {
 45     enqueue(CompressedOops::decode_not_null(heap_oop));
 46   }
 47 }
 48 
 49 template <DecoratorSet decorators, typename T>
 50 inline void G1BarrierSet::write_ref_field_post(T* field, oop new_val) {

 89 
 90 template <DecoratorSet decorators, typename BarrierSetT>
 91 inline oop G1BarrierSet::AccessBarrier<decorators, BarrierSetT>::
 92 oop_load_in_heap_at(oop base, ptrdiff_t offset) {
 93   oop value = ModRef::oop_load_in_heap_at(base, offset);
 94   enqueue_if_weak(AccessBarrierSupport::resolve_possibly_unknown_oop_ref_strength<decorators>(base, offset), value);
 95   return value;
 96 }
 97 
 98 template <DecoratorSet decorators, typename BarrierSetT>
 99 template <typename T>
100 inline void G1BarrierSet::AccessBarrier<decorators, BarrierSetT>::
101 oop_store_not_in_heap(T* addr, oop new_value) {
102   // Apply SATB barriers for all non-heap references, to allow
103   // concurrent scanning of such references.
104   G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
105   bs->write_ref_field_pre<decorators>(addr);
106   Raw::oop_store(addr, new_value);
107 }
108 




109 #endif // SHARE_GC_G1_G1BARRIERSET_INLINE_HPP

 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #ifndef SHARE_GC_G1_G1BARRIERSET_INLINE_HPP
 26 #define SHARE_GC_G1_G1BARRIERSET_INLINE_HPP
 27 
 28 #include "gc/g1/g1BarrierSet.hpp"
 29 
 30 #include "gc/g1/g1CardTable.hpp"
 31 #include "gc/g1/g1CollectedHeap.inline.hpp"
 32 #include "gc/shared/accessBarrierSupport.inline.hpp"
 33 #include "oops/access.inline.hpp"
 34 #include "oops/compressedOops.inline.hpp"
 35 #include "oops/oop.hpp"
 36 
 37 template <DecoratorSet decorators, typename T>
 38 inline void G1BarrierSet::write_ref_field_pre(T* field) {
 39   if (HasDecorator<decorators, IS_DEST_UNINITIALIZED>::value ||
 40       HasDecorator<decorators, AS_NO_KEEPALIVE>::value) {
 41     return;
 42   }
 43 
 44   T heap_oop = RawAccess<MO_RELAXED>::oop_load(field);
 45   if (!CompressedOops::is_null(heap_oop)) {
 46     enqueue(CompressedOops::decode_not_null(heap_oop));
 47   }
 48 }
 49 
 50 template <DecoratorSet decorators, typename T>
 51 inline void G1BarrierSet::write_ref_field_post(T* field, oop new_val) {

 90 
 91 template <DecoratorSet decorators, typename BarrierSetT>
 92 inline oop G1BarrierSet::AccessBarrier<decorators, BarrierSetT>::
 93 oop_load_in_heap_at(oop base, ptrdiff_t offset) {
 94   oop value = ModRef::oop_load_in_heap_at(base, offset);
 95   enqueue_if_weak(AccessBarrierSupport::resolve_possibly_unknown_oop_ref_strength<decorators>(base, offset), value);
 96   return value;
 97 }
 98 
 99 template <DecoratorSet decorators, typename BarrierSetT>
100 template <typename T>
101 inline void G1BarrierSet::AccessBarrier<decorators, BarrierSetT>::
102 oop_store_not_in_heap(T* addr, oop new_value) {
103   // Apply SATB barriers for all non-heap references, to allow
104   // concurrent scanning of such references.
105   G1BarrierSet *bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
106   bs->write_ref_field_pre<decorators>(addr);
107   Raw::oop_store(addr, new_value);
108 }
109 
110 inline bool G1BarrierSet::requires_barriers(oop obj) {
111   return G1CollectedHeap::heap()->G1CollectedHeap::requires_barriers(obj);
112 }
113 
114 #endif // SHARE_GC_G1_G1BARRIERSET_INLINE_HPP
< prev index next >