RFR: 8282191: Implementation of Foreign Function & Memory API (Preview) [v39]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Fri May 6 08:44:18 UTC 2022


On Thu, 5 May 2022 21:28:32 GMT, Mandy Chung <mchung at openjdk.org> wrote:

>> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   * Clarify what happens when SymbolLookup::loaderLookup is invoked from JNI
>>   * Tweak restricted method check to work when there's no caller class
>
> src/java.base/share/classes/java/lang/foreign/SymbolLookup.java line 161:
> 
>> 159:                 ClassLoader.getSystemClassLoader();
>> 160:         MemorySession loaderSession = (loader == null) ?
>> 161:                 MemorySession.global() : // boot loader never goes away
> 
> The other built-in class loaders (`ClassLoaders::appClassLoader` and `ClassLoaders::platformClassLoader` are both instance of `BuiltinClassLoader`) will never be unloaded.   Should they use the globel memory session?

good idea

> src/java.base/share/classes/jdk/internal/reflect/Reflection.java line 120:
> 
>> 118:         // if there is no caller class, act as if the call came from an unnamed module
>> 119:         Module module = currentClass != null ?
>> 120:                 currentClass.getModule() : Holder.FALLBACK_MODULE;
> 
> This can be simplified to:
> 
> Module module = currentClass != null ?
>                currentClass.getModule() : ClassLoader::getSystemClassLoader().getUnnamedModule();
> 
> 
> No need to have the Holder class.

gah! I missed that :-)

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

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



More information about the build-dev mailing list