RFR: 8307567: Avoid relocating global roots to metaspaceObjs in CDS dump [v3]

Ioi Lam iklam at openjdk.org
Fri May 12 02:34:00 UTC 2023


On Wed, 10 May 2023 23:55:24 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:

>> Ioi Lam has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Made SharedClassPathEntry a proper MetaspaceObj so we do not need FileMapInfo::remember_embedded_pointers()
>>  - Added comments about FileMapInfo::remember_embedded_pointers(); removed unused code
>
> src/hotspot/share/cds/archiveBuilder.cpp line 495:
> 
>> 493:   iterate_sorted_roots(&doit);
>> 494:   doit.finish();
>> 495:   FileMapInfo::remember_embedded_pointers();
> 
> What is the above call for?
> I thought `FileMapInfo::metaspace_pointers_do()` already called from `iterate_roots()` which is called from `iterate_sorted_roots()`.

This call was a hack. It was necessary because `SharedClassPathEntry` was not a regular `MetaspaceObj` type. 

I thought rewriting `SharedClassPathEntry` to subclass from `MetaspaceObj` would be too complicated, and wanted to delay that in a future REF. However, it turned out to be fairly straight-forward. I was able to further simplify the code. See commit [46aaec7](https://github.com/openjdk/jdk/pull/13854/commits/46aaec77036982e1454203e8466ccf04d5ff3575)

Now the pointers inside them are remembered during `ArchiveBuilder::gather_source_objs()`, just like other types of objects.

> src/hotspot/share/cds/archiveBuilder.hpp line 252:
> 
>> 250:   void make_shallow_copies(DumpRegion *dump_region, const SourceObjList* src_objs);
>> 251:   void make_shallow_copy(DumpRegion *dump_region, SourceObjInfo* src_info);
>> 252:   void relocate_embedded_pointers(SourceObjList* src_objs);
> 
> Blank line removed by accident?

Reverted.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13854#discussion_r1191848764
PR Review Comment: https://git.openjdk.org/jdk/pull/13854#discussion_r1191848807


More information about the hotspot-runtime-dev mailing list