Mark String.hash field @Stable

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P2
    • 25
    • Affects Version/s: None
    • Component/s: core-libs
    • b20
    • Verified

      The VM cannot trust the fields in `String` are never changed as they are not `@Stable` annotated. Making the fields trustworthy would improve performance in many situations.

      Example

      static final Map<String, VarHandle> MAP = Map.of(....);

      MAP.get("malloc").invokeExact(42L); // This could constant fold

            Assignee:
            Per-Ake Minborg
            Reporter:
            Per-Ake Minborg
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: