RFD: C2: Poor code quality for Unsafe
Andrew Haley
aph at redhat.com
Wed Jul 27 14:55:37 UTC 2016
On 27/07/16 15:08, Paul Sandoz wrote:
> Ah, ok, i did not realize you had that patch applied as well, i was thrown off base because you mentioned the following method:
>
> protected int ix(int i) {
> return (i << $LG_BYTES_PER_VALUE$) + offset;
> }
>
> which is not used for access [*] in the patch(s).
It *is* used in Direct-X-Buffer, which is what gets inlined. The
inlining looks like this:
@ 18 ByteBufferTest::floss (24 bytes) inline (hot)
@ 4 java.nio.Buffer::capacity (5 bytes) accessor
@ 13 java.nio.DirectIntBufferU::put (18 bytes) inline (hot)
@ 6 java.nio.Buffer::checkIndex (22 bytes) inline (hot)
@ 9 java.nio.DirectIntBufferU::ix (10 bytes) inline (hot)
@ 13 jdk.internal.misc.Unsafe::putInt (8 bytes) force inline by annotation
@ 4 jdk.internal.misc.Unsafe::putInt (0 bytes) (intrinsic)
@ 4 java.nio.Buffer::capacity (5 bytes) accessor
I can confirm that your corrected patch makes no difference to any of
this.
Andrew.
More information about the hotspot-dev
mailing list