RFR: 8282191: Implementation of Foreign Function & Memory API (Preview) [v39]
Mandy Chung
mchung at openjdk.java.net
Thu May 5 21:34:54 UTC 2022
On Thu, 5 May 2022 20:54:53 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> This PR contains the API and implementation changes for JEP-424 [1]. A more detailed description of such changes, to avoid repetitions during the review process, is included as a separate comment.
>>
>> [1] - https://openjdk.java.net/jeps/424
>
> 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?
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.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7888
More information about the shenandoah-dev
mailing list