[foreign-jextract] RFR: 8249949: jextract libclang Cursor children iteration creates a new up call stub every time
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Thu Jul 23 09:37:26 UTC 2020
On Thu, 23 Jul 2020 09:24:45 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> Avoiding repeated upcall stub creation by caching. The array list updated is updated in a synchroinzed method.
>
> src/jdk.incubator.jextract/share/classes/jdk/internal/clang/Cursor.java line 338:
>
>> 337:
>> 338: private static class CursorChildren {
>> 339: private static final ArrayList<Cursor> children = new ArrayList<>();
>
> Wrapping the logic in a class is a good idea, but I think we can go further and avoid reusing the same static. E.g. we
> could make the list an _instance_ field, and then the static `get` method would create a new instance of
> `CursorChildren` (to do the visit) and then return the list attached to that instance.
My bad - this is not really possible - we want a _shared_ address, so it has to live in a static field - and so we
can't refer to instance stuff.
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/261
More information about the panama-dev
mailing list