On Wed, 6 Oct 2021 17:01:58 GMT, Ioi Lam <ik...@openjdk.org> wrote:

>> see above reply. We need read the full _header_size for _header. Also note 
>> that helper class will delete gen_header when out of scope.
>
> I see. I think your current code is fine.
> 
> Note that the current code writes the header as a FileMapHeader, but it reads 
> it as both a FileMapHeader and a CDSFileMapHeaderBase. So it has the basic 
> assumption `FileMapHeader::_generic_header` is at offset 0 of FileMapHeader. 
> Therefore, in FileHeaderHelper::initialize, we should add an assert:
> 
> 
> static_assert(offsetof(FileMapHeader, _generic_header) == 0, "must be");

This caused compiling error: since FileHeaderHelper is not a friend of 
FileMapHeader so no access to its fields:
error: 'GenericCDSFileMapHeader CDSFileMapHeaderBase::_generic_header' is 
inaccessible within this context

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

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

Reply via email to