RFR: 8354300: Fields in String are not trusted
Vladimir Ivanov
vlivanov at openjdk.org
Fri Apr 18 21:41:42 UTC 2025
On Mon, 14 Apr 2025 14:47:59 GMT, Per Minborg <pminborg at openjdk.org> wrote:
> 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.
Looks fine.
Bug summary is misleading though (all fields in java.lang package *are* trusted from JVM POV). Please, change it (e.g., "Mark String.hash field stable").
-------------
Marked as reviewed by vlivanov (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/24625#pullrequestreview-2779480984
More information about the core-libs-dev
mailing list