RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v2]

Andriy Plokhotnyuk duke at openjdk.org
Wed Jan 4 11:21:49 UTC 2023


On Wed, 4 Jan 2023 10:49:18 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> Do we need this test at all, because this code is tested to extense through RandomAccessFile? We had no test before, so why add a new one here?
>> 
>> Otherwise: PR looks good.
>
>> Do we need this test at all, because this code is tested to extense through RandomAccessFile? We had no test before, so why add a new one here?
>> 
>> Otherwise: PR looks good.
> 
> There are overlaps of the RAF and Bits tests but the latter tests additional aspects such as unaligned access and edge cases with exceptions. So, I think we should keep the proposed tests.

@minborg Amazing piece!

Will `java.lang.invoke.VarHandle` instances be shared in JDK to reuse in other places? 

The [jsoniter-scala-coreJVM](https://github.com/plokhotnyuk/jsoniter-scala/tree/master/jsoniter-scala-core/jvm/src/main/scala/com/github/plokhotnyuk/jsoniter_scala/core) module of the [jsoniter-scala](https://github.com/plokhotnyuk/jsoniter-scala) project has a lot of SWAR tricks that use `java.lang.invoke.VarHandle` to speed up parsing/serialization of primitives, `java.math.BigDecimal`, and `java.time.*` classes from/to textual representation.

Are you interested to port some of them to JDK as it was done for `java.util.UUID` parsing [here](https://github.com/openjdk/jdk/commit/ebadfaeb2e1cc7b5ce5f101cd8a539bc5478cf5b)?

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

PR: https://git.openjdk.org/jdk/pull/11840


More information about the core-libs-dev mailing list