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

Fields in String are not trusted

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P2 P2
    • 25
    • None
    • core-libs
    • Fix Understood

      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

            pminborg Per-Ake Minborg
            pminborg Per-Ake Minborg
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: