RFR: 8357531: The `SegmentBulkOperations::fill` method can be improved using overlaps [v6]

Per Minborg pminborg at openjdk.org
Mon Jun 2 13:24:00 UTC 2025


On Thu, 29 May 2025 09:52:34 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> Per Minborg 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 seven additional commits since the last revision:
>> 
>>  - Merge branch 'master' into fill-overlap
>>  - Update test/micro/org/openjdk/bench/java/lang/foreign/SegmentBulkFill.java
>>    
>>    Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>
>>  - Update benchmark to reflect new fill method
>>  - Simplify
>>  - Add case for long operations and break out methods
>>  - Correct typo in comment
>>  - Simplify the fill method
>
> test/micro/org/openjdk/bench/java/lang/foreign/SegmentBulkFill.java line 98:
> 
>> 96:     }
>> 97: 
>> 98:     @Fork(value = 3, jvmArgs = {"-Djava.lang.foreign.native.threshold.power.fill=0"})
> 
> Why did you remove this line? It's essential for correct `Unsafe` results.

The reason  I removed it is that it no longer works this way. For small segments, Java code will be used unconditionally. It is only for larger (>=32 bytes) we check this property. So, now the benchmark directly invokes the branch that calls Unsafe (`SCOPED_MEMORY_ACCESS::setMemory`). I hope this clarifies things.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25383#discussion_r2121136632


More information about the core-libs-dev mailing list