RFR: 8310843: Reimplement ByteArray and ByteArrayLittleEndian with Unsafe [v10]
Alan Bateman
alanb at openjdk.org
Thu Jul 20 08:33:49 UTC 2023
On Thu, 13 Jul 2023 23:05:48 GMT, Glavo <duke at openjdk.org> wrote:
>> `ByteArray` and `ByteArrayLittleEndian` are very useful tool classes that can be used in many places to performance tuning.
>>
>> Currently they are implemented by `VarHandle`, so using them may have some impact on startup time.
>>
>> This PR reimplements them using `Unsafe`, which reduces the impact on startup time.
>
> Glavo has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 15 additional commits since the last revision:
>
> - Merge branch 'openjdk:master' into unsafe
> - add 8310843 to @bug
> - Merge branch 'openjdk:master' into unsafe
> - Merge branch 'openjdk:master' into unsafe
> - delete incorrect comments
> - delete extraneous whitespace
> - add javadoc
> - delete extraneous whitespace
> - fix test
> - update tests
> - ... and 5 more: https://git.openjdk.org/jdk/compare/1d09702e...cb56e736
src/java.base/share/classes/jdk/internal/util/ByteArray.java line 49:
> 47: * can be used in fundamental classes, {@code VarHandle} exercise many other
> 48: * code at VM startup, this could lead a recursive calls when fundamental
> 49: * classes is used in {@code VarHandle}.
This comment is confusing. If this code is changed then the comment can be very simple to say that it uses Unsafe to allow it be used in early startup and the VarHandle implementation.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14636#discussion_r1269126431
More information about the core-libs-dev
mailing list