[foreign-jextract] RFR: 8266682: sync jextract for LibraryLookup removal [v2]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Fri May 7 11:18:06 UTC 2021


On Fri, 7 May 2021 11:03:23 GMT, Athijegannathan Sundararajan <sundar at openjdk.org> wrote:

>> Using System.load/.loadLibrary in generated code and jextract code. Class initialisation dummy method to take sure constants classes initialise header-class before looking up names.
>
> Athijegannathan Sundararajan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   loadLibraries from RuntimeHelper.java

src/jdk.incubator.jextract/share/classes/jdk/internal/jextract/impl/OutputFactory.java line 157:

> 155:     private String generateLoadLibraries() {
> 156:         StringBuilder buf = new StringBuilder();
> 157:         buf.append("RuntimeHelper.loadLibraries(new String[] {");

Instead of calling load libraries, we can just emit calls to System.load/loadLibraries here

src/jdk.incubator.jextract/share/classes/jdk/internal/jextract/impl/resources/RuntimeHelper.java.template line 42:

> 40:     private final static SegmentAllocator THROWING_ALLOCATOR = (x, y) -> { throw new AssertionError("should not reach here"); };
> 41: 
> 42:     static final void loadLibraries(String... libNames) {

We should be able to remove this

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

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


More information about the panama-dev mailing list