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

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

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 18
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b27
    • CPU:
      generic
    • OS:
      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

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

                Dates

                Created:
                Updated:
                Resolved: