JDK-8275821 : Optimize random number generators developed in JDK-8248862 using Math.unsignedMultiplyHigh()
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2021-10-22
  • Updated: 2021-12-03
  • Resolved: 2021-12-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 18
18 masterFixed
Related Reports
Relates :  
Relates :  
Description
Summary: Enhanced random number generators were implemented as a part of JDK-8248862. Currently, it uses Math.multiplyHigh(), which can be further optimized by using Math.unsignedMultiplyHigh(). Also, x86 intrinsic support for Math.unsignedMultiplyHigh() was added as a part of recently closed JDK-8275167.

Problem: The proposed changes entails replacing Math.multiplyHigh() with Math.unsignedMultiplyHigh(). 
For example, in src/jdk.random/share/classes/jdk/random/L128X128MixRandom.java, 

line 260: sh = (ML * sh) + (Math.multiplyHigh(ML, sl) + ((ML >> 63) & sl) + ((sl >> 63) & ML)) + sl + ah;
will be replaced as:
sh = (ML * sh) + (Math.unsignedMultiplyHigh(ML, sl) + ((ML >> 63) & sl) + ((sl >> 63) & ML)) + sl + ah;

The same changes shown above will be made in all the relevant files.

Issue Links: JDK-8248862, JDK-8275167

Comments
Changeset: 38f525e9 Author: vamsi-parasa <srinivas.vamsi.parasa@intel.com> Committer: Sandhya Viswanathan <sviswanathan@openjdk.org> Date: 2021-12-03 18:17:54 +0000 URL: https://git.openjdk.java.net/jdk/commit/38f525e96e767597d16698d4b243b681782acc9f
03-12-2021