JDK-8149159 : Clean up Unsafe
  • Type: Enhancement
  • Component: core-libs
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-02-05
  • Updated: 2018-05-31
  • Resolved: 2016-03-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b112Fixed
Related Reports
Relates :  
Relates :  
Description
Unsafe.copyMemory currently does some argument checking in the unsafe.cpp native method. By moving the arguments checks to Java the JIT can (potentially) remove them, and the resulting native code will be much cleaner.

Additionally, there are currently two Unsafe classes: sun.misc.Unsafe and jdk.internal.misc.Unsafe. To avoid code duplication and the problems that come with it (forgetting to apply the same fix in both), the actual implementation should be limited to one of the classes, and the other one should delegate to that class instead.

There is also room for cleaning up the native part of unsafe (unsafe.cpp).