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

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

    XMLWordPrintable

Details

    • Enhancement
    • Status: Open
    • P3
    • Resolution: Unresolved
    • 11, 14
    • tbd
    • hotspot

    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

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

            Dates

              Created:
              Updated: