src/hotspot/share/oops/access.inline.hpp
changeset 59251 4cbfa5077d68
parent 58176 470af058bd5f
child 59252 623722a6aeb9
equal deleted inserted replaced
59250:a6deb69743d4 59251:4cbfa5077d68
    88   };
    88   };
    89 
    89 
    90   template <class GCBarrierType, DecoratorSet decorators>
    90   template <class GCBarrierType, DecoratorSet decorators>
    91   struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_XCHG, decorators>: public AllStatic {
    91   struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_XCHG, decorators>: public AllStatic {
    92     template <typename T>
    92     template <typename T>
    93     static T access_barrier(T new_value, void* addr) {
    93     static T access_barrier(void* addr, T new_value) {
    94       return GCBarrierType::atomic_xchg_in_heap(new_value, reinterpret_cast<T*>(addr));
    94       return GCBarrierType::atomic_xchg_in_heap(reinterpret_cast<T*>(addr), new_value);
    95     }
    95     }
    96 
    96 
    97     static oop oop_access_barrier(oop new_value, void* addr) {
    97     static oop oop_access_barrier(void* addr, oop new_value) {
    98       typedef typename HeapOopType<decorators>::type OopType;
    98       typedef typename HeapOopType<decorators>::type OopType;
    99       if (HasDecorator<decorators, IN_HEAP>::value) {
    99       if (HasDecorator<decorators, IN_HEAP>::value) {
   100         return GCBarrierType::oop_atomic_xchg_in_heap(new_value, reinterpret_cast<OopType*>(addr));
   100         return GCBarrierType::oop_atomic_xchg_in_heap(reinterpret_cast<OopType*>(addr), new_value);
   101       } else {
   101       } else {
   102         return GCBarrierType::oop_atomic_xchg_not_in_heap(new_value, reinterpret_cast<OopType*>(addr));
   102         return GCBarrierType::oop_atomic_xchg_not_in_heap(reinterpret_cast<OopType*>(addr), new_value);
   103       }
   103       }
   104     }
   104     }
   105   };
   105   };
   106 
   106 
   107   template <class GCBarrierType, DecoratorSet decorators>
   107   template <class GCBarrierType, DecoratorSet decorators>
   169   };
   169   };
   170 
   170 
   171   template <class GCBarrierType, DecoratorSet decorators>
   171   template <class GCBarrierType, DecoratorSet decorators>
   172   struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_XCHG_AT, decorators>: public AllStatic {
   172   struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_XCHG_AT, decorators>: public AllStatic {
   173     template <typename T>
   173     template <typename T>
   174     static T access_barrier(T new_value, oop base, ptrdiff_t offset) {
   174     static T access_barrier(oop base, ptrdiff_t offset, T new_value) {
   175       return GCBarrierType::atomic_xchg_in_heap_at(new_value, base, offset);
   175       return GCBarrierType::atomic_xchg_in_heap_at(base, offset, new_value);
   176     }
   176     }
   177 
   177 
   178     static oop oop_access_barrier(oop new_value, oop base, ptrdiff_t offset) {
   178     static oop oop_access_barrier(oop base, ptrdiff_t offset, oop new_value) {
   179       return GCBarrierType::oop_atomic_xchg_in_heap_at(new_value, base, offset);
   179       return GCBarrierType::oop_atomic_xchg_in_heap_at(base, offset, new_value);
   180     }
   180     }
   181   };
   181   };
   182 
   182 
   183   template <class GCBarrierType, DecoratorSet decorators>
   183   template <class GCBarrierType, DecoratorSet decorators>
   184   struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_CMPXCHG_AT, decorators>: public AllStatic {
   184   struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_CMPXCHG_AT, decorators>: public AllStatic {
   321     _atomic_cmpxchg_at_func = function;
   321     _atomic_cmpxchg_at_func = function;
   322     return function(new_value, base, offset, compare_value);
   322     return function(new_value, base, offset, compare_value);
   323   }
   323   }
   324 
   324 
   325   template <DecoratorSet decorators, typename T>
   325   template <DecoratorSet decorators, typename T>
   326   T RuntimeDispatch<decorators, T, BARRIER_ATOMIC_XCHG>::atomic_xchg_init(T new_value, void* addr) {
   326   T RuntimeDispatch<decorators, T, BARRIER_ATOMIC_XCHG>::atomic_xchg_init(void* addr, T new_value) {
   327     func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_XCHG>::resolve_barrier();
   327     func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_XCHG>::resolve_barrier();
   328     _atomic_xchg_func = function;
   328     _atomic_xchg_func = function;
   329     return function(new_value, addr);
   329     return function(addr, new_value);
   330   }
   330   }
   331 
   331 
   332   template <DecoratorSet decorators, typename T>
   332   template <DecoratorSet decorators, typename T>
   333   T RuntimeDispatch<decorators, T, BARRIER_ATOMIC_XCHG_AT>::atomic_xchg_at_init(T new_value, oop base, ptrdiff_t offset) {
   333   T RuntimeDispatch<decorators, T, BARRIER_ATOMIC_XCHG_AT>::atomic_xchg_at_init(oop base, ptrdiff_t offset, T new_value) {
   334     func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_XCHG_AT>::resolve_barrier();
   334     func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_XCHG_AT>::resolve_barrier();
   335     _atomic_xchg_at_func = function;
   335     _atomic_xchg_at_func = function;
   336     return function(new_value, base, offset);
   336     return function(base, offset, new_value);
   337   }
   337   }
   338 
   338 
   339   template <DecoratorSet decorators, typename T>
   339   template <DecoratorSet decorators, typename T>
   340   bool RuntimeDispatch<decorators, T, BARRIER_ARRAYCOPY>::arraycopy_init(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
   340   bool RuntimeDispatch<decorators, T, BARRIER_ARRAYCOPY>::arraycopy_init(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
   341                                                                          arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
   341                                                                          arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,