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

Add utility methods to check machine word indexes and ranges

    Details

    • Type: Enhancement
    • Status: New
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None

      Description

      JDK-8135248 added utility methods like Objects.checkIndex
      to supply efficient checking of indexes for arrays and array-like
      aggregates. These methods operate on 32-bit indexes only.
      They should be duplicated to also operate on 64-bit indexes.

      One customer for this API is the bounds checking of Panama
      pointers. As with C, Panama pointer manipulation is important
      to performance; unlike C, Panama pointers range-check their
      pointers, so optimizing their range checks is a goal.

      It would be sufficient for Panama to place these methods only
      in jdk.internal.util.Preconditions, where the binder can get to them.

      Both signed and unsigned versions of these checkers are plausible.
      Panama needs only the signed 64-bit versions, at present.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jrose John Rose
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: