On Wed, 5 Feb 2025 23:41:19 GMT, Chen Liang <li...@openjdk.org> wrote:
> `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. test/micro/org/openjdk/bench/vm/compiler/MergeStores.java line 175: > 173: public byte[] store_B2_con_offs_allocate_bale() { > 174: byte[] aB = new byte[RANGE]; > 175: ByteArray.setShortLE(aB, offset, (short)0x0201); Did you run this benchmark to see if there is any impact? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23478#discussion_r1970261194