On Wed, 22 Jan 2025 10:40:07 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
>> Matthias Ernst has updated the pull request incrementally with one >> additional commit since the last revision: >> >> --unnecessary annotations > > src/java.base/share/classes/jdk/internal/foreign/abi/BufferStack.java line 17: > >> 15: >> 16: public Arena reserve(long size) { >> 17: if (!lock.tryLock()) { > > I believe we only need to lock if `reserve` is called from a virtual thread. > So there's more cases where the locking can be avoided :-) Done. Also can avoid the recursion (although that's probably cheap under RL, let me double-check). > src/java.base/share/classes/jdk/internal/foreign/abi/BufferStack.java line 52: > >> 50: scope.close(); >> 51: offset = parentOffset; >> 52: lock.unlock(); > > I believe you could have mismatched lock/unlock in some cases Which scenario? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23142#discussion_r1925238375 PR Review Comment: https://git.openjdk.org/jdk/pull/23142#discussion_r1925236864