RFR (XS) 8161280 - assert failed: reference count underflow for symbol

Kim Barrett kim.barrett at oracle.com
Wed Aug 24 21:46:32 UTC 2016


> On Aug 24, 2016, at 3:01 AM, Ioi Lam <ioi.lam at oracle.com> wrote:
> 
> Hi David,
> 
> Here's an updated version that added Atomic::add(jshort*, jshort) as you suggested.
> 
> To appease the "unused" warnings, I just added (void)new_value.
> 
> http://cr.openjdk.java.net/~iklam/jdk9/8161280-symbol-refcount-underflow.v03/
> 
> I am running RBT with "--test hotspot/test/:hotspot_all,vm.parallel_class_loading,vm.runtime.testlist" to make sure everything works.

------------------------------------------------------------------------------
src/share/vm/runtime/atomic.hpp 
 211   jint new_value = Atomic::add(add_value << 16, (volatile jint*)(dest-1));
 214   jint new_value = Atomic::add(add_value << 16, (volatile jint*)(dest));

Left-shift of a signed negative value is undefined behavior.

------------------------------------------------------------------------------
src/share/vm/runtime/atomic.hpp 
 216   return (jshort)(new_value >> 16); // preserves sign

Right-shift of a signed negative value is implementation-defined. It
may or may not sign-extend. (gcc defines it as sign-extending; I have
no idea about other compilers.)

------------------------------------------------------------------------------
src/share/vm/runtime/atomic.hpp 
 220   (void)add(1, dest);
 224   (void)add(-1, dest);

I don't think the casts are needed here.

------------------------------------------------------------------------------ 



More information about the hotspot-runtime-dev mailing list