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

Unsafe.addressSize() does not optimize

    Details

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

      Description

      I noticed as part of my work on JDK-8141491 that the addressSize() method isn't an intrinsic, and so if somebody accidentally uses that method instead of the ADDRESS_SIZE field in Unsafe the resulting code will always call into the VM.

      Yes, I'm using Unsafe. Yes, I should know better. That said, it would be nice if we could either make addressSize() do the right thing, OR at least make it private, OR at least document that it shouldn't be used directly and that ADDRESS_SIZE is what should be used instead - *even* if this is "just" Unsafe.

      I also noticed that there's at least one place in the JDK where addressSize() is used - sun/nio/ch/NativeObject calls addressSize() instead of using the ADDRESS_SIZE field, so it will not be fully optimized.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                mikael Mikael Vidstedt
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: