RFR: 8255150: Add utility methods to check long indexes and ranges [v4]
Roland Westrelin
roland at openjdk.java.net
Mon Nov 9 09:09:25 UTC 2020
> This change add 3 new methods in Objects:
>
> public static long checkIndex(long index, long length)
> public static long checkFromToIndex(long fromIndex, long toIndex, long length)
> public static long checkFromIndexSize(long fromIndex, long size, long length)
>
> This mirrors the int utility methods that were added by JDK-8135248
> with the same motivations.
>
> As is the case with the int checkIndex(), the long checkIndex() method
> is JIT compiled as an intrinsic. It allows the JIT to compile
> checkIndex to an unsigned comparison and properly recognize it as
> a range check that then becomes a candidate for the existing range check
> optimizations. This has proven to be important for panama's
> MemorySegment API and a prototype of this change (with some extra c2
> improvements) showed that panama micro benchmark results improve
> significantly.
>
> This change includes:
>
> - the API change
> - the C2 intrinsic
> - tests for the API and the C2 intrinsic
>
> This is a joint work with Paul who reviewed and reworked the API change
> and filled the CSR.
Roland Westrelin has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 11 additional commits since the last revision:
- CastLL should define carry_depency
- intrinsic comments
- Jorn's comments
- Update headers and add intrinsic to Graal test ignore list
- move compiler test and add bug to test
- non x86_64 arch support
- c2 test case
- intrinsic
- Use overloads of method names.
Simplify internally to avoid overload resolution
issues, leverging List<Number> for the exception
mapper.
- Vladimir's comments
- ... and 1 more: https://git.openjdk.java.net/jdk/compare/976fa4c6...692b4298
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/1003/files
- new: https://git.openjdk.java.net/jdk/pull/1003/files/aaacd328..692b4298
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1003&range=03
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1003&range=02-03
Stats: 515 lines in 41 files changed: 400 ins; 66 del; 49 mod
Patch: https://git.openjdk.java.net/jdk/pull/1003.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/1003/head:pull/1003
PR: https://git.openjdk.java.net/jdk/pull/1003
More information about the core-libs-dev
mailing list