changeset 51330:edd33b9946ca

8208575: Remove Atomic::add/sub for short Summary: Removed code to atomic::add for short because it's no longer used for Symbol. Reviewed-by: iklam
author coleenp
date Tue, 07 Aug 2018 19:35:50 -0400
parents 9c68699bebe5
children 7939b3c4e408
files src/hotspot/share/runtime/atomic.hpp src/hotspot/share/utilities/macros.hpp
diffstat 2 files changed, 0 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/runtime/atomic.hpp	Tue Aug 07 15:45:07 2018 -0700
+++ b/src/hotspot/share/runtime/atomic.hpp	Tue Aug 07 19:35:50 2018 -0400
@@ -635,29 +635,6 @@
   }
 };
 
-// Most platforms do not support atomic add on a 2-byte value. However,
-// if the value occupies the most significant 16 bits of an aligned 32-bit
-// word, then we can do this with an atomic add of (add_value << 16)
-// to the 32-bit word.
-//
-// The least significant parts of this 32-bit word will never be affected, even
-// in case of overflow/underflow.
-//
-// Use the ATOMIC_SHORT_PAIR macro (see macros.hpp) to get the desired alignment.
-template<>
-struct Atomic::AddImpl<short, short> {
-  short operator()(short add_value, short volatile* dest, atomic_memory_order order) const {
-#ifdef VM_LITTLE_ENDIAN
-    assert((intx(dest) & 0x03) == 0x02, "wrong alignment");
-    int new_value = Atomic::add(add_value << 16, (volatile int*)(dest-1), order);
-#else
-    assert((intx(dest) & 0x03) == 0x00, "wrong alignment");
-    int new_value = Atomic::add(add_value << 16, (volatile int*)(dest), order);
-#endif
-    return (short)(new_value >> 16); // preserves sign
-  }
-};
-
 template<typename Derived>
 template<typename I, typename D>
 inline D Atomic::FetchAndAdd<Derived>::operator()(I add_value, D volatile* dest,
--- a/src/hotspot/share/utilities/macros.hpp	Tue Aug 07 15:45:07 2018 -0700
+++ b/src/hotspot/share/utilities/macros.hpp	Tue Aug 07 19:35:50 2018 -0400
@@ -609,26 +609,6 @@
 #define COMPILER_HEADER(basename)        XSTR(COMPILER_HEADER_STEM(basename).hpp)
 #define COMPILER_HEADER_INLINE(basename) XSTR(COMPILER_HEADER_STEM(basename).inline.hpp)
 
-// To use Atomic::inc(jshort* dest) and Atomic::dec(jshort* dest), the address must be specially
-// aligned, such that (*dest) occupies the upper 16 bits of an aligned 32-bit word. The best way to
-// achieve is to place your short value next to another short value, which doesn't need atomic ops.
-//
-// Example
-//  ATOMIC_SHORT_PAIR(
-//    volatile short _refcount,  // needs atomic operation
-//    unsigned short _length     // number of UTF8 characters in the symbol (does not need atomic op)
-//  );
-
-#ifdef VM_LITTLE_ENDIAN
-  #define ATOMIC_SHORT_PAIR(atomic_decl, non_atomic_decl)  \
-    non_atomic_decl;                                       \
-    atomic_decl
-#else
-  #define ATOMIC_SHORT_PAIR(atomic_decl, non_atomic_decl)  \
-    atomic_decl;                                           \
-    non_atomic_decl
-#endif
-
 #if INCLUDE_CDS && INCLUDE_G1GC && defined(_LP64) && !defined(_WINDOWS)
 #define INCLUDE_CDS_JAVA_HEAP 1
 #define CDS_JAVA_HEAP_ONLY(x) x