Stack allocation API
Radosław Smogura
mail at smogura.eu
Wed Feb 16 23:33:32 UTC 2022
Hi,
My understanding is that scope local is like parameter you can pass to function (but it’s passed like a global reference), and enforces closure (Autoclosable can’t enforce value to be put in try-with-resources, so stack can be incorrect if exceptions are not properly handled).
However I think that everyone (or at least me) think about something like this:
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/stackalloc
Kind regards,
Rado
On Feb 16, 2022, at 10:40 PM, Remi Forax <forax at univ-mlv.fr> wrote:
----- Original Message -----
From: "Ioannis Tsakpinis" <iotsakp at gmail.com>
To: "Maurizio Cimadamore" <maurizio.cimadamore at oracle.com>
Cc: "Felix Cravic" <themode at outlook.fr>, "panama-dev at openjdk.java.net'" <panama-dev at openjdk.java.net>
Sent: Wednesday, February 16, 2022 9:56:43 PM
Subject: Re: Stack allocation API
...
An issue with LWJGL's approach is the thread-local access to grab the
current thread's MemoryStack. The thread-local lookup itself is not
terribly expensive (but not free either), however it does become a problem
in hot code. Hotspot cannot hoist it out of loops and this has unfortunate
consequences for the surrounding code.
I wonder how the ScopeLocal of loom behave compared to ThreadLocal.
https://download.java.net/java/early_access/loom/docs/api/jdk.incubator.concurrent/jdk/incubator/concurrent/ScopeLocal.html
- Ioannis
Rémi
More information about the panama-dev
mailing list