RFR: 8354300: Mark String.hash field @Stable [v2]

Per Minborg pminborg at openjdk.org
Tue Apr 22 08:26:17 UTC 2025


> This PR proposes to add the `@Stable` annotation to `j.l.String.hash` and `j.l.String.hashIsZero`. This means the VM can trust these fields to never change which enables constant folding optimizations.
> 
> This PR is tested in tier1, tier2, tier3, and tier4 which all pass.

Per Minborg has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:

 - Remove @Stable annotation from hashIsZero, add benchmark
 - Merge branch 'master' into string-stable-fields
 - Update copyright year
 - Annotate fields with @Stable

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/24625/files
  - new: https://git.openjdk.org/jdk/pull/24625/files/04184d06..89cc60ce

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=24625&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=24625&range=00-01

  Stats: 196452 lines in 612 files changed: 26247 ins; 168588 del; 1617 mod
  Patch: https://git.openjdk.org/jdk/pull/24625.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24625/head:pull/24625

PR: https://git.openjdk.org/jdk/pull/24625


More information about the core-libs-dev mailing list