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

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

XMLWordPrintable

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

      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

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

              Created:
              Updated:
              Resolved: