RFR: 8187033: [PPC] Imporve performance of ObjectStreamClass.getClassDataLayout()

Aleksey Shipilev shade at redhat.com
Thu Aug 31 12:13:29 UTC 2017

On 08/31/2017 01:22 PM, Kazunori Ogata wrote:
> private ClassDataSlot[] dataLayout;
> private volatile ClassDataSlot[] dataLayout_tmp;
> ClassDataSlot[] getClassDataLayout() throws InvalidClassException {
>   if (dataLayout == null) {
>     dataLayout_tmp = getClassDataLayout0();
>     dataLayout = dataLayout_tmp;
>   }
>   return dataLayout;
> }

Does not work, and I assume it is broken on POWER. You need to read the volatile variable in
*another thread* to make this effective. Which means you have to have $dataLayout volatile, getting
you to square one.

I guess you can make VarHandle.fullFence() between getClassDataLayout0() and storing it to the
non-volatile field...


More information about the core-libs-dev mailing list