Advice on finding out the cause of test failure of VarHandleTestAccessBoolean on windows x64
Paul Sandoz
paul.sandoz at oracle.com
Fri Aug 12 19:42:30 UTC 2016
> On 12 Aug 2016, at 11:09, dean.long at oracle.com wrote:
>
> Tobias, does this sound like 8038348?
>
I applied the patch [1] referenced in the issue but the bug was still reproducible.
I have observed the failure to occur on access to instance fields, static fields or arrays, via Unsafe access.
Thanks,
Paul.
[1] http://cr.openjdk.java.net/~thartmann/8038348/webrev.00/
> dl
>
>
> On 8/12/16 8:36 AM, Paul Sandoz wrote:
>> Hi,
>>
>> Please can someone help/advice how to find the cause of a test failure i am observing.
>>
>> The patch for VarHandles bitwise operations [1] is failing for boolean, the test VarHandleTestAccessBoolean, but only on windows x64. I have observed it can reliably fail in different assertions when testing bitwise ops and AFAICT so far only for C2 (and definitely not in the interpreter).
>>
>> Here is an example:
>>
>> // get and bitwise and
>> {
>> vh.set(true);
>>
>> boolean o = (boolean) vh.getAndBitwiseAnd(false);
>> assertEquals(o, true, "getAndBitwiseAnd boolean”); // <— PASSES for the previous value
>> boolean x = (boolean) vh.get();
>> assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value”); // <— FAILS for the updated value, expected false got true
>> }
>>
>>
>> It appears as if the atomic read modify write of “vh.getAndBitwiseAnd" failed and when getting the value (“vh.get”) it reads the previous value.
>>
>> I don’t know what could be different about the windows x64 platform that such a bug could arise just on that platform.
>>
>>
>> vh.set/set will defer to Unsafe.put/getBoolean, where as the vh.getAndBitwiseAnd will call:
>>
>> @ForceInline
>> public final boolean getAndBitwiseAndBoolean(Object o, long offset, boolean mask) {
>> return byte2bool(getAndBitwiseAndByte(o, offset, bool2byte(mask)));
>> }
>>
>> @ForceInline
>> public final byte getAndBitwiseAndByte(Object o, long offset, byte mask) {
>> byte current;
>> do {
>> current = getByteVolatile(o, offset);
>> } while (!weakCompareAndSwapByteVolatile(o, offset,
>> current, (byte) (current & mask)));
>> return current;
>> }
>>
>> which defers to reading/writing the boolean as the VM byte representation. So there is a mismatch going on between T_BOOLEAN and T_BYTE but i gather that should not be an issue.
>>
>> If i disable the Unsafe _getByte and _getByteVolatile intrinsics the test passes.
>>
>> (I have yet to work out how to compile and use hdis on windows x64).
>>
>> Thanks,
>> Paul.
>>
>> [1] http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8161444-vhs-bitwise-atomics/webrev/
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20160812/0efb3f9e/signature.asc>
More information about the hotspot-compiler-dev
mailing list