diff --git a/src/hotspot/share/oops/access.inline.hpp b/src/hotspot/share/oops/access.inline.hpp index e776ebb..f9e9a3b 100644 --- a/src/hotspot/share/oops/access.inline.hpp +++ b/src/hotspot/share/oops/access.inline.hpp @@ -675,7 +675,6 @@ namespace AccessInternal { inline static typename EnableIf< !HasDecorator::value, T>::type atomic_cmpxchg(T new_value, void* addr, T compare_value) { - typedef RawAccessBarrier Raw; if (is_hardwired_primitive()) { const DecoratorSet expanded_decorators = decorators | AS_RAW; return PreRuntimeDispatch::atomic_cmpxchg(new_value, addr, compare_value); @@ -761,17 +760,33 @@ namespace AccessInternal { template inline static typename EnableIf< - HasDecorator::value, bool>::type - arraycopy(arrayOop src_obj, arrayOop dst_obj, T *src, T* dst, size_t length) { + HasDecorator::value && CanHardwireRaw::value, bool>::type + arraycopy(arrayOop src_obj, arrayOop dst_obj, T* src, T* dst, size_t length) { typedef RawAccessBarrier Raw; - return Raw::arraycopy(src_obj, dst_obj, src, dst, length); + if (HasDecorator::value) { + return Raw::oop_arraycopy(src_obj, dst_obj, src, dst, length); + } else { + return Raw::arraycopy(src_obj, dst_obj, src, dst, length); + } + } + + template + inline static typename EnableIf< + HasDecorator::value && !CanHardwireRaw::value, bool>::type + arraycopy(arrayOop src_obj, arrayOop dst_obj, T* src, T* dst, size_t length) { + if (UseCompressedOops) { + const DecoratorSet expanded_decorators = decorators | convert_compressed_oops; + return PreRuntimeDispatch::arraycopy(src_obj, dst_obj, src, dst, length); + } else { + const DecoratorSet expanded_decorators = decorators & ~convert_compressed_oops; + return PreRuntimeDispatch::arraycopy(src_obj, dst_obj, src, dst, length); + } } template inline static typename EnableIf< !HasDecorator::value, bool>::type - arraycopy(arrayOop src_obj, arrayOop dst_obj, T *src, T* dst, size_t length) { - typedef RawAccessBarrier Raw; + arraycopy(arrayOop src_obj, arrayOop dst_obj, T* src, T* dst, size_t length) { if (is_hardwired_primitive()) { const DecoratorSet expanded_decorators = decorators | AS_RAW; return PreRuntimeDispatch::arraycopy(src_obj, dst_obj, src, dst, length); @@ -947,6 +962,24 @@ namespace AccessInternal { return PreRuntimeDispatch::load(addr); } + template + inline bool arraycopy_reduce_types(arrayOop src_obj, arrayOop dst_obj, T* src, T* dst, size_t length) { + return PreRuntimeDispatch::arraycopy(src_obj, dst_obj, src, dst, length); + } + + template + inline bool arraycopy_reduce_types(arrayOop src_obj, arrayOop dst_obj, HeapWord* src, HeapWord* dst, size_t length) { + const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP; + return PreRuntimeDispatch::arraycopy(src_obj, dst_obj, src, dst, length); + } + + template + inline bool arraycopy_reduce_types(arrayOop src_obj, arrayOop dst_obj, narrowOop* src, narrowOop* dst, size_t length) { + const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP | + INTERNAL_RT_USE_COMPRESSED_OOPS; + return PreRuntimeDispatch::arraycopy(src_obj, dst_obj, src, dst, length); + } + // Step 1: Set default decorators. This step remembers if a type was volatile // and then sets the MO_VOLATILE decorator by default. Otherwise, a default // memory ordering is set for the access, and the implied decorator rules @@ -1077,18 +1110,16 @@ namespace AccessInternal { } template - inline bool arraycopy(arrayOop src_obj, arrayOop dst_obj, T *src, T *dst, size_t length) { + inline bool arraycopy(arrayOop src_obj, arrayOop dst_obj, T* src, T* dst, size_t length) { STATIC_ASSERT((HasDecorator::value || (IsSame::value || IsIntegral::value) || IsFloatingPoint::value)); // arraycopy allows type erased void elements typedef typename Decay::type DecayedT; - const DecoratorSet expanded_decorators = DecoratorFixup::value ? - INTERNAL_CONVERT_COMPRESSED_OOP : INTERNAL_EMPTY)>::value; - return PreRuntimeDispatch::arraycopy(src_obj, dst_obj, - const_cast(src), - const_cast(dst), - length); + const DecoratorSet expanded_decorators = DecoratorFixup::value; + return arraycopy_reduce_types(src_obj, dst_obj, + const_cast(src), + const_cast(dst), + length); } template diff --git a/src/hotspot/share/oops/accessBackend.hpp b/src/hotspot/share/oops/accessBackend.hpp index d5a90d8..acea2f4 100644 --- a/src/hotspot/share/oops/accessBackend.hpp +++ b/src/hotspot/share/oops/accessBackend.hpp @@ -384,7 +384,6 @@ public: template static bool oop_arraycopy(arrayOop src_obj, arrayOop dst_obj, T* src, T* dst, size_t length); - static bool oop_arraycopy(arrayOop src_obj, arrayOop dst_obj, HeapWord* src, HeapWord* dst, size_t length); static void clone(oop src, oop dst, size_t size); diff --git a/src/hotspot/share/oops/accessBackend.inline.hpp b/src/hotspot/share/oops/accessBackend.inline.hpp index 36fb860..07e0beb 100644 --- a/src/hotspot/share/oops/accessBackend.inline.hpp +++ b/src/hotspot/share/oops/accessBackend.inline.hpp @@ -122,17 +122,6 @@ inline bool RawAccessBarrier::oop_arraycopy(arrayOop src_obj, arrayO } template -inline bool RawAccessBarrier::oop_arraycopy(arrayOop src_obj, arrayOop dst_obj, HeapWord* src, HeapWord* dst, size_t length) { - bool needs_oop_compress = HasDecorator::value && - HasDecorator::value; - if (needs_oop_compress) { - return arraycopy(reinterpret_cast(src), reinterpret_cast(dst), length); - } else { - return arraycopy(reinterpret_cast(src), reinterpret_cast(dst), length); - } -} - -template template inline typename EnableIf< HasDecorator::value, T>::type