RFR: 8221724: Enable archiving of Strings with hash 0
Jiangli Zhou
jianglizhou at google.com
Mon Apr 1 21:47:49 UTC 2019
Hi Claes,
The changes look great to me. I especially like the new test case for
0-hash non-empty string.
There was this hidden issue for shared Strings introduced by object graph
archiving, which I didn't realize earlier. Although 0-hash strings were
excluded from archiving when walking the string table and constant pool
resolved references arrays, they could be archived into the 'Open' archive
heap region (writes are okay for the region) during the walk for object
graphs. That most likely was the cause of the problem that you observed
when archiving the constant BaseLocales. Thanks for fixing it!
Thanks and regards,
Jiangli
On Mon, Apr 1, 2019 at 6:14 AM Claes Redestad <claes.redestad at oracle.com>
wrote:
> Hi,
>
> the current implementation of String archiving explicitly excludes
> Strings with hashcode 0, including "". The reason for this is not
> explicitly stated, but is likely to be due the fact that
> String::hashCode currently stores the calculated 0 to String.hash every
> time, which doesn't play well with read-only memory.
>
> This behavior is a blocker for archiving things where such strings might
> exist and there is code depending on the identity of the same, so I
> propose dropping this restriction. This doesn't _break_ anything
> functionally: all tests passes with this patch, regardless of whether
> the patch I'm proposing to change String::hashCode is applied, but some
> pages could be dirtied and copied into non-shared memory.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8221724
> Webrev: http://cr.openjdk.java.net/~redestad/8221724/open.00/
>
> Testing: tier1-3
>
> Thanks!
>
> /Claes
>
> [1] https://bugs.openjdk.java.net/browse/JDK-8221723
>
More information about the hotspot-runtime-dev
mailing list