-
Type:
Enhancement
-
Resolution: Fixed
-
Priority:
P2
-
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
Example
static final Map<String, VarHandle> MAP = Map.of(....);
MAP.get("malloc").invokeExact(42L); // This could constant fold
- relates to
-
JDK-8355378 Annotate lazy hash fields @Stable
-
- Open
-
-
JDK-8354777 Strings with hash = 0 are not constant foldable
-
- Open
-
-
JDK-8161250 javac should use indy to compute switch indexes for strings and enums
-
- Open
-
- links to
-
Commit(master)
openjdk/jdk/072b8273
-
Review(master)
openjdk/jdk/24625