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

David Holmes david.holmes at oracle.com
Wed Aug 24 21:50:31 UTC 2016


Hi Kim,

On 25/08/2016 7:46 AM, Kim Barrett wrote:
>> 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.

Okay so how do we fix that? It seems pretty obvious/simple what we want 
to do. Do we just cast to unsigned, shift and cast back?

> ------------------------------------------------------------------------------
> 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.)

Ditto.

Thanks,
David

> ------------------------------------------------------------------------------
> 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