serialize.cpp uses objArrayOopDesc::base_offset_in_bytes(T_BYTE)

View: New views
4 Messages — Rating Filter:   Alert me  

serialize.cpp uses objArrayOopDesc::base_offset_in_bytes(T_BYTE)

by Christian Thalinger-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

Yesterday I wanted to add:

   objArrayOopDesc::base_offset_in_bytes() (note: with no argument)

because an objArrayOopDesc holds only oops anyway, so always using
T_OBJECT seems correct to me.

After adding the method and doing a compile, I noticed that
serialize.cpp:54 uses it like this:

   soc->do_tag(objArrayOopDesc::base_offset_in_bytes(T_BYTE));

That looks very odd and, unfortunately, does not have a comment that
explains why it is done that way.  Can someone explain to me why T_BYTE
is used in that case and if it could be changed to T_OBJECT?

-- Christian

Re: serialize.cpp uses objArrayOopDesc::base_offset_in_bytes(T_BYTE)

by keith.mcguigan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I suspect that's a bug that should be able to be safely converted to a
T_OBJECT.

The code you reference in serialize.cpp is used to write out and read in
data to/from the shared class archive file for class data sharing (CDS).
  It writes out a number of constants in the header of the file and then
verifies that these constants haven't changed when the archive file is
read back in.  If you change this from T_BYTE to T_OBJECT, it will
likely change that value (unless we're real lucky with the alignments),
and this may prevent archive files created before your change from being
loaded into VMs after your change.  I think that's ok, though, since
deployments run -Xshare:dump (creating a new archive) whenever a new JDK
is installed.

--
- Keith

Christian Thalinger wrote:

> Hi!
>
> Yesterday I wanted to add:
>
>   objArrayOopDesc::base_offset_in_bytes() (note: with no argument)
>
> because an objArrayOopDesc holds only oops anyway, so always using
> T_OBJECT seems correct to me.
>
> After adding the method and doing a compile, I noticed that
> serialize.cpp:54 uses it like this:
>
>   soc->do_tag(objArrayOopDesc::base_offset_in_bytes(T_BYTE));
>
> That looks very odd and, unfortunately, does not have a comment that
> explains why it is done that way.  Can someone explain to me why T_BYTE
> is used in that case and if it could be changed to T_OBJECT?
>
> -- Christian


Re: serialize.cpp uses objArrayOopDesc::base_offset_in_bytes(T_BYTE)

by Christian Thalinger-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Keith McGuigan wrote:

> I suspect that's a bug that should be able to be safely converted to a
> T_OBJECT.
>
> The code you reference in serialize.cpp is used to write out and read in
> data to/from the shared class archive file for class data sharing (CDS).
>   It writes out a number of constants in the header of the file and then
> verifies that these constants haven't changed when the archive file is
> read back in.  If you change this from T_BYTE to T_OBJECT, it will
> likely change that value (unless we're real lucky with the alignments),
> and this may prevent archive files created before your change from being
> loaded into VMs after your change.  I think that's ok, though, since
> deployments run -Xshare:dump (creating a new archive) whenever a new JDK
> is installed.

Thanks for the explanation, that seems reasonable to me.  Should I open
a CR and propose a patch on hotspot-runtime-dev (Tom told me that this
code is owned by the runtime team)?

-- Christian

Re: serialize.cpp uses objArrayOopDesc::base_offset_in_bytes(T_BYTE)

by keith.mcguigan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Christian Thalinger wrote:

> Keith McGuigan wrote:
>> I suspect that's a bug that should be able to be safely converted to a
>> T_OBJECT.
>>
>> The code you reference in serialize.cpp is used to write out and read in
>> data to/from the shared class archive file for class data sharing (CDS).
>>   It writes out a number of constants in the header of the file and then
>> verifies that these constants haven't changed when the archive file is
>> read back in.  If you change this from T_BYTE to T_OBJECT, it will
>> likely change that value (unless we're real lucky with the alignments),
>> and this may prevent archive files created before your change from being
>> loaded into VMs after your change.  I think that's ok, though, since
>> deployments run -Xshare:dump (creating a new archive) whenever a new JDK
>> is installed.
>
> Thanks for the explanation, that seems reasonable to me.  Should I open
> a CR and propose a patch on hotspot-runtime-dev (Tom told me that this
> code is owned by the runtime team)?

Sure.

--
- Keith