On Wed, 2 Jun 2021 17:19:06 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> 
wrote:

> This patch overhauls the library loading mechanism used by the Foreign Linker 
> API. We realized that, while handy, the *default* lookup abstraction 
> (`LibraryLookup::ofDefault`) was behaving inconsistentlt across platforms.
> 
> This patch replaces `LibraryLookup` with a simpler `SymbolLookup` 
> abstraction, a functional interface. Crucially, `SymbolLookup` does not 
> concern with library loading, only symbol lookup. For this reason, two 
> factories are added:
> 
> * `SymbolLookup::loaderLookup` - which obtains a lookup that can be used to 
> lookup symbols in libraries loaded by current loader
> * `CLinker::systemLookup` - a more stable replacement for the *default* 
> lookup, which looks for symbols in libc.so (or its equivalent in other 
> platforms). The contents of this lookup are unspecified.
> 
> Both factories are *restricted*, so they can only be called when 
> `--enable-native-access` is set.

LGTM, minor nit inline

test/micro/org/openjdk/bench/jdk/incubator/foreign/points/support/PanamaPoint.java
 line 62:

> 60:         );
> 61:         MH_distance_ptrs = abi.downcallHandle(
> 62:                 lookup.lookup("distance_ptrs").get(),

Spurious white space
Suggestion:

            lookup.lookup("distance_ptrs").get(),

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

Marked as reviewed by jvernee (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/4316

Reply via email to