RFR: 8335583: Avoid using pointers in CDS tables

Ioi Lam iklam at openjdk.org
Mon Nov 4 16:55:29 UTC 2024


On Fri, 1 Nov 2024 16:39:01 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:

> There are several calls to mark_pointer which can be avoided if offsets are used instead, This will help to reduce the archive size and reduce startup time.
> 
> This patch introduces some utility functions in the first commit to assist in converting to and from u4 offsets. For ease of review, consider looking at each commit separately as they each address an individual pointer to offset change. Verified with tier 1-5 tests.

Changes requested by iklam (Reviewer).

src/hotspot/share/cds/lambdaFormInvokers.cpp line 245:

> 243:       if (ArchiveBuilder::is_active()) {
> 244:         line = ArchiveBuilder::current()->offset_to_buffered<Array<char>*>(offset);
> 245:       } else {

The `if (ArchiveBuilder::is_active()` branch doesn't seem necessary, as this function is called in only a single place where this condition is false.

src/hotspot/share/cds/runTimeClassInfo.hpp line 180:

> 178:   InstanceKlass* nest_host() {
> 179:     if (ArchiveBuilder::is_active() && ArchiveBuilder::current()->is_in_buffer_space((address)this)) {
> 180:       return ArchiveBuilder::current()->offset_to_buffered<InstanceKlass*>(_nest_host_offset);

I think this function is never called under this condition. Maybe the `if` should be turned into an assert:


assert(!ArchiveBuilder::is_active(), "not called when dumping archive");

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

PR Review: https://git.openjdk.org/jdk/pull/21837#pullrequestreview-2413588549
PR Review Comment: https://git.openjdk.org/jdk/pull/21837#discussion_r1828051403
PR Review Comment: https://git.openjdk.org/jdk/pull/21837#discussion_r1828058393


More information about the hotspot-runtime-dev mailing list