RFR: 8271569: Rename cdsoffsets.cpp to cdsConstants.cpp

David Holmes dholmes at openjdk.java.net
Fri Sep 10 01:30:07 UTC 2021


On Thu, 9 Sep 2021 18:13:10 GMT, Yumin Qi <minqi at openjdk.org> wrote:

> Changed cdsOffsets.cpp to cdsConstants.cpp, now the offsets and constants are initialized static and searched separately.
> The offsets array could not use 'constexpr' since g++ on MacOs and VSC++ on Windows complained reinterpret_cast in 'offset_of' should not be used in constexpr initialization. Changed some field access for forming global list first.
> 
> Note with 'git mv' to rename cdsoffset.cpp to cdsConstants.cpp, same for cdsoffsets.hpp to cdsConstants.hpp, due to the contents changed more than 50% so git will not think cdsConstants.cpp is renamed from cdsoffsets.cpp. Instead, it is regarded as a new file.
> 
> Tests: ter1-4
> 
> Thanks
> Yumin

Hi Yumin,

There's obviously a lot more going on here than just a simple rename so I think the JBS issue should be changed accordingly.

A few minor comments below.

Thanks,
David

src/hotspot/share/cds/cdsConstants.cpp line 61:

> 59: 
> 60: size_t get_cds_offset(const char* name) {
> 61:   for (int i = 0; i < (int)(sizeof(cds_offsets)/sizeof(cds_offsets[0])); i++) {

Can't we just define a size for the array and use that? It isn't really a dynamic/unknown quantity.

src/hotspot/share/cds/dynamicArchive.hpp line 45:

> 43: 
> 44: public:
> 45:   int _base_region_crc[MetaspaceShared::n_regions];

This looks like it should be private with either a public accessor or else a friend declaration for the client code.

src/hotspot/share/cds/filemap.hpp line 211:

> 209:   // will function correctly with this JVM and the bootclasspath it's
> 210:   // invoked with.
> 211: public:

Again this looks like it should be private with either a public accessor or else a friend declaration for the client code.

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

PR: https://git.openjdk.java.net/jdk/pull/5450


More information about the hotspot-runtime-dev mailing list