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...
Thanks,
-Aleksey