RFR: 8349503: Consolidate multi-byte access into ByteArray
Chen Liang
liach at openjdk.org
Wed Feb 5 23:45:25 UTC 2025
`MethodHandles.byteArrayViewVarHandle` exposes checked multi-byte access to byte arrays via VarHandle. This larger access speeds up many operations, yet it cannot be used in early bootstrap, and as a result, people tend to use `Unsafe` which can threaten memory safety of the Java Platform.
To promote the safe use of multi-byte access, I propose to move the checked implementations from VarHandle to ByteArray to allow earlier use and reduce maintenance costs. In addition, ByteArrayLittleEndian is consolidated, and now the access methods are distinguished by BO (byte order) / BE (big endian) / LE (little endian) suffixes to indicate their access features.
-------------
Commit messages:
- Update bug id
- copyright years and comments
- Consolidate multi-byte io into ByteArray
Changes: https://git.openjdk.org/jdk/pull/23478/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23478&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8349503
Stats: 2042 lines in 17 files changed: 714 ins; 1134 del; 194 mod
Patch: https://git.openjdk.org/jdk/pull/23478.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/23478/head:pull/23478
PR: https://git.openjdk.org/jdk/pull/23478
More information about the core-libs-dev
mailing list