RFR: 8329431: Improve speed of writing CDS heap objects [v2]

Ioi Lam iklam at openjdk.org
Mon Apr 8 03:02:03 UTC 2024


On Thu, 4 Apr 2024 21:29:12 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:

>> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   @matias9927 and @calvinccheung comments
>
> src/hotspot/share/cds/archiveHeapWriter.cpp line 82:
> 
>> 80:     Universe::heap()->collect(GCCause::_java_lang_system_gc);
>> 81: 
>> 82:     _buffer_offset_to_source_obj_table = new BufferOffsetToSourceObjectTable(36137, 1 * M);
> 
> Is there a variable we can use instead of the hard coded value 36137? It isn't immediately clear why this value is used and I think a named variable would clear that up.

I changed to something like this:

`new BufferOffsetToSourceObjectTable(/*size*/36137, /*max size*/1 * M)`

> src/hotspot/share/cds/archiveHeapWriter.cpp line 294:
> 
>> 292: 
>> 293:     _buffer_offset_to_source_obj_table->put(buffer_offset, src_obj);
>> 294:     _buffer_offset_to_source_obj_table->maybe_grow();
> 
> Similar to Calvin's comment, is it better to call `put_if_absent()` and then `maybe_grow()` if a new entry is created?

Changed to `put_when_absent()` as this entry is guarantee to not exist.

> src/hotspot/share/cds/archiveHeapWriter.hpp line 153:
> 
>> 151:   struct HeapObjOrder {
>> 152:     int _index;    // The location of this object in _source_objs
>> 153:     int _rank;     // A lower rank means the object will be writte at a lower location.
> 
> Typo: writte -> written

Fixed

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18572#discussion_r1555173070
PR Review Comment: https://git.openjdk.org/jdk/pull/18572#discussion_r1555173206
PR Review Comment: https://git.openjdk.org/jdk/pull/18572#discussion_r1555173218


More information about the hotspot-runtime-dev mailing list