RFR: 8221723: Avoid storing zero to String.hash
Claes Redestad
claes.redestad at oracle.com
Mon Apr 1 15:47:24 UTC 2019
Hi Jiangli,
On 2019-04-01 17:21, Jiangli Zhou wrote:
>
>
> On Mon, Apr 1, 2019 at 4:59 AM Claes Redestad <claes.redestad at oracle.com
> <mailto:claes.redestad at oracle.com>> wrote:
>
> Hi,
>
> when a String has a calculated hash code value of 0, we recalculate and
> store a 0 to the String.hash field every time (except for the empty
> String, which is special cased). To make String objects more amenable to
> storage in shared read-only memory, e.g., CDS archives, we should avoid
> this redundant store.
>
>
> That was exactly the reason why 0-hash string was excluded from the
> closed archive heap region.
Thanks for confirming!
>
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8221723
> Webrev: http://cr.openjdk.java.net/~redestad/8221723/
>
>
> Looks good to me.
Thanks!
/Claes
More information about the core-libs-dev
mailing list