RFR: 8310843: Reimplement ByteArray and ByteArrayLittleEndian with Unsafe
Chen Liang
liach at openjdk.org
Mon Jun 10 03:25:17 UTC 2024
On Mon, 10 Jun 2024 02:12:11 GMT, Glavo <duke at openjdk.org> wrote:
> Things have changed since https://github.com/openjdk/jdk/pull/14636 was closed, so let me reopen it.
>
> https://github.com/openjdk/jdk/pull/15386 confirmed that `VarHandle` in BALE caused a startup regression. In order to not have any more revert patches, it makes sense to optimize BALE.
>
> The optimization of https://github.com/openjdk/jdk/pull/16245 allows the traditional expression to have good performance, but BA and BALE save us from having to copy these lengthy expressions everywhere. So it makes sense to keep them.
>
> Now here's the question, should I rewrite this PR without `Unsafe`? I'll do some research (e.g. does `Unsafe` have better performance during warmup?), but I'd also like to take some advice.
No matter if we use unsafe or not, keeping multi-byte write and read operations all to one class so we can update them altogether sounds like a good idea. The only risk is that some operations will happen in early startup, such as ClassFile processing, which prohibits some implementations like VarHandle.
Also feel free to choose another title for this patch, I will update the JBS issue for you.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/19616#issuecomment-2157121539
More information about the core-libs-dev
mailing list