GCM performance and Unsafe byte array accesses
Andrew Haley
aph at redhat.com
Tue Sep 1 16:40:55 UTC 2015
On 09/01/2015 04:42 PM, Anthony Scarpino wrote:
> Does your alignment changes affect x86 only or should this help all
> architectures?
It does the best thing it can on every architecture. On those which
support unaligned accesses, it uses them; if not, it doesn't.
But there is a very cool optimization on machines without unaligned
memory accesses: if the profile data says that accesses at a
particular call site are always aligned, C2 generates optimistic code
to do the aligned fetch, plus a very simple check.
> In general I don't see a disadvantage and that it could be expanded
> to other places in crypto too.
Yes, lots of other places. This one is my poster child because the
effect is so dramatic.
> But I have think about the effects on sparc, so that would need to
> be tested. Right now the sparc intrinsic does alignment checking
> and realigning, so it would be interesting to see if ByteArrays
> performed better than the intrinsic alignment. I assume you don't
> have the hardware to test sparc, right?
I don't. My guess is, though, that it'll not lose on SPARC, and will
probably win. If it does lose that's something to look at.
Andrew.
More information about the security-dev
mailing list