Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer [v6]

2024-11-04 Thread Maurizio Cimadamore
On Fri, 1 Nov 2024 07:53:03 GMT, Per Minborg wrote: >> This PR proposes to improve `MemorySegment::ofBuffer` making it more >> amenable to inlining and generally improving performance. >> >> Testing successfully on tier1-6 > > Per Minborg has updated the pull request incrementally with one addi

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer [v5]

2024-11-01 Thread Per Minborg
On Fri, 1 Nov 2024 07:42:34 GMT, Per Minborg wrote: >> Because heap segments don’t have to be backed by an array. > > The reason was what @ExE-Boss mentioned but for me, I am happy with either > name. I will update to `heapSegment()`. The method has been moved into Buffer implementations now.

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer [v6]

2024-11-01 Thread Per Minborg
> This PR proposes to improve `MemorySegment::ofBuffer` making it more amenable > to inlining and generally improving performance. > > Testing successfully on tier1-6 Per Minborg has updated the pull request incrementally with one additional commit since the last revision: Rename methods --

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer [v5]

2024-11-01 Thread Per Minborg
On Thu, 31 Oct 2024 19:06:16 GMT, ExE Boss wrote: >> src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java >> line 526: >> >>> 524: final Object base = NIO_ACCESS.getBufferBase(b); >>> 525: return (base == null) >>> 526: ? nativeSegment(

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer [v5]

2024-10-31 Thread Maurizio Cimadamore
On Thu, 31 Oct 2024 19:06:16 GMT, ExE Boss wrote: > Because heap segments don’t have to be backed by an array. I don't really know how to read this. We're asking a nio buffer to give us back a memory segment. There's two kinds of memory segment: heap segments and native segments (as the javado

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer [v5]

2024-10-31 Thread ExE Boss
On Thu, 31 Oct 2024 17:20:11 GMT, Maurizio Cimadamore 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 12 additional >> co

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer [v5]

2024-10-31 Thread Maurizio Cimadamore
On Thu, 31 Oct 2024 14:04:01 GMT, Per Minborg wrote: >> This PR proposes to improve `MemorySegment::ofBuffer` making it more >> amenable to inlining and generally improving performance. >> >> Testing successfully on tier1-3 > > Per Minborg has updated the pull request with a new target base due

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer [v3]

2024-10-31 Thread Maurizio Cimadamore
On Thu, 31 Oct 2024 12:56:54 GMT, Per Minborg wrote: >> This PR proposes to improve `MemorySegment::ofBuffer` making it more >> amenable to inlining and generally improving performance. >> >> Testing successfully on tier1-3 > > Per Minborg has updated the pull request incrementally with one add

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer [v2]

2024-10-31 Thread Maurizio Cimadamore
On Thu, 31 Oct 2024 10:25:11 GMT, Maurizio Cimadamore wrote: > Do you refer to char buffers backed by Strings? If so, I wouldn't worry much about that -- after all, the logic in the code already detects this condition and throws an exception... so it's still heap buffer vs. direct buffer IMHO

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer [v5]

2024-10-31 Thread Per Minborg
> This PR proposes to improve `MemorySegment::ofBuffer` making it more amenable > to inlining and generally improving performance. > > Testing successfully on tier1-3 Per Minborg has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer [v4]

2024-10-31 Thread Per Minborg
> This PR proposes to improve `MemorySegment::ofBuffer` making it more amenable > to inlining and generally improving performance. > > Testing successfully on tier1-3 Per Minborg has updated the pull request incrementally with one additional commit since the last revision: Rename method ---

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer [v3]

2024-10-31 Thread Per Minborg
> This PR proposes to improve `MemorySegment::ofBuffer` making it more amenable > to inlining and generally improving performance. > > Testing successfully on tier1-3 Per Minborg has updated the pull request incrementally with one additional commit since the last revision: Fix issue in scale

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer [v2]

2024-10-31 Thread Maurizio Cimadamore
On Thu, 31 Oct 2024 07:10:29 GMT, Per Minborg wrote: >> src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java >> line 541: >> >>> 539: >>> 540: @ForceInline >>> 541: private static AbstractMemorySegmentImpl arrayFreeSegment(Buffer >>> b, long offset, long len

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer [v2]

2024-10-31 Thread Per Minborg
On Wed, 30 Oct 2024 18:34:49 GMT, Maurizio Cimadamore wrote: >> Per Minborg has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Update from comments and add benchmark > > src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmen

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer [v2]

2024-10-31 Thread Per Minborg
> This PR proposes to improve `MemorySegment::ofBuffer` making it more amenable > to inlining and generally improving performance. > > Testing successfully on tier1-3 Per Minborg has updated the pull request incrementally with one additional commit since the last revision: Update from commen

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer

2024-10-31 Thread Per Minborg
On Tue, 29 Oct 2024 14:51:33 GMT, Per Minborg wrote: > This PR proposes to improve `MemorySegment::ofBuffer` making it more amenable > to inlining and generally improving performance. > > Testing successfully on tier1-3 I've added a very similar benchmark to the PR which I've run with a Mac M1

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer

2024-10-31 Thread Per Minborg
On Tue, 29 Oct 2024 14:51:33 GMT, Per Minborg wrote: > This PR proposes to improve `MemorySegment::ofBuffer` making it more amenable > to inlining and generally improving performance. > > Testing successfully on tier1-3 It might be possible to move even more logic into the various Buffer impl

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer

2024-10-31 Thread Per Minborg
On Wed, 30 Oct 2024 18:36:37 GMT, Maurizio Cimadamore wrote: >> This PR proposes to improve `MemorySegment::ofBuffer` making it more >> amenable to inlining and generally improving performance. >> >> Testing successfully on tier1-3 > > src/java.base/share/classes/jdk/internal/foreign/AbstractM

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer

2024-10-30 Thread Ioannis Tsakpinis
On Wed, 30 Oct 2024 18:43:45 GMT, Maurizio Cimadamore wrote: >> This PR proposes to improve `MemorySegment::ofBuffer` making it more >> amenable to inlining and generally improving performance. >> >> Testing successfully on tier1-3 > > It would be great if we could find a benchmark where inlin

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer

2024-10-30 Thread Maurizio Cimadamore
On Tue, 29 Oct 2024 14:51:33 GMT, Per Minborg wrote: > This PR proposes to improve `MemorySegment::ofBuffer` making it more amenable > to inlining and generally improving performance. > > Testing successfully on tier1-3 It would be great if we could find a benchmark where inlining doesn't happ

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer

2024-10-30 Thread Jorn Vernee
On Tue, 29 Oct 2024 14:51:33 GMT, Per Minborg wrote: > This PR proposes to improve `MemorySegment::ofBuffer` making it more amenable > to inlining and generally improving performance. > > Testing successfully on tier1-3 src/java.base/share/classes/java/nio/Buffer.java line 33: > 31: import jd

Re: RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer

2024-10-30 Thread Maurizio Cimadamore
On Tue, 29 Oct 2024 14:51:33 GMT, Per Minborg wrote: > This PR proposes to improve `MemorySegment::ofBuffer` making it more amenable > to inlining and generally improving performance. > > Testing successfully on tier1-3 src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl