[foreign-jextract] RFR: 8253307: Simplify code in RuntimeHelper::lookupGlobalVariable

Maurizio Cimadamore mcimadamore at openjdk.java.net
Fri Sep 18 10:02:18 UTC 2020


On Fri, 18 Sep 2020 09:52:22 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> > While this solves the issue for for jextract which keeps LinkerLookups, as a general API usage, this should be
> > documented then i.e, it is up to the user to keep linker lookup objects alive In the JNI world this problem does not
> > arise because NativeLibrary is always loaded in the context of the class loader that loaded and so native libraries are
> > alive as long as the class loader is alive.
> 
> We do have some javadoc covering that already.
> 
> Not super sure about JNI - will creating a BB from JNI code (from a random point) keep the library alive? How?

To be more explicit about the case I have in mind for JNI:

1.  start classloader
2.  load library
3.  obtain BB from pointer in library
4.  share the BB with some other class loader
5.  drop the original classloader (and the library)
6. problem?

-------------

PR: https://git.openjdk.java.net/panama-foreign/pull/339


More information about the panama-dev mailing list