On Tue, 18 Nov 2025 12:16:15 GMT, Maurizio Cimadamore <[email protected]> 
wrote:

>> Igor Rudenko has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   improvements according to reviewer comments
>
> src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java
>  line 413:
> 
>> 411:     private void checkBounds(long offset, long length, BoundPolicy 
>> policy) {
>> 412:         if (length > 0) {
>> 413:             Preconditions.checkIndex(offset, this.length - length + 1, 
>> new BoundsCheckHandler(this, policy));
> 
> This is a very very hot path. Allocating here is gonna have negative effect, 
> especially when this code cannot be inlined (in which case the allocation 
> can't be scalar replaced).

Thank you for pointing this out, I believe we can move on with this solution if 
and only if the escape analysis eliminates instance creation. I'll run 
benchmarks you mentioned in order to check if it's so.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28124#discussion_r2538008716

Reply via email to