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

Andrew Haley aph at redhat.com
Tue Mar 24 17:35:22 UTC 2015


On 24/03/15 09:23, Aaron Grunthal wrote:
> A question from the user perspective,
> 
> If these things need to be intrinsified, does that mean we cannot expect 
> the compiler to recognize the following (and similar) patterns on any 
> platform and optimize them?
> 
> byte[i] = (byte)intvalue<<24
> byte[i+1] = (byte)intvalue<<16
> byte[i+2] = (byte)intvalue<<8
> byte[i+3] = (byte)intvalue

Not yet, no.

> I.e. should we always wrap byte arrays in bytebuffers if we want 
> multi-byte reads?

For the time being, yes.  There have been some proposals to write
Arrays methods to so this stuff, but right now array-backed
ByteBuffers are the way to go.  Or will be once this patch goes in.

> Or is this only an issue under some limited circumstances?
> 
> Same questions for reading instead of writing.

Same answers.

Andrew.



More information about the hotspot-dev mailing list