Re: RFR: 8296024: Usage of DIrectBuffer::address should be guarded [v13]

2022-11-24 Thread Alan Bateman
On Fri, 25 Nov 2022 06:46:52 GMT, ExE Boss wrote: > I believe `UnsupportedOperationException` would be better for this. It would but Per is right that this it is throwing ISE today, it's just that the PR adds an explicit check and that highlights that the wrong exception is thrown. Buffers

Re: RFR: 8296024: Usage of DIrectBuffer::address should be guarded [v13]

2022-11-24 Thread ExE Boss
On Thu, 24 Nov 2022 14:56:07 GMT, Per Minborg wrote: >> src/java.base/share/classes/sun/nio/ch/IOUtil.java line 480: >> >>> 478: static MemorySessionImpl acquireScope(ByteBuffer bb, boolean >>> async) { >>> 479: if (async && NIO_ACCESS.isThreadConfined(bb)) { >>> 480:

Re: RFR: 8296024: Usage of DIrectBuffer::address should be guarded [v13]

2022-11-24 Thread Per Minborg
On Thu, 24 Nov 2022 12:06:44 GMT, Alan Bateman wrote: >> Per Minborg has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Remove redundant method > > src/java.base/share/classes/sun/nio/ch/IOUtil.java line 480: > >> 478: static

Re: RFR: 8296024: Usage of DIrectBuffer::address should be guarded [v13]

2022-11-24 Thread Per Minborg
On Thu, 24 Nov 2022 11:58:12 GMT, Maurizio Cimadamore wrote: >> Separately, also (optional) stylistic: the indenting on this and following >> class is a bit odd. There is a certain tendency to compress lines - e.g. to >> reach for one-liners, when in reality the body is not that trivial. If I

Re: RFR: 8296024: Usage of DIrectBuffer::address should be guarded [v13]

2022-11-24 Thread Alan Bateman
On Thu, 24 Nov 2022 11:42:52 GMT, Per Minborg wrote: >> This PR proposes the introduction of **guarding** of the use of >> `DirectBuffer::address` within the JDK. With the introduction of the Foreign >> Function and Memory access, it is possible to derive Buffer instances that >> are backed

Re: RFR: 8296024: Usage of DIrectBuffer::address should be guarded [v13]

2022-11-24 Thread Maurizio Cimadamore
On Thu, 24 Nov 2022 11:42:52 GMT, Per Minborg wrote: >> This PR proposes the introduction of **guarding** of the use of >> `DirectBuffer::address` within the JDK. With the introduction of the Foreign >> Function and Memory access, it is possible to derive Buffer instances that >> are backed

Re: RFR: 8296024: Usage of DIrectBuffer::address should be guarded [v13]

2022-11-24 Thread Maurizio Cimadamore
On Thu, 24 Nov 2022 11:57:33 GMT, Maurizio Cimadamore wrote: >> src/java.base/share/classes/sun/nio/ch/IOUtil.java line 519: >> >>> 517: } >>> 518: >>> 519: record LinkedRunnable(Runnable node, Runnable next) >> >> Some (optional) style comments: I'm not sure this is a record. E.g.

Re: RFR: 8296024: Usage of DIrectBuffer::address should be guarded [v13]

2022-11-24 Thread Maurizio Cimadamore
On Thu, 24 Nov 2022 11:54:43 GMT, Maurizio Cimadamore wrote: >> Per Minborg has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Remove redundant method > > src/java.base/share/classes/sun/nio/ch/IOUtil.java line 519: > >> 517: } >>

Re: RFR: 8296024: Usage of DIrectBuffer::address should be guarded [v13]

2022-11-24 Thread Maurizio Cimadamore
On Thu, 24 Nov 2022 11:42:52 GMT, Per Minborg wrote: >> This PR proposes the introduction of **guarding** of the use of >> `DirectBuffer::address` within the JDK. With the introduction of the Foreign >> Function and Memory access, it is possible to derive Buffer instances that >> are backed

Re: RFR: 8296024: Usage of DIrectBuffer::address should be guarded [v13]

2022-11-24 Thread Per Minborg
> This PR proposes the introduction of **guarding** of the use of > `DirectBuffer::address` within the JDK. With the introduction of the Foreign > Function and Memory access, it is possible to derive Buffer instances that > are backed by native memory that, in turn, can be closed asynchronously