< prev index next >

src/hotspot/share/oops/access.hpp

Print this page
rev 50331 : 8198285: More consistent Access API for arraycopy
rev 50332 : [mq]: JDK-8203232-2.patch
rev 50333 : [mq]: JDK-8198285-3.patch

*** 154,167 **** verify_primitive_decorators<atomic_xchg_mo_decorators>(); return AccessInternal::atomic_xchg_at<decorators>(new_value, base, offset); } template <typename T> ! static inline void arraycopy(arrayOop src_obj, arrayOop dst_obj, T *src, T *dst, size_t length) { ! verify_decorators<ARRAYCOPY_DECORATOR_MASK | IN_HEAP | AS_DECORATOR_MASK>(); ! AccessInternal::arraycopy<decorators>(src_obj, dst_obj, src, dst, length); } // Oop heap accesses static inline AccessInternal::OopLoadAtProxy<decorators> oop_load_at(oop base, ptrdiff_t offset) { verify_heap_oop_decorators<load_mo_decorators>(); --- 154,171 ---- verify_primitive_decorators<atomic_xchg_mo_decorators>(); return AccessInternal::atomic_xchg_at<decorators>(new_value, base, offset); } template <typename T> ! static inline void arraycopy(arrayOop src_obj, size_t src_offset_in_bytes, const T* src_raw, ! arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw, ! size_t length) { ! verify_decorators<ARRAYCOPY_DECORATOR_MASK | IN_HEAP | IN_HEAP_ARRAY | AS_DECORATOR_MASK>(); ! AccessInternal::arraycopy<decorators>(src_obj, src_offset_in_bytes, src_raw, ! dst_obj, dst_offset_in_bytes, dst_raw, ! length); } // Oop heap accesses static inline AccessInternal::OopLoadAtProxy<decorators> oop_load_at(oop base, ptrdiff_t offset) { verify_heap_oop_decorators<load_mo_decorators>();
*** 192,204 **** OopType new_oop_value = new_value; return AccessInternal::atomic_xchg_at<decorators | INTERNAL_VALUE_IS_OOP>(new_oop_value, base, offset); } template <typename T> ! static inline bool oop_arraycopy(arrayOop src_obj, arrayOop dst_obj, T *src, T *dst, size_t length) { ! verify_decorators<ARRAYCOPY_DECORATOR_MASK | IN_HEAP | AS_DECORATOR_MASK>(); ! return AccessInternal::arraycopy<decorators | INTERNAL_VALUE_IS_OOP>(src_obj, dst_obj, src, dst, length); } // Clone an object from src to dst static inline void clone(oop src, oop dst, size_t size) { verify_decorators<IN_HEAP>(); --- 196,213 ---- OopType new_oop_value = new_value; return AccessInternal::atomic_xchg_at<decorators | INTERNAL_VALUE_IS_OOP>(new_oop_value, base, offset); } template <typename T> ! static inline bool oop_arraycopy(arrayOop src_obj, size_t src_offset_in_bytes, const T* src_raw, ! arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw, ! size_t length) { ! verify_decorators<ARRAYCOPY_DECORATOR_MASK | IN_HEAP | IN_HEAP_ARRAY | ! AS_DECORATOR_MASK>(); ! return AccessInternal::arraycopy<decorators | INTERNAL_VALUE_IS_OOP>(src_obj, src_offset_in_bytes, src_raw, ! dst_obj, dst_offset_in_bytes, dst_raw, ! length); } // Clone an object from src to dst static inline void clone(oop src, oop dst, size_t size) { verify_decorators<IN_HEAP>();
*** 286,295 **** --- 295,344 ---- // Helper for performing normal accesses in roots. These accesses // may resolve an accessor on a GC barrier set template <DecoratorSet decorators = INTERNAL_EMPTY> class RootAccess: public Access<IN_ROOT | decorators> {}; + // Helper for array access. + template <DecoratorSet decorators = INTERNAL_EMPTY> + class ArrayAccess: public HeapAccess<IN_HEAP_ARRAY | decorators> { + public: + template <typename T> + static inline void arraycopy(arrayOop src_obj, size_t src_offset_in_bytes, + arrayOop dst_obj, size_t dst_offset_in_bytes, + size_t length) { + HeapAccess<decorators | IN_HEAP_ARRAY>::arraycopy(src_obj, src_offset_in_bytes, (const T*) NULL, + dst_obj, dst_offset_in_bytes, (T*) NULL, + length); + } + + template <typename T> + static inline void arraycopy_to_native(arrayOop src_obj, size_t src_offset_in_bytes, T* dst, size_t length) { + HeapAccess<decorators | IN_HEAP_ARRAY>::arraycopy(src_obj, src_offset_in_bytes, (const T*) NULL, + NULL, 0, dst, + length); + } + + template <typename T> + static inline void arraycopy_from_native(const T* src, arrayOop dst_obj, size_t dst_offset_in_bytes, size_t length) { + HeapAccess<decorators | IN_HEAP_ARRAY>::arraycopy(NULL, 0, src, dst_obj, dst_offset_in_bytes, (T*) NULL, length); + } + + template <typename T> + static inline bool oop_arraycopy(arrayOop src_obj, size_t src_offset_in_bytes, + arrayOop dst_obj, size_t dst_offset_in_bytes, + size_t length) { + return HeapAccess<decorators | IN_HEAP_ARRAY>::oop_arraycopy(src_obj, src_offset_in_bytes, (const T*) NULL, + dst_obj, dst_offset_in_bytes, (T*) NULL, length); + } + + template <typename T> + static inline bool oop_arraycopy_raw(T* src, T* dst, size_t length) { + return HeapAccess<decorators | IN_HEAP_ARRAY>::oop_arraycopy(NULL, 0, src, NULL, 0, dst, length); + } + + }; + template <DecoratorSet decorators> template <DecoratorSet expected_decorators> void Access<decorators>::verify_decorators() { STATIC_ASSERT((~expected_decorators & decorators) == 0); // unexpected decorator used const DecoratorSet barrier_strength_decorators = decorators & AS_DECORATOR_MASK;
< prev index next >