[foreign-memaccess+abi] RFR: 8263459: Add better support for restricted methods [v3]
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Mon Mar 22 11:31:48 UTC 2021
On Mon, 22 Mar 2021 09:58:17 GMT, Athijegannathan Sundararajan <sundar at openjdk.org> wrote:
>> --enable-native-access command line option
>
> Athijegannathan Sundararajan has updated the pull request incrementally with one additional commit since the last revision:
>
> based on code review:
> Modules::enable_native_access_all_unnamed does not need TRAPS.
> check_restricted_method call in LinkResolver should be outside loader constraints check.
I've suggested a bunch of renamings. I probably missed some, but in general let's make sure that we use "nativeAccess" everywhere and that the "restricted" word is never present in the implementation (but we'll keep that in API method names, for now).
make/jdk/src/classes/build/tools/panama/RestrictedMethodsFinder.java line 57:
> 55: import static java.nio.file.StandardOpenOption.*;
> 56:
> 57: public class RestrictedMethodsFinder implements Plugin {
Rename to "NativeAccessMethodFinder" (and fix up naming of associated build parameters)
src/hotspot/share/interpreter/linkResolver.cpp line 827:
> 825: check_method_loader_constraints(link_info, resolved_method, "method", CHECK_NULL);
> 826: }
> 827: check_restricted_method(link_info, resolved_method, CHECK_NULL);
Can we please rename this as "check_native_access" to make terminology consistent
src/java.base/share/classes/java/lang/reflect/Method.java line 506:
> 504: }
> 505:
> 506: private final void checkRestrictedNative(Class<?> caller) throws IllegalAccessException {
isNativeAccess/checkNativeAccess
src/java.base/share/classes/jdk/internal/module/ClassFileConstants.java line 45:
> 43: public static final String MODULE_HASHES = "ModuleHashes";
> 44: public static final String MODULE_RESOLUTION = "ModuleResolution";
> 45: public static final String MODULE_RESTRICTED_NATIVE = "ModuleRestrictedNative";
Rename to ModuleNativeAccess/MODULE_NATIVE_ACCESS
src/java.base/share/classes/jdk/internal/module/ModuleReferenceImpl.java line 140:
> 138:
> 139: public boolean usesRestrictedNative() {
> 140: return usesRestrictedNative;
rename to `nativeAccessEnabled`, or `usesNativeAccess`
src/java.base/share/classes/jdk/internal/module/SystemModules.java line 102:
> 100: * Returns the restricted native flags for modules
> 101: */
> 102: boolean[] restrictedNativeModules();
rename to `nativeAccessModules`
src/java.base/share/classes/jdk/internal/vm/annotation/RestrictedNative.java line 38:
> 36: @Target(ElementType.METHOD)
> 37: @Retention(RetentionPolicy.RUNTIME)
> 38: public @interface RestrictedNative {
Rename to @NativeAccess
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/RestrictedNativeMarkerPlugin.java line 61:
> 59: * Jlink plugin makes modules that use RestrictedNative methods.
> 60: */
> 61: public final class RestrictedNativeMarkerPlugin extends AbstractPlugin {
Rename to NativeAccessMarkerPlugin (and fixup related build variables)
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/471
More information about the panama-dev
mailing list