RFR: 8271419: Refactor test code for modifying CDS archive contents

Yumin Qi minqi at openjdk.java.net
Fri Jul 30 22:24:29 UTC 2021


On Fri, 30 Jul 2021 21:02:17 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:

>> The code for modifying CDS archive content could be used by other tests so the common code is refactored into a util class CDSArchiveUtils.
>> 
>> Tests: tier1,tier4
>> 
>> Thanks
>> Yumin
>
> test/hotspot/jtreg/runtime/cds/appcds/SharedArchiveConsistency.java line 159:
> 
>> 157:     public static void modifyHeaderIntField(File jsaFile, long offset, int value) throws Exception {
>> 158:         System.out.println("    offset " + offset);
>> 159:         byte[] buf = { (byte)(value >> 24), (byte)(value >> 16), (byte)(value >> 8), (byte)(value)};
> 
> Isn't this the same as the original code which does a `ByteBuffer.wrap()`?
> If so, why changing it.

I make CDSARchiveUtils take byte[] as input, not ByteBuffer. Here just simply convert int to byte[].

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

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


More information about the hotspot-runtime-dev mailing list