nmethodBucket in instanceKlass.hpp atomic counters

David Holmes david.holmes at oracle.com
Mon Mar 2 01:46:51 UTC 2015

Please ignore - #$#@ autocomplete jumped to the wrong GC address.


On 2/03/2015 11:28 AM, David Holmes wrote:
> Hi Staffan,
> cc'ing gc group as ...
> On 28/02/2015 12:07 PM, Staffan Friberg wrote:
>> Hi,
>> Was reading through the code for the nmethodBucket in instanceKlass.hpp
>> and noticed that when we increase the number we simply do a +1, while
>> when we remove the dependency we do a using an atomic.
>> Do we have synchronization else where for the increment and decrement,
>> and we simply use the atomic in the decrement to ensure visibility to
>> non-compiler threads (GC)?
>   ... the atomic decrement was added as part of the G1 class unloading
> code:
> https://bugs.openjdk.java.net/browse/JDK-804942
> The increment is only performed at a safepoint or under the
> CodeCache_lock. However unless there is something else that guarantees
> increments and decrements can not be occurring around the same time,
> then the use of the atomic decrement is not sufficient for thread-safety.
> David
>> //Staffan

More information about the hotspot-gc-dev mailing list