RFR: 8304006: jlink should create the jimage file in the native endian for the target platform [v14]

Jaikiran Pai jpai at openjdk.org
Tue Mar 28 02:23:05 UTC 2023


On Mon, 27 Mar 2023 16:41:09 GMT, Mandy Chung <mchung at openjdk.org> wrote:

>> Jaikiran Pai has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - update the property key names in target.properties to use ".endianness" suffix
>>  - remove @since 21 on internal class
>
> src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Platform.java line 57:
> 
>> 55:                 if (platform.isEmpty()) {
>> 56:                     throw new InternalError("Incorrect key '" + key + "'");
>> 57:                 }
> 
> If you scan all entries, this can probably check the value is valid (`little` or `big`) and store them in a `Map<String, ByteOrder>` so that `parsePlatform` can simply get the byte order by `KNOWN_ENDIANNESS.get(platformString)`.
> 
> Or the other option can just be doing in the `parsePlatform` method and not needed to scan all entries.
> 
> 
>    String v = KNOWN_ENDIANNESS.getProperty(platformString + ENDIANNESS_KEY_SUFFIX);

Hello Mandy, I was in two minds when I added that iteration logic. I wasn't sure if that was necessary or we could just check for the values when looking up. I have now updated the PR to remove the iteration and just rely on looking up the key, as you suggested, and then checking the value.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/11943#discussion_r1149955754


More information about the core-libs-dev mailing list