Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8275821

Optimize random number generators developed in JDK-8248862 using Math.unsignedMultiplyHigh()

    XMLWordPrintable

Details

    • Enhancement
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • None
    • 18
    • core-libs
    • None
    • b27
    • generic
    • generic

    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

      Attachments

        Issue Links

          Activity

            People

              sviswanathan Sandhya Viswanathan
              sgibbons Scott Gibbons
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: