[master] RFR: 8318011: [Lilliput] Fix CDS narrowKlass encoding

Thomas Stuefe stuefe at openjdk.org
Fri Oct 13 09:44:48 UTC 2023


On Thu, 12 Oct 2023 12:44:36 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

> With Lilliput, we need to store the correct narrowKlass in the archived Klass instances. For this, we need the ArchiveHeapWriter::precomputed_narrow_klass_shift. However, ArchiveHeapWriter is only available when building with INCLUDE_CDS_JAVA_HEAP, i.e. currently not with Windows. This field should be moved to ArchiveBuilder, so that we can access it even when INCLUDE_CDS_JAVA_HEAP is not enabled.

Good. Proposal for comment change inline.

src/hotspot/share/cds/archiveBuilder.hpp line 102:

> 100:   //    runtime we put both regions adjacent to each other. Therefore, runtime Klass range size < 4G.
> 101:   //    Since nKlass itself is 32 bit, our encoding range len is 4G, and since we set the base directly
> 102:   //    at mapping start, these 4G are enough. Therefore, we don't need to shift at all (shift=0).

I would reformulate the first sentence. I spend a lot of cycles on the original text, and its not fully correct anymore.
Proposal:

The archive contains pre-computed narrow Klass IDs in two places:
- in the header of archived java objects (only if the archive contains java heap portions)
- within the prototype markword of archived Klass structures.
These narrow Klass ids have been computed at dump time with the following scheme:
blalblabla

-------------

Marked as reviewed by stuefe (Committer).

PR Review: https://git.openjdk.org/lilliput/pull/112#pullrequestreview-1676124813
PR Review Comment: https://git.openjdk.org/lilliput/pull/112#discussion_r1358036362


More information about the lilliput-dev mailing list