RFR (XS): JDK-8025728: Missing volatile specifier for field G1AllocRegion::_alloc_region

Thomas Schatzl thomas.schatzl at oracle.com
Wed Oct 2 08:42:24 UTC 2013


Hi Axel,

On Wed, 2013-10-02 at 07:16 +0000, Siebenborn, Axel wrote:
> Hi
> 
> We investigated some crashes on AIX using the G1 collector. We
> compiled the HotSpot with IBM XLC12. The reason for the crashes is,
> that XLC creates code which loads _alloc_region's value and compares
> it against NULL. Later on, it reloads _alloc_region from memory and
> uses that new value without another null-check. The problem is that
> meanwhile another thread has set the _alloc_region's value to NULL.

Could you give some context to the problem, what particular code is
involved in this problem?

> While one may argue that the code generated by XLC is not very elegant
> it is still correct from a C++ point of view. And we can’t be sure
> that other compilers do not generate similar code.
>
> Fortunately, this behavior can be easily prevented by declaring
> _alloc_region as volatile pointer.
>
> Could you please review the following webrev:
>
> http://www.sapjvm.com/as/webrevs/8025728/

Looks okay.

Thomas






More information about the hotspot-gc-dev mailing list