< prev index next >

src/hotspot/share/gc/z/zBarrierSet.inline.hpp

Print this page




 115   verify_decorators_absent<ON_UNKNOWN_OOP_REF>();
 116 
 117   const oop o = Raw::oop_load_in_heap(addr);
 118   return load_barrier_on_oop_field_preloaded(addr, o);
 119 }
 120 
 121 template <DecoratorSet decorators, typename BarrierSetT>
 122 inline oop ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_load_in_heap_at(oop base, ptrdiff_t offset) {
 123   oop* const addr = field_addr(base, offset);
 124   const oop o = Raw::oop_load_in_heap(addr);
 125 
 126   if (HasDecorator<decorators, ON_UNKNOWN_OOP_REF>::value) {
 127     return load_barrier_on_unknown_oop_field_preloaded(base, offset, addr, o);
 128   }
 129 
 130   return load_barrier_on_oop_field_preloaded(addr, o);
 131 }
 132 
 133 template <DecoratorSet decorators, typename BarrierSetT>
 134 template <typename T>
 135 inline oop ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_cmpxchg_in_heap(oop new_value, T* addr, oop compare_value) {
 136   verify_decorators_present<ON_STRONG_OOP_REF>();
 137   verify_decorators_absent<AS_NO_KEEPALIVE>();
 138 
 139   ZBarrier::load_barrier_on_oop_field(addr);
 140   return Raw::oop_atomic_cmpxchg_in_heap(new_value, addr, compare_value);
 141 }
 142 
 143 template <DecoratorSet decorators, typename BarrierSetT>
 144 inline oop ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_cmpxchg_in_heap_at(oop new_value, oop base, ptrdiff_t offset, oop compare_value) {
 145   verify_decorators_present<ON_STRONG_OOP_REF | ON_UNKNOWN_OOP_REF>();
 146   verify_decorators_absent<AS_NO_KEEPALIVE>();
 147 
 148   // Through Unsafe.CompareAndExchangeObject()/CompareAndSetObject() we can receive
 149   // calls with ON_UNKNOWN_OOP_REF set. However, we treat these as ON_STRONG_OOP_REF,
 150   // with the motivation that if you're doing Unsafe operations on a Reference.referent
 151   // field, then you're on your own anyway.
 152   ZBarrier::load_barrier_on_oop_field(field_addr(base, offset));
 153   return Raw::oop_atomic_cmpxchg_in_heap_at(new_value, base, offset, compare_value);
 154 }
 155 
 156 template <DecoratorSet decorators, typename BarrierSetT>
 157 template <typename T>
 158 inline oop ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_xchg_in_heap(oop new_value, T* addr) {
 159   verify_decorators_present<ON_STRONG_OOP_REF>();
 160   verify_decorators_absent<AS_NO_KEEPALIVE>();
 161 
 162   const oop o = Raw::oop_atomic_xchg_in_heap(new_value, addr);
 163   return ZBarrier::load_barrier_on_oop(o);
 164 }
 165 
 166 template <DecoratorSet decorators, typename BarrierSetT>
 167 inline oop ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_xchg_in_heap_at(oop new_value, oop base, ptrdiff_t offset) {
 168   verify_decorators_present<ON_STRONG_OOP_REF>();
 169   verify_decorators_absent<AS_NO_KEEPALIVE>();
 170 
 171   const oop o = Raw::oop_atomic_xchg_in_heap_at(new_value, base, offset);
 172   return ZBarrier::load_barrier_on_oop(o);
 173 }
 174 
 175 template <DecoratorSet decorators, typename BarrierSetT>
 176 template <typename T>
 177 inline bool ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
 178                                                                                        arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
 179                                                                                        size_t length) {
 180   T* src = arrayOopDesc::obj_offset_to_raw(src_obj, src_offset_in_bytes, src_raw);
 181   T* dst = arrayOopDesc::obj_offset_to_raw(dst_obj, dst_offset_in_bytes, dst_raw);
 182 
 183   if (!HasDecorator<decorators, ARRAYCOPY_CHECKCAST>::value) {
 184     // No check cast, bulk barrier and bulk copy
 185     ZBarrier::load_barrier_on_oop_array(src, length);
 186     return Raw::oop_arraycopy_in_heap(NULL, 0, src, NULL, 0, dst, length);
 187   }
 188 
 189   // Check cast and copy each elements
 190   Klass* const dst_klass = objArrayOop(dst_obj)->element_klass();
 191   for (const T* const end = src + length; src < end; src++, dst++) {


 205 template <DecoratorSet decorators, typename BarrierSetT>
 206 inline void ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::clone_in_heap(oop src, oop dst, size_t size) {
 207   ZBarrier::load_barrier_on_oop_fields(src);
 208   Raw::clone_in_heap(src, dst, size);
 209 }
 210 
 211 //
 212 // Not in heap
 213 //
 214 template <DecoratorSet decorators, typename BarrierSetT>
 215 template <typename T>
 216 inline oop ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_load_not_in_heap(T* addr) {
 217   verify_decorators_absent<ON_UNKNOWN_OOP_REF>();
 218 
 219   const oop o = Raw::oop_load_not_in_heap(addr);
 220   return load_barrier_on_oop_field_preloaded(addr, o);
 221 }
 222 
 223 template <DecoratorSet decorators, typename BarrierSetT>
 224 template <typename T>
 225 inline oop ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_cmpxchg_not_in_heap(oop new_value, T* addr, oop compare_value) {
 226   verify_decorators_present<ON_STRONG_OOP_REF>();
 227   verify_decorators_absent<AS_NO_KEEPALIVE>();
 228 
 229   return Raw::oop_atomic_cmpxchg_not_in_heap(new_value, addr, compare_value);
 230 }
 231 
 232 template <DecoratorSet decorators, typename BarrierSetT>
 233 template <typename T>
 234 inline oop ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_xchg_not_in_heap(oop new_value, T* addr) {
 235   verify_decorators_present<ON_STRONG_OOP_REF>();
 236   verify_decorators_absent<AS_NO_KEEPALIVE>();
 237 
 238   return Raw::oop_atomic_xchg_not_in_heap(new_value, addr);
 239 }
 240 
 241 #endif // SHARE_GC_Z_ZBARRIERSET_INLINE_HPP


 115   verify_decorators_absent<ON_UNKNOWN_OOP_REF>();
 116 
 117   const oop o = Raw::oop_load_in_heap(addr);
 118   return load_barrier_on_oop_field_preloaded(addr, o);
 119 }
 120 
 121 template <DecoratorSet decorators, typename BarrierSetT>
 122 inline oop ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_load_in_heap_at(oop base, ptrdiff_t offset) {
 123   oop* const addr = field_addr(base, offset);
 124   const oop o = Raw::oop_load_in_heap(addr);
 125 
 126   if (HasDecorator<decorators, ON_UNKNOWN_OOP_REF>::value) {
 127     return load_barrier_on_unknown_oop_field_preloaded(base, offset, addr, o);
 128   }
 129 
 130   return load_barrier_on_oop_field_preloaded(addr, o);
 131 }
 132 
 133 template <DecoratorSet decorators, typename BarrierSetT>
 134 template <typename T>
 135 inline oop ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_cmpxchg_in_heap(T* addr, oop compare_value, oop new_value) {
 136   verify_decorators_present<ON_STRONG_OOP_REF>();
 137   verify_decorators_absent<AS_NO_KEEPALIVE>();
 138 
 139   ZBarrier::load_barrier_on_oop_field(addr);
 140   return Raw::oop_atomic_cmpxchg_in_heap(addr, compare_value, new_value);
 141 }
 142 
 143 template <DecoratorSet decorators, typename BarrierSetT>
 144 inline oop ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_cmpxchg_in_heap_at(oop base, ptrdiff_t offset, oop compare_value, oop new_value) {
 145   verify_decorators_present<ON_STRONG_OOP_REF | ON_UNKNOWN_OOP_REF>();
 146   verify_decorators_absent<AS_NO_KEEPALIVE>();
 147 
 148   // Through Unsafe.CompareAndExchangeObject()/CompareAndSetObject() we can receive
 149   // calls with ON_UNKNOWN_OOP_REF set. However, we treat these as ON_STRONG_OOP_REF,
 150   // with the motivation that if you're doing Unsafe operations on a Reference.referent
 151   // field, then you're on your own anyway.
 152   ZBarrier::load_barrier_on_oop_field(field_addr(base, offset));
 153   return Raw::oop_atomic_cmpxchg_in_heap_at(base, offset, compare_value, new_value);
 154 }
 155 
 156 template <DecoratorSet decorators, typename BarrierSetT>
 157 template <typename T>
 158 inline oop ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_xchg_in_heap(T* addr, oop new_value) {
 159   verify_decorators_present<ON_STRONG_OOP_REF>();
 160   verify_decorators_absent<AS_NO_KEEPALIVE>();
 161 
 162   const oop o = Raw::oop_atomic_xchg_in_heap(addr, new_value);
 163   return ZBarrier::load_barrier_on_oop(o);
 164 }
 165 
 166 template <DecoratorSet decorators, typename BarrierSetT>
 167 inline oop ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_xchg_in_heap_at(oop base, ptrdiff_t offset, oop new_value) {
 168   verify_decorators_present<ON_STRONG_OOP_REF>();
 169   verify_decorators_absent<AS_NO_KEEPALIVE>();
 170 
 171   const oop o = Raw::oop_atomic_xchg_in_heap_at(base, offset, new_value);
 172   return ZBarrier::load_barrier_on_oop(o);
 173 }
 174 
 175 template <DecoratorSet decorators, typename BarrierSetT>
 176 template <typename T>
 177 inline bool ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
 178                                                                                        arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
 179                                                                                        size_t length) {
 180   T* src = arrayOopDesc::obj_offset_to_raw(src_obj, src_offset_in_bytes, src_raw);
 181   T* dst = arrayOopDesc::obj_offset_to_raw(dst_obj, dst_offset_in_bytes, dst_raw);
 182 
 183   if (!HasDecorator<decorators, ARRAYCOPY_CHECKCAST>::value) {
 184     // No check cast, bulk barrier and bulk copy
 185     ZBarrier::load_barrier_on_oop_array(src, length);
 186     return Raw::oop_arraycopy_in_heap(NULL, 0, src, NULL, 0, dst, length);
 187   }
 188 
 189   // Check cast and copy each elements
 190   Klass* const dst_klass = objArrayOop(dst_obj)->element_klass();
 191   for (const T* const end = src + length; src < end; src++, dst++) {


 205 template <DecoratorSet decorators, typename BarrierSetT>
 206 inline void ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::clone_in_heap(oop src, oop dst, size_t size) {
 207   ZBarrier::load_barrier_on_oop_fields(src);
 208   Raw::clone_in_heap(src, dst, size);
 209 }
 210 
 211 //
 212 // Not in heap
 213 //
 214 template <DecoratorSet decorators, typename BarrierSetT>
 215 template <typename T>
 216 inline oop ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_load_not_in_heap(T* addr) {
 217   verify_decorators_absent<ON_UNKNOWN_OOP_REF>();
 218 
 219   const oop o = Raw::oop_load_not_in_heap(addr);
 220   return load_barrier_on_oop_field_preloaded(addr, o);
 221 }
 222 
 223 template <DecoratorSet decorators, typename BarrierSetT>
 224 template <typename T>
 225 inline oop ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_cmpxchg_not_in_heap(T* addr, oop compare_value, oop new_value) {
 226   verify_decorators_present<ON_STRONG_OOP_REF>();
 227   verify_decorators_absent<AS_NO_KEEPALIVE>();
 228 
 229   return Raw::oop_atomic_cmpxchg_not_in_heap(addr, compare_value, new_value);
 230 }
 231 
 232 template <DecoratorSet decorators, typename BarrierSetT>
 233 template <typename T>
 234 inline oop ZBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_atomic_xchg_not_in_heap(T* addr, oop new_value) {
 235   verify_decorators_present<ON_STRONG_OOP_REF>();
 236   verify_decorators_absent<AS_NO_KEEPALIVE>();
 237 
 238   return Raw::oop_atomic_xchg_not_in_heap(addr, new_value);
 239 }
 240 
 241 #endif // SHARE_GC_Z_ZBARRIERSET_INLINE_HPP
< prev index next >