On Fri, 11 Feb 2022 03:49:45 GMT, Mandy Chung <[email protected]> wrote:

>> This patch removes the restriction in the raw library loading mechanism that 
>> does not allow mix-n-match of loading a library as a JNI library and as a 
>> raw library.
>> 
>> The raw library loading mechanism is designed for panama to load native 
>> library essentially equivalent to dlopen/dlclose calls independent of JNI 
>> library loading. If a native library is loaded as a JNI library and a raw 
>> library, it will get different NativeLibrary instances. When a class loader 
>> is being unloaded, JNI_Unload will be invoked but the native library may not 
>> be unloaded until NativeLibrary::unload is explicitly called for the raw 
>> library.
>
> Mandy Chung has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   review comment

Looks good.
I like the fact that the factory for raw library now takes a MH.lookup instead 
of a class. And I also like that the paths for loading a library in raw mode 
vs. JNI mode are more clearly separated, I think this should help Panama, 
thanks!

One fly-by comment is that there is still residual common logic in how clients 
are expected to load libraries (e.g. either using a file name/absolute path, or 
using a library name, without file separator chars). These assumption seem very 
heavily influenced by how System::load/loadLibrary do things, I believe - and I 
wonder if they can, in the future, create other obstacles for a raw kind of 
library loading (which expects to be mostly a wrapper around 
dlopen/LoadLibrary). But that's a question/problem for another day.

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

Marked as reviewed by mcimadamore (Reviewer).

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

Reply via email to