On Fri, 10 Jan 2025 09:41:34 GMT, Alan Bateman <al...@openjdk.org> wrote:
>> Per Minborg has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - Clean up benchmark >> - Fix allocation problem in benchmark > > src/java.base/share/classes/jdk/internal/foreign/CaptureStateUtil.java line > 50: > >> 48: private static final long SIZE = >> Linker.Option.captureStateLayout().byteSize(); >> 49: >> 50: private static final TerminatingThreadLocal<MemorySegment> TL = new >> TerminatingThreadLocal<>() { > > TerminatingThreadLocal is carrier-local so the usage here will require a > detailed walk through to make sure that a virtual thread cannot be preempted > when it has access to this memory segment. Identifying preemption is hard and > will often during startup/first-use. So while tempting to use > TerminatingThreadLocal here, I think we will have to do more work on it > before it can more widely used in java.base. Right. So, I have added this issue: https://bugs.openjdk.org/browse/JDK-8347537 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/22391#discussion_r1912954825