< prev index next >

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

Print this page

183 
184   template <class GCBarrierType, DecoratorSet decorators>
185   struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_CMPXCHG_AT, decorators>: public AllStatic {
186     template <typename T>
187     static T access_barrier(oop base, ptrdiff_t offset, T compare_value, T new_value) {
188       return GCBarrierType::atomic_cmpxchg_in_heap_at(base, offset, compare_value, new_value);
189     }
190 
191     static oop oop_access_barrier(oop base, ptrdiff_t offset, oop compare_value, oop new_value) {
192       return GCBarrierType::oop_atomic_cmpxchg_in_heap_at(base, offset, compare_value, new_value);
193     }
194   };
195 
196   template <class GCBarrierType, DecoratorSet decorators>
197   struct PostRuntimeDispatch<GCBarrierType, BARRIER_CLONE, decorators>: public AllStatic {
198     static void access_barrier(oop src, oop dst, size_t size) {
199       GCBarrierType::clone_in_heap(src, dst, size);
200     }
201   };
202 







203   // Resolving accessors with barriers from the barrier set happens in two steps.
204   // 1. Expand paths with runtime-decorators, e.g. is UseCompressedOops on or off.
205   // 2. Expand paths for each BarrierSet available in the system.
206   template <DecoratorSet decorators, typename FunctionPointerT, BarrierType barrier_type>
207   struct BarrierResolver: public AllStatic {
208     template <DecoratorSet ds>
209     static typename EnableIf<
210       HasDecorator<ds, INTERNAL_VALUE_IS_OOP>::value,
211       FunctionPointerT>::type
212     resolve_barrier_gc() {
213       BarrierSet* bs = BarrierSet::barrier_set();
214       assert(bs != nullptr, "GC barriers invoked before BarrierSet is set");
215       switch (bs->kind()) {
216 #define BARRIER_SET_RESOLVE_BARRIER_CLOSURE(bs_name)                    \
217         case BarrierSet::bs_name: {                                     \
218           return PostRuntimeDispatch<typename BarrierSet::GetType<BarrierSet::bs_name>::type:: \
219             AccessBarrier<ds>, barrier_type, ds>::oop_access_barrier; \
220         }                                                               \
221         break;
222         FOR_EACH_BARRIER_SET_DO(BARRIER_SET_RESOLVE_BARRIER_CLOSURE)

330     return function(base, offset, new_value);
331   }
332 
333   template <DecoratorSet decorators, typename T>
334   OopCopyResult RuntimeDispatch<decorators, T, BARRIER_ARRAYCOPY>::arraycopy_init(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
335                                                                                   arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
336                                                                                   size_t length) {
337     func_t function = BarrierResolver<decorators, func_t, BARRIER_ARRAYCOPY>::resolve_barrier();
338     _arraycopy_func = function;
339     return function(src_obj, src_offset_in_bytes, src_raw,
340                     dst_obj, dst_offset_in_bytes, dst_raw,
341                     length);
342   }
343 
344   template <DecoratorSet decorators, typename T>
345   void RuntimeDispatch<decorators, T, BARRIER_CLONE>::clone_init(oop src, oop dst, size_t size) {
346     func_t function = BarrierResolver<decorators, func_t, BARRIER_CLONE>::resolve_barrier();
347     _clone_func = function;
348     function(src, dst, size);
349   }







350 }
351 
352 #endif // SHARE_OOPS_ACCESS_INLINE_HPP

183 
184   template <class GCBarrierType, DecoratorSet decorators>
185   struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_CMPXCHG_AT, decorators>: public AllStatic {
186     template <typename T>
187     static T access_barrier(oop base, ptrdiff_t offset, T compare_value, T new_value) {
188       return GCBarrierType::atomic_cmpxchg_in_heap_at(base, offset, compare_value, new_value);
189     }
190 
191     static oop oop_access_barrier(oop base, ptrdiff_t offset, oop compare_value, oop new_value) {
192       return GCBarrierType::oop_atomic_cmpxchg_in_heap_at(base, offset, compare_value, new_value);
193     }
194   };
195 
196   template <class GCBarrierType, DecoratorSet decorators>
197   struct PostRuntimeDispatch<GCBarrierType, BARRIER_CLONE, decorators>: public AllStatic {
198     static void access_barrier(oop src, oop dst, size_t size) {
199       GCBarrierType::clone_in_heap(src, dst, size);
200     }
201   };
202 
203   template <class GCBarrierType, DecoratorSet decorators>
204   struct PostRuntimeDispatch<GCBarrierType, BARRIER_VALUE_COPY, decorators>: public AllStatic {
205     static void access_barrier(void* src, void* dst, InlineKlass* md, LayoutKind lk) {
206       GCBarrierType::value_copy_in_heap(src, dst, md, lk);
207     }
208   };
209 
210   // Resolving accessors with barriers from the barrier set happens in two steps.
211   // 1. Expand paths with runtime-decorators, e.g. is UseCompressedOops on or off.
212   // 2. Expand paths for each BarrierSet available in the system.
213   template <DecoratorSet decorators, typename FunctionPointerT, BarrierType barrier_type>
214   struct BarrierResolver: public AllStatic {
215     template <DecoratorSet ds>
216     static typename EnableIf<
217       HasDecorator<ds, INTERNAL_VALUE_IS_OOP>::value,
218       FunctionPointerT>::type
219     resolve_barrier_gc() {
220       BarrierSet* bs = BarrierSet::barrier_set();
221       assert(bs != nullptr, "GC barriers invoked before BarrierSet is set");
222       switch (bs->kind()) {
223 #define BARRIER_SET_RESOLVE_BARRIER_CLOSURE(bs_name)                    \
224         case BarrierSet::bs_name: {                                     \
225           return PostRuntimeDispatch<typename BarrierSet::GetType<BarrierSet::bs_name>::type:: \
226             AccessBarrier<ds>, barrier_type, ds>::oop_access_barrier; \
227         }                                                               \
228         break;
229         FOR_EACH_BARRIER_SET_DO(BARRIER_SET_RESOLVE_BARRIER_CLOSURE)

337     return function(base, offset, new_value);
338   }
339 
340   template <DecoratorSet decorators, typename T>
341   OopCopyResult RuntimeDispatch<decorators, T, BARRIER_ARRAYCOPY>::arraycopy_init(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
342                                                                                   arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
343                                                                                   size_t length) {
344     func_t function = BarrierResolver<decorators, func_t, BARRIER_ARRAYCOPY>::resolve_barrier();
345     _arraycopy_func = function;
346     return function(src_obj, src_offset_in_bytes, src_raw,
347                     dst_obj, dst_offset_in_bytes, dst_raw,
348                     length);
349   }
350 
351   template <DecoratorSet decorators, typename T>
352   void RuntimeDispatch<decorators, T, BARRIER_CLONE>::clone_init(oop src, oop dst, size_t size) {
353     func_t function = BarrierResolver<decorators, func_t, BARRIER_CLONE>::resolve_barrier();
354     _clone_func = function;
355     function(src, dst, size);
356   }
357 
358   template <DecoratorSet decorators, typename T>
359   void RuntimeDispatch<decorators, T, BARRIER_VALUE_COPY>::value_copy_init(void* src, void* dst, InlineKlass* md, LayoutKind lk) {
360     func_t function = BarrierResolver<decorators, func_t, BARRIER_VALUE_COPY>::resolve_barrier();
361     _value_copy_func = function;
362     function(src, dst, md,lk);
363   }
364 }
365 
366 #endif // SHARE_OOPS_ACCESS_INLINE_HPP
< prev index next >