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

C2: Eliminate bounds checks for indices produced by fast-range algorithm

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: 11, 14
    • Fix Version/s: tbd
    • Component/s: hotspot
    • Labels:

      Description

      The fast-range[1] algorithm:
        https://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/

      It describes an efficient way to produce an index which is guaranteed to be inbounds:
        for arbitrary non-negative (int) h and non-negative (int) size N, the ((long) h) * N) >>> 32 is less than N.

      C2 can detect such pattern (by looking at how access index is computed) and skip bounds checks for it.

      Relevant discussion:
          https://mail.openjdk.java.net/pipermail/hotspot-dev/2019-November/040011.html

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              vlivanov Vladimir Ivanov
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: