Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC [GR-57608] Support --enable-native-access hosted option in native image #10076

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

graalvmbot
Copy link
Collaborator

This adds support for the --enable-native-access hosted option in the context of JEP 472: Prepare to Restrict the Use of JNI. The modules specified by this flags will be allowed to perform native access at run time. Note that similar to Hotspot, this flag only applied to the boot layer.

This change aligns the native access checks in native image to those in the JDK as outline in JEP 472.

Implementation Notes

To allow constant folding of native access checks at build time, the following optimizations are needed:

  • Annotate DynamicHub#module with @Stable. This now matches the Class@module definition.
  • Ensure that Module.EnableNativeAccess#isNativeAccessEnabled constant folds if Module#enableNativeAccess field is true. This "reimplements" the @Stable field optimization for Module#enablenativeAccess, which does not trigger because the field is only accessed via Unsafe.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Nov 12, 2024
@zapster zapster self-assigned this Nov 12, 2024
@graalvmbot graalvmbot force-pushed the je/svm-adopt-JDK-8331671-master branch from ca2f646 to 3ba340f Compare November 12, 2024 15:03
No need to allow native access to the application modules in the driver.
They will not be loaded on the boot module layer, so specifying them
there has no effect anyways.
@graalvmbot graalvmbot force-pushed the je/svm-adopt-JDK-8331671-master branch 3 times, most recently from 67fa1ad to 830a611 Compare November 13, 2024 11:02
@graalvmbot graalvmbot force-pushed the je/svm-adopt-JDK-8331671-master branch from 830a611 to ed86994 Compare November 13, 2024 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants