105 }; |
105 }; |
106 |
106 |
107 template <class GCBarrierType, DecoratorSet decorators> |
107 template <class GCBarrierType, DecoratorSet decorators> |
108 struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_CMPXCHG, decorators>: public AllStatic { |
108 struct PostRuntimeDispatch<GCBarrierType, BARRIER_ATOMIC_CMPXCHG, decorators>: public AllStatic { |
109 template <typename T> |
109 template <typename T> |
110 static T access_barrier(T new_value, void* addr, T compare_value) { |
110 static T access_barrier(void* addr, T compare_value, T new_value) { |
111 return GCBarrierType::atomic_cmpxchg_in_heap(new_value, reinterpret_cast<T*>(addr), compare_value); |
111 return GCBarrierType::atomic_cmpxchg_in_heap(reinterpret_cast<T*>(addr), compare_value, new_value); |
112 } |
112 } |
113 |
113 |
114 static oop oop_access_barrier(oop new_value, void* addr, oop compare_value) { |
114 static oop oop_access_barrier(void* addr, oop compare_value, oop new_value) { |
115 typedef typename HeapOopType<decorators>::type OopType; |
115 typedef typename HeapOopType<decorators>::type OopType; |
116 if (HasDecorator<decorators, IN_HEAP>::value) { |
116 if (HasDecorator<decorators, IN_HEAP>::value) { |
117 return GCBarrierType::oop_atomic_cmpxchg_in_heap(new_value, reinterpret_cast<OopType*>(addr), compare_value); |
117 return GCBarrierType::oop_atomic_cmpxchg_in_heap(reinterpret_cast<OopType*>(addr), compare_value, new_value); |
118 } else { |
118 } else { |
119 return GCBarrierType::oop_atomic_cmpxchg_not_in_heap(new_value, reinterpret_cast<OopType*>(addr), compare_value); |
119 return GCBarrierType::oop_atomic_cmpxchg_not_in_heap(reinterpret_cast<OopType*>(addr), compare_value, new_value); |
120 } |
120 } |
121 } |
121 } |
122 }; |
122 }; |
123 |
123 |
124 template <class GCBarrierType, DecoratorSet decorators> |
124 template <class GCBarrierType, DecoratorSet decorators> |
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 { |
185 template <typename T> |
185 template <typename T> |
186 static T access_barrier(T new_value, oop base, ptrdiff_t offset, T compare_value) { |
186 static T access_barrier(oop base, ptrdiff_t offset, T compare_value, T new_value) { |
187 return GCBarrierType::atomic_cmpxchg_in_heap_at(new_value, base, offset, compare_value); |
187 return GCBarrierType::atomic_cmpxchg_in_heap_at(base, offset, compare_value, new_value); |
188 } |
188 } |
189 |
189 |
190 static oop oop_access_barrier(oop new_value, oop base, ptrdiff_t offset, oop compare_value) { |
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(new_value, base, offset, compare_value); |
191 return GCBarrierType::oop_atomic_cmpxchg_in_heap_at(base, offset, compare_value, new_value); |
192 } |
192 } |
193 }; |
193 }; |
194 |
194 |
195 template <class GCBarrierType, DecoratorSet decorators> |
195 template <class GCBarrierType, DecoratorSet decorators> |
196 struct PostRuntimeDispatch<GCBarrierType, BARRIER_CLONE, decorators>: public AllStatic { |
196 struct PostRuntimeDispatch<GCBarrierType, BARRIER_CLONE, decorators>: public AllStatic { |
307 _load_at_func = function; |
307 _load_at_func = function; |
308 return function(base, offset); |
308 return function(base, offset); |
309 } |
309 } |
310 |
310 |
311 template <DecoratorSet decorators, typename T> |
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) { |
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(); |
313 func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_CMPXCHG>::resolve_barrier(); |
314 _atomic_cmpxchg_func = function; |
314 _atomic_cmpxchg_func = function; |
315 return function(new_value, addr, compare_value); |
315 return function(addr, compare_value, new_value); |
316 } |
316 } |
317 |
317 |
318 template <DecoratorSet decorators, typename T> |
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) { |
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(); |
320 func_t function = BarrierResolver<decorators, func_t, BARRIER_ATOMIC_CMPXCHG_AT>::resolve_barrier(); |
321 _atomic_cmpxchg_at_func = function; |
321 _atomic_cmpxchg_at_func = function; |
322 return function(new_value, base, offset, compare_value); |
322 return function(base, offset, compare_value, new_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(void* addr, T new_value) { |
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(); |