RFR: 8265518: C1: Intrinsic support for Preconditions.checkIndex [v13]

Volker Simonis simonis at openjdk.java.net
Sat Jun 12 07:04:53 UTC 2021


On Wed, 9 Jun 2021 08:53:40 GMT, Yi Yang <yyang at openjdk.org> wrote:

>> The JDK codebase re-created many variants of checkIndex(`grep -I -r 'cehckIndex' jdk/`). A notable variant is java.nio.Buffer.checkIndex, which annotated with @IntrinsicCandidate and it only has a corresponding C1 intrinsic version.
>> 
>> In fact, there is an utility method `jdk.internal.util.Preconditions.checkIndex`(wrapped by java.lang.Objects.checkIndex) that behaves the same as these variants of checkIndex, we can replace these re-created variants of checkIndex by Objects.checkIndex, it would significantly reduce duplicated code and enjoys performance improvement because Preconditions.checkIndex is @IntrinsicCandidate and it has a corresponding intrinsic method in HotSpot.
>> 
>> But, the problem is currently HotSpot only implements the C2 version of Preconditions.checkIndex. To reuse it global-widely in JDK code, I think we can firstly implement its C1 counterpart. There are also a few kinds of stuff we can do later:
>> 
>> 1. Replace all variants of checkIndex by Objects.checkIndex in the whole JDK codebase.
>> 2. Remove Buffer.checkIndex and obsolete/deprecate InlineNIOCheckIndex flag
>> 
>> Testing: cds, compiler and jdk
>
> Yi Yang has updated the pull request incrementally with one additional commit since the last revision:
> 
>   more comment

Looks like you are right Yi:

https://wiki.openjdk.java.net/display/HotSpot/Hotspot+Command-line+Flags%3A+Kinds%2C+Lifecycle+and+the+CSR+Process

Seems like for diagnostic flags the creation of a CSR is up to the
developer.

Sorry for the confusion.

Yi Yang ***@***.***> schrieb am Sa., 12. Juni 2021, 08:54:

> This change removed a product flag so I wonder how it could be integrated
> without a CSR?
>
> It's a diagnostic product flag, so it’ okay to remove it without issuing
> CSR. But I am not 100% sure.
>
> @dholmes-ora <https://github.com/dholmes-ora>, do you have any comment
> about this? Thanks!
>
>> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/openjdk/jdk/pull/3615#issuecomment-860010589>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAYH5VPC6ZMY76YNJ4C4S4DTSMABPANCNFSM43L2BATA>
> .
>

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

PR: https://git.openjdk.java.net/jdk/pull/3615


More information about the hotspot-compiler-dev mailing list