RFR: 8346657: Improve out of bounds exception messages for MemorySegments [v8]
Maurizio Cimadamore
mcimadamore at openjdk.org
Tue Nov 18 12:20:26 UTC 2025
On Mon, 17 Nov 2025 17:39:44 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Igor Rudenko has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Adjust to TestMergeStoresMemorySegment.java requirements
>
> I don't think the two private interfaces approach works - since there is only one `RuntimeException apply(String, List)` in AMSI, JLS mandates a compile error, and even if we compile, JVMS says any of these two methods can be chosen regardless of casting.
> @liach Benchmark results for MacOS
>
> **master**:
>
> ```
> Benchmark (ELEM_SIZE) Mode Cnt Score Error Units
> SegmentBulkHash.array 8 avgt 30 1.962 ± 0.003 ns/op
> SegmentBulkHash.array 64 avgt 30 3.701 ± 0.005 ns/op
> SegmentBulkHash.heapSegment 8 avgt 30 3.121 ± 0.007 ns/op
> SegmentBulkHash.heapSegment 64 avgt 30 12.982 ± 0.033 ns/op
> SegmentBulkHash.nativeSegment 8 avgt 30 2.901 ± 0.013 ns/op
> SegmentBulkHash.nativeSegment 64 avgt 30 12.825 ± 0.025 ns/op
> SegmentBulkHash.nativeSegmentJava 8 avgt 30 2.483 ± 0.007 ns/op
> SegmentBulkHash.nativeSegmentJava 64 avgt 30 26.347 ± 0.203 ns/op
> ```
>
> **1095cf6**:
>
> ```
> Benchmark (ELEM_SIZE) Mode Cnt Score Error Units
> SegmentBulkHash.array 8 avgt 30 1.968 ± 0.006 ns/op
> SegmentBulkHash.array 64 avgt 30 3.713 ± 0.006 ns/op
> SegmentBulkHash.heapSegment 8 avgt 30 3.125 ± 0.004 ns/op
> SegmentBulkHash.heapSegment 64 avgt 30 12.998 ± 0.023 ns/op
> SegmentBulkHash.nativeSegment 8 avgt 30 2.917 ± 0.018 ns/op
> SegmentBulkHash.nativeSegment 64 avgt 30 12.868 ± 0.020 ns/op
> SegmentBulkHash.nativeSegmentJava 8 avgt 30 2.484 ± 0.006 ns/op
> SegmentBulkHash.nativeSegmentJava 64 avgt 30 26.324 ± 0.044 ns/op
> ```
Bulk operation is the worst benchmark to test impact of bound checks. I think something like LoopOverNonConstant is better.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28124#issuecomment-3547344005
More information about the core-libs-dev
mailing list