Review Request JDK-8164512: Replace ClassLoader use of finalizer with phantom reference to unload native library

mandy chung mandy.chung at
Tue Oct 10 21:31:55 UTC 2017

On 10/10/17 2:28 PM, Peter Levart wrote:
> Hi Mandy,
> On 10/10/17 17:00, mandy chung wrote:
>>> Now that (system)nativeLibraries is a Map, is it still necessary to 
>>> iterate it and call lib.findEntry(name) on each NativeLibrary until 
>>> the one that returns a non-zero entry or would it be semantically 
>>> equivalent to 1st look-up the Map by the 'name' key to get the 
>>> correct NativeLibrary?
>> The name parameter is the symbol name but not the library name. It's 
>> confusing and therefore I renamed NativeLibrary::find to 
>> NativeLibrary::findEntry.   I could rename the name parameter to 
>> entryName to make it clearer.
>> Mandy
> Oh, I see. I haven't checked the findNative VM call-back method 
> purpose before. It's reasonable to try all the native libraries of a 
> ClassLoader when looking for a symbol that links to native method 
> implementation. Constructing and keeping an index of symbols for each 
> native library on the Java side is probably not worth since there 
> might be lots of them in libraries and only some of them link to 
> native method implementations and there's typically not many native 
> libraries loaded.


More information about the core-libs-dev mailing list