8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods

Vladimir Kozlov vladimir.kozlov at oracle.com
Wed Mar 25 18:43:10 UTC 2015


Looks like only 32-bit is affected. Both Server (C2) and Client (C1) VMs.

64-bit VM pass all combinations: Tiered, C2 only (-TieredCompilation), 
C1 only (-XX:+TieredCompilation -XX:TieredStopAtLevel=1) with and 
without intrinsics.

32-bit Client VM (C1) fails with both, -XX:-UseUnalignedAccesses and 
-XX:+UseUnalignedAccesses.

$ bin/java -client -XX:+UnlockDiagnosticVMOptions 
-XX:-UseUnalignedAccesses HeapByteBufferTest
Exception in thread "main" java.lang.RuntimeException
	at MyByteBuffer.ck(HeapByteBufferTest.java:201)
	at MyByteBuffer.getLong(HeapByteBufferTest.java:211)
	at HeapByteBufferTest.step(HeapByteBufferTest.java:311)
	at HeapByteBufferTest.run(HeapByteBufferTest.java:347)
	at HeapByteBufferTest.main(HeapByteBufferTest.java:362)

$ bin/java -client -XX:+UnlockDiagnosticVMOptions 
-XX:+UseUnalignedAccesses HeapByteBufferTest
Exception in thread "main" java.lang.RuntimeException
	at MyByteBuffer.ck(HeapByteBufferTest.java:201)
	at MyByteBuffer.getLong(HeapByteBufferTest.java:211)
	at HeapByteBufferTest.step(HeapByteBufferTest.java:311)
	at HeapByteBufferTest.run(HeapByteBufferTest.java:347)
	at HeapByteBufferTest.main(HeapByteBufferTest.java:362)

32-bit Server VM without tiered (-TieredCompilation) FAILS too in both 
cases! Note, without intrinsics it failed in different place.

$ bin/java -server -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions 
-XX:-UseUnalignedAccesses HeapByteBufferTest
Exception in thread "main" java.lang.RuntimeException
	at MyByteBuffer.ck(HeapByteBufferTest.java:207)
	at MyByteBuffer.getDouble(HeapByteBufferTest.java:215)
	at HeapByteBufferTest.step(HeapByteBufferTest.java:329)
	at HeapByteBufferTest.run(HeapByteBufferTest.java:347)
	at HeapByteBufferTest.main(HeapByteBufferTest.java:362)

$ bin/java -server -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions 
-XX:+UseUnalignedAccesses HeapByteBufferTest
Exception in thread "main" java.lang.RuntimeException
	at MyByteBuffer.ck(HeapByteBufferTest.java:201)
	at MyByteBuffer.getLong(HeapByteBufferTest.java:211)
	at HeapByteBufferTest.step(HeapByteBufferTest.java:311)
	at HeapByteBufferTest.run(HeapByteBufferTest.java:347)
	at HeapByteBufferTest.main(HeapByteBufferTest.java:362)

For some reasons Server VM only pass when TieredCompilation is enabled.

Looking on -XX:+PrintCompilation -XX:+PrintInlining output I see that 
UseUnalignedAccesses affects intrinsics as designed.

Thanks,
Vladimir

On 3/25/15 2:13 AM, Andrew Haley wrote:
> On 24/03/15 23:40, Vladimir Kozlov wrote:
>
>> The test failed when run it in JPRT with 32-bit fastdebug *Client* VM (-client) on linux-x86:
>>
>> java.lang.RuntimeException
>> 	at MyByteBuffer.ck(HeapByteBufferTest.java:201)
>> 	at MyByteBuffer.getLong(HeapByteBufferTest.java:211)
>> 	at HeapByteBufferTest.step(HeapByteBufferTest.java:311)
>> 	at HeapByteBufferTest.run(HeapByteBufferTest.java:347)
>> 	at HeapByteBufferTest.main(HeapByteBufferTest.java:362)
>>
>> Could be intrinsic in C1 does not work correctly? Please, look.
>
> I certainly will.  That is odd: there's no reason I can think of why
> this might happen, and I know that the test running on a server build
> runs C1 code for a while so it has been tested.  I guess it must be a
> rare edge case.  Still, I'm quite pleased that the test I wrote
> detected the failure.
>
> Do you know if this was running with +UseUnalignedAccesses?
>
> I'm not going to be able to analyse this for a few days.  Expect a
> report (and hopefully a fix) next week.
>
> Thanks,
> Andrew.
>



More information about the core-libs-dev mailing list