87 struct PossiblyLockedAccess: public IntegralConstant<bool, (sizeof(T) > 4)> {};
88 #endif
89
90 template <DecoratorSet decorators, typename T>
91 struct AccessFunctionTypes {
92 typedef T (*load_at_func_t)(oop base, ptrdiff_t offset);
93 typedef void (*store_at_func_t)(oop base, ptrdiff_t offset, T value);
94 typedef T (*atomic_cmpxchg_at_func_t)(T new_value, oop base, ptrdiff_t offset, T compare_value);
95 typedef T (*atomic_xchg_at_func_t)(T new_value, oop base, ptrdiff_t offset);
96
97 typedef T (*load_func_t)(void* addr);
98 typedef void (*store_func_t)(void* addr, T value);
99 typedef T (*atomic_cmpxchg_func_t)(T new_value, void* addr, T compare_value);
100 typedef T (*atomic_xchg_func_t)(T new_value, void* addr);
101
102 typedef bool (*arraycopy_func_t)(arrayOop src_obj, arrayOop dst_obj, T* src, T* dst, size_t length);
103 typedef void (*clone_func_t)(oop src, oop dst, size_t size);
104 typedef oop (*resolve_func_t)(oop obj);
105 };
106
107 template <DecoratorSet decorators, typename T, BarrierType barrier> struct AccessFunction {};
108
109 #define ACCESS_GENERATE_ACCESS_FUNCTION(bt, func) \
110 template <DecoratorSet decorators, typename T> \
111 struct AccessFunction<decorators, T, bt>: AllStatic{ \
112 typedef typename AccessFunctionTypes<decorators, T>::func type; \
113 }
114 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_STORE, store_func_t);
115 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_STORE_AT, store_at_func_t);
116 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_LOAD, load_func_t);
117 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_LOAD_AT, load_at_func_t);
118 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_ATOMIC_CMPXCHG, atomic_cmpxchg_func_t);
119 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_ATOMIC_CMPXCHG_AT, atomic_cmpxchg_at_func_t);
120 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_ATOMIC_XCHG, atomic_xchg_func_t);
121 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_ATOMIC_XCHG_AT, atomic_xchg_at_func_t);
122 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_ARRAYCOPY, arraycopy_func_t);
123 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_CLONE, clone_func_t);
124 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_RESOLVE, resolve_func_t);
125 #undef ACCESS_GENERATE_ACCESS_FUNCTION
126
318 static inline void store(void* addr, T value) {
319 store_internal<decorators>(addr, value);
320 }
321
322 template <typename T>
323 static inline T load(void* addr) {
324 return load_internal<decorators, T>(addr);
325 }
326
327 template <typename T>
328 static inline T atomic_cmpxchg(T new_value, void* addr, T compare_value) {
329 return atomic_cmpxchg_maybe_locked<decorators>(new_value, addr, compare_value);
330 }
331
332 template <typename T>
333 static inline T atomic_xchg(T new_value, void* addr) {
334 return atomic_xchg_maybe_locked<decorators>(new_value, addr);
335 }
336
337 template <typename T>
338 static bool arraycopy(T* src, T* dst, size_t length);
339
340 template <typename T>
341 static void oop_store(void* addr, T value);
342 template <typename T>
343 static void oop_store_at(oop base, ptrdiff_t offset, T value);
344
345 template <typename T>
346 static T oop_load(void* addr);
347 template <typename T>
348 static T oop_load_at(oop base, ptrdiff_t offset);
349
350 template <typename T>
351 static T oop_atomic_cmpxchg(T new_value, void* addr, T compare_value);
352 template <typename T>
353 static T oop_atomic_cmpxchg_at(T new_value, oop base, ptrdiff_t offset, T compare_value);
354
355 template <typename T>
356 static T oop_atomic_xchg(T new_value, void* addr);
357 template <typename T>
358 static T oop_atomic_xchg_at(T new_value, oop base, ptrdiff_t offset);
|
87 struct PossiblyLockedAccess: public IntegralConstant<bool, (sizeof(T) > 4)> {};
88 #endif
89
90 template <DecoratorSet decorators, typename T>
91 struct AccessFunctionTypes {
92 typedef T (*load_at_func_t)(oop base, ptrdiff_t offset);
93 typedef void (*store_at_func_t)(oop base, ptrdiff_t offset, T value);
94 typedef T (*atomic_cmpxchg_at_func_t)(T new_value, oop base, ptrdiff_t offset, T compare_value);
95 typedef T (*atomic_xchg_at_func_t)(T new_value, oop base, ptrdiff_t offset);
96
97 typedef T (*load_func_t)(void* addr);
98 typedef void (*store_func_t)(void* addr, T value);
99 typedef T (*atomic_cmpxchg_func_t)(T new_value, void* addr, T compare_value);
100 typedef T (*atomic_xchg_func_t)(T new_value, void* addr);
101
102 typedef bool (*arraycopy_func_t)(arrayOop src_obj, arrayOop dst_obj, T* src, T* dst, size_t length);
103 typedef void (*clone_func_t)(oop src, oop dst, size_t size);
104 typedef oop (*resolve_func_t)(oop obj);
105 };
106
107 template <DecoratorSet decorators>
108 struct AccessFunctionTypes<decorators, void> {
109 typedef bool (*arraycopy_func_t)(arrayOop src_obj, arrayOop dst_obj, void* src, void* dst, size_t length);
110 };
111
112 template <DecoratorSet decorators, typename T, BarrierType barrier> struct AccessFunction {};
113
114 #define ACCESS_GENERATE_ACCESS_FUNCTION(bt, func) \
115 template <DecoratorSet decorators, typename T> \
116 struct AccessFunction<decorators, T, bt>: AllStatic{ \
117 typedef typename AccessFunctionTypes<decorators, T>::func type; \
118 }
119 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_STORE, store_func_t);
120 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_STORE_AT, store_at_func_t);
121 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_LOAD, load_func_t);
122 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_LOAD_AT, load_at_func_t);
123 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_ATOMIC_CMPXCHG, atomic_cmpxchg_func_t);
124 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_ATOMIC_CMPXCHG_AT, atomic_cmpxchg_at_func_t);
125 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_ATOMIC_XCHG, atomic_xchg_func_t);
126 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_ATOMIC_XCHG_AT, atomic_xchg_at_func_t);
127 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_ARRAYCOPY, arraycopy_func_t);
128 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_CLONE, clone_func_t);
129 ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_RESOLVE, resolve_func_t);
130 #undef ACCESS_GENERATE_ACCESS_FUNCTION
131
323 static inline void store(void* addr, T value) {
324 store_internal<decorators>(addr, value);
325 }
326
327 template <typename T>
328 static inline T load(void* addr) {
329 return load_internal<decorators, T>(addr);
330 }
331
332 template <typename T>
333 static inline T atomic_cmpxchg(T new_value, void* addr, T compare_value) {
334 return atomic_cmpxchg_maybe_locked<decorators>(new_value, addr, compare_value);
335 }
336
337 template <typename T>
338 static inline T atomic_xchg(T new_value, void* addr) {
339 return atomic_xchg_maybe_locked<decorators>(new_value, addr);
340 }
341
342 template <typename T>
343 static bool arraycopy(arrayOop src_obj, arrayOop dst_obj, T* src, T* dst, size_t length);
344
345 template <typename T>
346 static void oop_store(void* addr, T value);
347 template <typename T>
348 static void oop_store_at(oop base, ptrdiff_t offset, T value);
349
350 template <typename T>
351 static T oop_load(void* addr);
352 template <typename T>
353 static T oop_load_at(oop base, ptrdiff_t offset);
354
355 template <typename T>
356 static T oop_atomic_cmpxchg(T new_value, void* addr, T compare_value);
357 template <typename T>
358 static T oop_atomic_cmpxchg_at(T new_value, oop base, ptrdiff_t offset, T compare_value);
359
360 template <typename T>
361 static T oop_atomic_xchg(T new_value, void* addr);
362 template <typename T>
363 static T oop_atomic_xchg_at(T new_value, oop base, ptrdiff_t offset);
|