RFR: 8221723: Avoid storing zero to String.hash
Claes Redestad
claes.redestad at oracle.com
Mon Apr 1 12:36:21 UTC 2019
Hi Pavel,
On 2019-04-01 14:20, Pavel Rappo wrote:
> Hi Claes,
>
>> To make String objects more amenable to storage in shared read-only memory,
>> e.g., CDS archives, we should avoid this redundant store.
>
> Could you please elaborate on that?
>
currently, heap archiving excludes Strings with hash 0 from being
archived. This includes "" etc. I intend to fix that in JDK-8221724[1]
but that'd then lead to read-only memory pages backed by the archive to
be dirtied when getting the hash code of such Strings (it wouldn't
break, but it'd be effectively copy-on-write and diminish the benefit
of storing Strings in archives and similar solutions). This patch merely
ensures that such dirtying doesn't happen and that we can archive
0-hashcode Strings without repercussions.
Makes sense?
/Claes
https://bugs.openjdk.java.net/browse/JDK-8221724
More information about the core-libs-dev
mailing list