JDK-8154453 : Improve Unsafe.get*Unaligned on SPARC
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 9,10
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • CPU: sparc
  • Submitted: 2016-04-18
  • Updated: 2020-06-30
  • Resolved: 2020-06-30
Related Reports
Relates :  
Relates :  
Description
The fix JDK-8151163 updates ByteBuffer and views to consistently leverage the Unsafe.get*Unaligned methods.

On platforms where those methods are intrinsic performance is improved, such as on x86, which supports unaligned loads/stores.

On SPARC, which does not natively support unaligned loads/stores, those methods are not intrinsic, and the Java implementation is leveraged. Initial performance analysis indicates that JDK-8151163 introduces a regression on SPARC for misalignment when loading/storing bytes is necessary, which requires 3 misalignment checks before such bytes are accessed. 

Analysis of generated code is required to better understand how Unsafe access behaves, especially in unrolled loops.

A new Unsafe method that explicitly separates out the possibly misaligned base from an aligned (per unit size) offset may help, since the base misalignment check could be hoisted out of a loop.

Making get*Unaligned intrinsic may also help. For example, performing two aligned load instructions and then extracting the misaligned value (see instructions FALIGNDATA and ALIGNADDRESS http://www.oracle.com/technetwork/server-storage/sun-sparc-enterprise/documentation/sparc-architecture-2015-2868130.pdf).
Comments
SPARC port was removed in JDK 15: JDK-8244224
30-06-2020

To clarify: The Unsafe.[get|put]*Unaligned intrinsic is handled by JDK-8169985, so I'd be inclined to say this enhancement is only about "a new Unsafe method that explicitly separates out the possibly misaligned base from an aligned (per unit size) offset". Do I see that right?
07-02-2017