< prev index next >

src/hotspot/share/oops/access.inline.hpp

Print this page




  73   template <class GCBarrierType, DecoratorSet decorators>
  74   struct PostRuntimeDispatch<GCBarrierType, BARRIER_LOAD, decorators>: public AllStatic {
  75     template <typename T>
  76     static T access_barrier(void* addr) {
  77       return GCBarrierType::load_in_heap(reinterpret_cast<T*>(addr));
  78     }
  79 
  80     static oop oop_access_barrier(void* addr) {
  81       typedef typename HeapOopType<decorators>::type OopType;
  82       if (HasDecorator<decorators, IN_HEAP>::value) {
  83         return GCBarrierType::oop_load_in_heap(reinterpret_cast<OopType*>(addr));
  84       } else {
  85         return GCBarrierType::oop_load_not_in_heap(reinterpret_cast<OopType*>(addr));
  86       }
  87     }
  88   };
  89 
  90   template <class GCBarrierType, DecoratorSet decorators>
  91   struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_XCHG, decorators>: public AllStatic {
  92     template <typename T>
  93     static T access_barrier(T new_value, void* addr) {
  94       return GCBarrierType::atomic_xchg_in_heap(new_value, reinterpret_cast<T*>(addr));
  95     }
  96 
  97     static oop oop_access_barrier(oop new_value, void* addr) {
  98       typedef typename HeapOopType<decorators>::type OopType;
  99       if (HasDecorator<decorators, IN_HEAP>::value) {
 100         return GCBarrierType::oop_atomic_xchg_in_heap(new_value, reinterpret_cast<OopType*>(addr));
 101       } else {
 102         return GCBarrierType::oop_atomic_xchg_not_in_heap(new_value, reinterpret_cast<OopType*>(addr));
 103       }
 104     }
 105   };
 106 
 107   template <class GCBarrierType, DecoratorSet decorators>
 108   struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_CMPXCHG, decorators>: public AllStatic {
 109     template <typename T>
 110     static T access_barrier(T new_value, void* addr, T compare_value) {
 111       return GCBarrierType::atomic_cmpxchg_in_heap(new_value, reinterpret_cast<T*>(addr), compare_value);
 112     }
 113 
 114     static oop oop_access_barrier(oop new_value, void* addr, oop compare_value) {
 115       typedef typename HeapOopType<decorators>::type OopType;
 116       if (HasDecorator<decorators, IN_HEAP>::value) {
 117         return GCBarrierType::oop_atomic_cmpxchg_in_heap(new_value, reinterpret_cast<OopType*>(addr), compare_value);
 118       } else {
 119         return GCBarrierType::oop_atomic_cmpxchg_not_in_heap(new_value, reinterpret_cast<OopType*>(addr), compare_value);
 120       }
 121     }
 122   };
 123 
 124   template <class GCBarrierType, DecoratorSet decorators>
 125   struct PostRuntimeDispatch<GCBarrierType, BARRIER_ARRAYCOPY, decorators>: public AllStatic {
 126     template <typename T>
 127     static bool access_barrier(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
 128                                arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
 129                                size_t length) {
 130       GCBarrierType::arraycopy_in_heap(src_obj, src_offset_in_bytes, src_raw,
 131                                        dst_obj, dst_offset_in_bytes, dst_raw,
 132                                        length);
 133       return true;
 134     }
 135 
 136     template <typename T>
 137     static bool oop_access_barrier(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
 138                                    arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
 139                                    size_t length) {


 154     static void oop_access_barrier(oop base, ptrdiff_t offset, oop value) {
 155       GCBarrierType::oop_store_in_heap_at(base, offset, value);
 156     }
 157   };
 158 
 159   template <class GCBarrierType, DecoratorSet decorators>
 160   struct PostRuntimeDispatch<GCBarrierType, BARRIER_LOAD_AT, decorators>: public AllStatic {
 161     template <typename T>
 162     static T access_barrier(oop base, ptrdiff_t offset) {
 163       return GCBarrierType::template load_in_heap_at<T>(base, offset);
 164     }
 165 
 166     static oop oop_access_barrier(oop base, ptrdiff_t offset) {
 167       return GCBarrierType::oop_load_in_heap_at(base, offset);
 168     }
 169   };
 170 
 171   template <class GCBarrierType, DecoratorSet decorators>
 172   struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_XCHG_AT, decorators>: public AllStatic {
 173     template <typename T>
 174     static T access_barrier(T new_value, oop base, ptrdiff_t offset) {
 175       return GCBarrierType::atomic_xchg_in_heap_at(new_value, base, offset);
 176     }
 177 
 178     static oop oop_access_barrier(oop new_value, oop base, ptrdiff_t offset) {
 179       return GCBarrierType::oop_atomic_xchg_in_heap_at(new_value, base, offset);
 180     }
 181   };
 182 
 183   template <class GCBarrierType, DecoratorSet decorators>
 184   struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_CMPXCHG_AT, decorators>: public AllStatic {
 185     template <typename T>
 186     static T access_barrier(T new_value, oop base, ptrdiff_t offset, T compare_value) {
 187       return GCBarrierType::atomic_cmpxchg_in_heap_at(new_value, base, offset, compare_value);
 188     }
 189 
 190     static oop oop_access_barrier(oop new_value, oop base, ptrdiff_t offset, oop compare_value) {
 191       return GCBarrierType::oop_atomic_cmpxchg_in_heap_at(new_value, base, offset, compare_value);
 192     }
 193   };
 194 
 195   template <class GCBarrierType, DecoratorSet decorators>
 196   struct PostRuntimeDispatch<GCBarrierType, BARRIER_CLONE, decorators>: public AllStatic {
 197     static void access_barrier(oop src, oop dst, size_t size) {
 198       GCBarrierType::clone_in_heap(src, dst, size);
 199     }
 200   };
 201 
 202   template <class GCBarrierType, DecoratorSet decorators>
 203   struct PostRuntimeDispatch<GCBarrierType, BARRIER_RESOLVE, decorators>: public AllStatic {
 204     static oop access_barrier(oop obj) {
 205       return GCBarrierType::resolve(obj);
 206     }
 207   };
 208 
 209   // Resolving accessors with barriers from the barrier set happens in two steps.
 210   // 1. Expand paths with runtime-decorators, e.g. is UseCompressedOops on or off.
 211   // 2. Expand paths for each BarrierSet available in the system.


 292     func_t function = BarrierResolver<decorators, func_t, BARRIER_STORE_AT>::resolve_barrier();
 293     _store_at_func = function;
 294     function(base, offset, value);
 295   }
 296 
 297   template <DecoratorSet decorators, typename T>
 298   T RuntimeDispatch<decorators, T, BARRIER_LOAD>::load_init(void* addr) {
 299     func_t function = BarrierResolver<decorators, func_t, BARRIER_LOAD>::resolve_barrier();
 300     _load_func = function;
 301     return function(addr);
 302   }
 303 
 304   template <DecoratorSet decorators, typename T>
 305   T RuntimeDispatch<decorators, T, BARRIER_LOAD_AT>::load_at_init(oop base, ptrdiff_t offset) {
 306     func_t function = BarrierResolver<decorators, func_t, BARRIER_LOAD_AT>::resolve_barrier();
 307     _load_at_func = function;
 308     return function(base, offset);
 309   }
 310 
 311   template <DecoratorSet decorators, typename T>
 312   T RuntimeDispatch<decorators, T, BARRIER_ATOMIC_CMPXCHG>::atomic_cmpxchg_init(T new_value, void* addr, T compare_value) {
 313     func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_CMPXCHG>::resolve_barrier();
 314     _atomic_cmpxchg_func = function;
 315     return function(new_value, addr, compare_value);
 316   }
 317 
 318   template <DecoratorSet decorators, typename T>
 319   T RuntimeDispatch<decorators, T, BARRIER_ATOMIC_CMPXCHG_AT>::atomic_cmpxchg_at_init(T new_value, oop base, ptrdiff_t offset, T compare_value) {
 320     func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_CMPXCHG_AT>::resolve_barrier();
 321     _atomic_cmpxchg_at_func = function;
 322     return function(new_value, base, offset, compare_value);
 323   }
 324 
 325   template <DecoratorSet decorators, typename T>
 326   T RuntimeDispatch<decorators, T, BARRIER_ATOMIC_XCHG>::atomic_xchg_init(T new_value, void* addr) {
 327     func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_XCHG>::resolve_barrier();
 328     _atomic_xchg_func = function;
 329     return function(new_value, addr);
 330   }
 331 
 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) {
 334     func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_XCHG_AT>::resolve_barrier();
 335     _atomic_xchg_at_func = function;
 336     return function(new_value, base, offset);
 337   }
 338 
 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,
 341                                                                          arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
 342                                                                          size_t length) {
 343     func_t function = BarrierResolver<decorators, func_t, BARRIER_ARRAYCOPY>::resolve_barrier();
 344     _arraycopy_func = function;
 345     return function(src_obj, src_offset_in_bytes, src_raw,
 346                     dst_obj, dst_offset_in_bytes, dst_raw,
 347                     length);
 348   }
 349 
 350   template <DecoratorSet decorators, typename T>
 351   void RuntimeDispatch<decorators, T, BARRIER_CLONE>::clone_init(oop src, oop dst, size_t size) {
 352     func_t function = BarrierResolver<decorators, func_t, BARRIER_CLONE>::resolve_barrier();
 353     _clone_func = function;
 354     function(src, dst, size);
 355   }
 356 


  73   template <class GCBarrierType, DecoratorSet decorators>
  74   struct PostRuntimeDispatch<GCBarrierType, BARRIER_LOAD, decorators>: public AllStatic {
  75     template <typename T>
  76     static T access_barrier(void* addr) {
  77       return GCBarrierType::load_in_heap(reinterpret_cast<T*>(addr));
  78     }
  79 
  80     static oop oop_access_barrier(void* addr) {
  81       typedef typename HeapOopType<decorators>::type OopType;
  82       if (HasDecorator<decorators, IN_HEAP>::value) {
  83         return GCBarrierType::oop_load_in_heap(reinterpret_cast<OopType*>(addr));
  84       } else {
  85         return GCBarrierType::oop_load_not_in_heap(reinterpret_cast<OopType*>(addr));
  86       }
  87     }
  88   };
  89 
  90   template <class GCBarrierType, DecoratorSet decorators>
  91   struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_XCHG, decorators>: public AllStatic {
  92     template <typename T>
  93     static T access_barrier(void* addr, T new_value) {
  94       return GCBarrierType::atomic_xchg_in_heap(reinterpret_cast<T*>(addr), new_value);
  95     }
  96 
  97     static oop oop_access_barrier(void* addr, oop new_value) {
  98       typedef typename HeapOopType<decorators>::type OopType;
  99       if (HasDecorator<decorators, IN_HEAP>::value) {
 100         return GCBarrierType::oop_atomic_xchg_in_heap(reinterpret_cast<OopType*>(addr), new_value);
 101       } else {
 102         return GCBarrierType::oop_atomic_xchg_not_in_heap(reinterpret_cast<OopType*>(addr), new_value);
 103       }
 104     }
 105   };
 106 
 107   template <class GCBarrierType, DecoratorSet decorators>
 108   struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_CMPXCHG, decorators>: public AllStatic {
 109     template <typename T>
 110     static T access_barrier(void* addr, T compare_value, T new_value) {
 111       return GCBarrierType::atomic_cmpxchg_in_heap(reinterpret_cast<T*>(addr), compare_value, new_value);
 112     }
 113 
 114     static oop oop_access_barrier(void* addr, oop compare_value, oop new_value) {
 115       typedef typename HeapOopType<decorators>::type OopType;
 116       if (HasDecorator<decorators, IN_HEAP>::value) {
 117         return GCBarrierType::oop_atomic_cmpxchg_in_heap(reinterpret_cast<OopType*>(addr), compare_value, new_value);
 118       } else {
 119         return GCBarrierType::oop_atomic_cmpxchg_not_in_heap(reinterpret_cast<OopType*>(addr), compare_value, new_value);
 120       }
 121     }
 122   };
 123 
 124   template <class GCBarrierType, DecoratorSet decorators>
 125   struct PostRuntimeDispatch<GCBarrierType, BARRIER_ARRAYCOPY, decorators>: public AllStatic {
 126     template <typename T>
 127     static bool access_barrier(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
 128                                arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
 129                                size_t length) {
 130       GCBarrierType::arraycopy_in_heap(src_obj, src_offset_in_bytes, src_raw,
 131                                        dst_obj, dst_offset_in_bytes, dst_raw,
 132                                        length);
 133       return true;
 134     }
 135 
 136     template <typename T>
 137     static bool oop_access_barrier(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
 138                                    arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
 139                                    size_t length) {


 154     static void oop_access_barrier(oop base, ptrdiff_t offset, oop value) {
 155       GCBarrierType::oop_store_in_heap_at(base, offset, value);
 156     }
 157   };
 158 
 159   template <class GCBarrierType, DecoratorSet decorators>
 160   struct PostRuntimeDispatch<GCBarrierType, BARRIER_LOAD_AT, decorators>: public AllStatic {
 161     template <typename T>
 162     static T access_barrier(oop base, ptrdiff_t offset) {
 163       return GCBarrierType::template load_in_heap_at<T>(base, offset);
 164     }
 165 
 166     static oop oop_access_barrier(oop base, ptrdiff_t offset) {
 167       return GCBarrierType::oop_load_in_heap_at(base, offset);
 168     }
 169   };
 170 
 171   template <class GCBarrierType, DecoratorSet decorators>
 172   struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_XCHG_AT, decorators>: public AllStatic {
 173     template <typename T>
 174     static T access_barrier(oop base, ptrdiff_t offset, T new_value) {
 175       return GCBarrierType::atomic_xchg_in_heap_at(base, offset, new_value);
 176     }
 177 
 178     static oop oop_access_barrier(oop base, ptrdiff_t offset, oop new_value) {
 179       return GCBarrierType::oop_atomic_xchg_in_heap_at(base, offset, new_value);
 180     }
 181   };
 182 
 183   template <class GCBarrierType, DecoratorSet decorators>
 184   struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_CMPXCHG_AT, decorators>: public AllStatic {
 185     template <typename T>
 186     static T access_barrier(oop base, ptrdiff_t offset, T compare_value, T new_value) {
 187       return GCBarrierType::atomic_cmpxchg_in_heap_at(base, offset, compare_value, new_value);
 188     }
 189 
 190     static oop oop_access_barrier(oop base, ptrdiff_t offset, oop compare_value, oop new_value) {
 191       return GCBarrierType::oop_atomic_cmpxchg_in_heap_at(base, offset, compare_value, new_value);
 192     }
 193   };
 194 
 195   template <class GCBarrierType, DecoratorSet decorators>
 196   struct PostRuntimeDispatch<GCBarrierType, BARRIER_CLONE, decorators>: public AllStatic {
 197     static void access_barrier(oop src, oop dst, size_t size) {
 198       GCBarrierType::clone_in_heap(src, dst, size);
 199     }
 200   };
 201 
 202   template <class GCBarrierType, DecoratorSet decorators>
 203   struct PostRuntimeDispatch<GCBarrierType, BARRIER_RESOLVE, decorators>: public AllStatic {
 204     static oop access_barrier(oop obj) {
 205       return GCBarrierType::resolve(obj);
 206     }
 207   };
 208 
 209   // Resolving accessors with barriers from the barrier set happens in two steps.
 210   // 1. Expand paths with runtime-decorators, e.g. is UseCompressedOops on or off.
 211   // 2. Expand paths for each BarrierSet available in the system.


 292     func_t function = BarrierResolver<decorators, func_t, BARRIER_STORE_AT>::resolve_barrier();
 293     _store_at_func = function;
 294     function(base, offset, value);
 295   }
 296 
 297   template <DecoratorSet decorators, typename T>
 298   T RuntimeDispatch<decorators, T, BARRIER_LOAD>::load_init(void* addr) {
 299     func_t function = BarrierResolver<decorators, func_t, BARRIER_LOAD>::resolve_barrier();
 300     _load_func = function;
 301     return function(addr);
 302   }
 303 
 304   template <DecoratorSet decorators, typename T>
 305   T RuntimeDispatch<decorators, T, BARRIER_LOAD_AT>::load_at_init(oop base, ptrdiff_t offset) {
 306     func_t function = BarrierResolver<decorators, func_t, BARRIER_LOAD_AT>::resolve_barrier();
 307     _load_at_func = function;
 308     return function(base, offset);
 309   }
 310 
 311   template <DecoratorSet decorators, typename T>
 312   T RuntimeDispatch<decorators, T, BARRIER_ATOMIC_CMPXCHG>::atomic_cmpxchg_init(void* addr, T compare_value, T new_value) {
 313     func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_CMPXCHG>::resolve_barrier();
 314     _atomic_cmpxchg_func = function;
 315     return function(addr, compare_value, new_value);
 316   }
 317 
 318   template <DecoratorSet decorators, typename T>
 319   T RuntimeDispatch<decorators, T, BARRIER_ATOMIC_CMPXCHG_AT>::atomic_cmpxchg_at_init(oop base, ptrdiff_t offset, T compare_value, T new_value) {
 320     func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_CMPXCHG_AT>::resolve_barrier();
 321     _atomic_cmpxchg_at_func = function;
 322     return function(base, offset, compare_value, new_value);
 323   }
 324 
 325   template <DecoratorSet decorators, typename T>
 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();
 328     _atomic_xchg_func = function;
 329     return function(addr, new_value);
 330   }
 331 
 332   template <DecoratorSet decorators, typename T>
 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();
 335     _atomic_xchg_at_func = function;
 336     return function(base, offset, new_value);
 337   }
 338 
 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,
 341                                                                          arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
 342                                                                          size_t length) {
 343     func_t function = BarrierResolver<decorators, func_t, BARRIER_ARRAYCOPY>::resolve_barrier();
 344     _arraycopy_func = function;
 345     return function(src_obj, src_offset_in_bytes, src_raw,
 346                     dst_obj, dst_offset_in_bytes, dst_raw,
 347                     length);
 348   }
 349 
 350   template <DecoratorSet decorators, typename T>
 351   void RuntimeDispatch<decorators, T, BARRIER_CLONE>::clone_init(oop src, oop dst, size_t size) {
 352     func_t function = BarrierResolver<decorators, func_t, BARRIER_CLONE>::resolve_barrier();
 353     _clone_func = function;
 354     function(src, dst, size);
 355   }
 356 
< prev index next >