--- old/src/share/vm/runtime/atomic.hpp 2016-08-23 20:22:42.192866579 -0700 +++ new/src/share/vm/runtime/atomic.hpp 2016-08-23 20:22:42.080862342 -0700 @@ -86,7 +86,7 @@ // Atomically increment location. inc*() provide: // increment-dest inline static void inc (volatile jint* dest); - inline static void inc (volatile jshort* dest); + inline static jint inc (volatile jshort* dest); inline static void inc (volatile size_t* dest); inline static void inc_ptr(volatile intptr_t* dest); inline static void inc_ptr(volatile void* dest); @@ -94,7 +94,7 @@ // Atomically decrement a location. dec*() provide: // decrement-dest inline static void dec (volatile jint* dest); - inline static void dec (volatile jshort* dest); + inline static jint dec (volatile jshort* dest); inline static void dec (volatile size_t* dest); inline static void dec_ptr(volatile intptr_t* dest); inline static void dec_ptr(volatile void* dest); @@ -195,7 +195,7 @@ return old; } -inline void Atomic::inc(volatile short* dest) { +inline jint Atomic::inc(volatile short* dest) { // Most platforms do not support atomic increment 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 0x10000 to the 32-bit word. @@ -206,21 +206,23 @@ // Use the ATOMIC_SHORT_PAIR macro (see macros.hpp) to get the desired alignment. #ifdef VM_LITTLE_ENDIAN assert((intx(dest) & 0x03) == 0x02, "wrong alignment"); - (void)Atomic::add(0x10000, (volatile int*)(dest-1)); + jint new_value = Atomic::add(0x10000, (volatile int*)(dest-1)); #else assert((intx(dest) & 0x03) == 0x00, "wrong alignment"); - (void)Atomic::add(0x10000, (volatile int*)(dest)); + jint new_value = Atomic::add(0x10000, (volatile int*)(dest)); #endif + return new_value >> 16; // preserves sign } -inline void Atomic::dec(volatile short* dest) { +inline jint Atomic::dec(volatile short* dest) { #ifdef VM_LITTLE_ENDIAN assert((intx(dest) & 0x03) == 0x02, "wrong alignment"); - (void)Atomic::add(-0x10000, (volatile int*)(dest-1)); + jint new_value = Atomic::add(-0x10000, (volatile int*)(dest-1)); #else assert((intx(dest) & 0x03) == 0x00, "wrong alignment"); - (void)Atomic::add(-0x10000, (volatile int*)(dest)); + jint new_value = Atomic::add(-0x10000, (volatile int*)(dest)); #endif + return new_value >> 16; // preserves sign } #endif // SHARE_VM_RUNTIME_ATOMIC_HPP