RFR: 8323900: Avoid calling os::init_random() in CDS static dump
Ioi Lam
iklam at openjdk.org
Thu Apr 11 21:17:43 UTC 2024
On Wed, 10 Apr 2024 16:31:08 GMT, Ioi Lam <iklam at openjdk.org> wrote:
> The purpose of the PR is to avoid modifying the global JVM state while dumping the CDS archive.
>
> When updating the identity hashcode for archived Symbols, call `ArchiveBuilder::current()->entropy()` instead of `os::random()`. As a result, CDS no longer needs to call `os::init_random()` with a deterministic seed.
> Thinking about this, since global entropy (archived object ihashes) sneak into archives whether we use local seeds or not, maybe we should not bother with such a patch.
>
> In other words, if global state affects the archive anyway, we may just as well roll with it.
>
> See #18735
In CDS, we intend to be as much independent of the global JVM state as possible. For example, since [JDK-8296344](https://bugs.openjdk.org/browse/JDK-8296344), we no longer make a copy of the the archived heap objects in the actual Java heap.
The intention of this PR is the same -- the contents of archived Symbols should not depend on the value of the os::random() seed.
In #18735 you found that some other contents of the CDS archive depend on the JVM's os::random() seed. That may be something we want to fix separately. In any case, that's not a reason to not proceed with this PR.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/18728#issuecomment-2050564497
More information about the hotspot-dev
mailing list