Unsafe.{get,put}-X-Unaligned; Efficient array comparison intrinsics

John Rose john.r.rose at oracle.com
Sun Mar 8 21:28:04 UTC 2015

On Mar 7, 2015, at 11:24 AM, Remi Forax <forax at univ-mlv.fr> wrote:
> On 03/07/2015 07:48 PM, Andrew Haley wrote:
>> On 03/07/2015 05:57 PM, Remi Forax wrote:
>>> Hi Andrew,
>>> I've just read carefully the JDK part and I'm mostly ok with it.
>>> in Unsafe, all private methods should be static
>> You're going to have to explain that.  Firstly, why?  There's no real
>> performance advantage, and secondly, how is a static method supposed
>> to invoke the virtual methods in Unsafe?  I suppose it could use
>> theUnsafe.blah() but that would be worse than a simple virtual call.
> I mean all private methods that doesn't starts with "put*",
> convEndian, toUnsignedInt/toUnsignedLong, pick, make*, pickPos.

It's a small point but I agree with this.  Leaving out "static" makes it harder to
understand the roles of the relevant methods.  Scrutable code is better code.

It almost never matters, but there is also a slight effect on the code pipeline:
passing 'this' as an argument slightly increases the complexity of the methods.

— John

More information about the hotspot-compiler-dev mailing list