Skip to content

Commit

Permalink
Merge pull request #20755 from babsingh/main12
Browse files Browse the repository at this point in the history
[JDK24] Find and consume --illegal-native-access=<VALUE>
  • Loading branch information
tajila authored Dec 9, 2024
2 parents e1af88f + ee833f2 commit 5231fac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions runtime/oti/jvminit.h
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ enum INIT_STAGE {
#define VMOPT_PATCH_MODULE "--patch-module"
#define VMOPT_ILLEGAL_ACCESS "--illegal-access="
#define VMOPT_ENABLE_NATIVE_ACCESS "--enable-native-access"
#define VMOPT_ILLEGAL_NATIVE_ACCESS "--illegal-native-access="

/* JEP 421: Deprecate Finalization for Removal */
#define VMOPT_DISABLE_FINALIZATION "--finalization="
Expand Down Expand Up @@ -722,6 +723,7 @@ enum INIT_STAGE {
#if JAVA_SPEC_VERSION >= 23
#define SYSPROP_SUN_MISC_UNSAFE_MEMORY_ACCESS "sun.misc.unsafe.memory.access"
#endif /* JAVA_SPEC_VERSION >= 23 */
#define SYSPROP_JDK_MODULE_ILLEGALNATIVEACCESS "jdk.module.illegal.native.access"
#define JAVA_BASE_MODULE "java.base"

#define SYSPROP_COM_SUN_MANAGEMENT "-Dcom.sun.management."
Expand Down
11 changes: 11 additions & 0 deletions runtime/vm/vmprops.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,17 @@ addModularitySystemProperties(J9JavaVM * vm)
}
#endif /* JAVA_SPEC_VERSION >= 17 */

#if JAVA_SPEC_VERSION >= 24
/* Find and consume the last --illegal-native-access option. */
rc = addPropertyForOptionWithEqualsArg(
vm, VMOPT_ILLEGAL_NATIVE_ACCESS,
LITERAL_STRLEN(VMOPT_ILLEGAL_NATIVE_ACCESS),
SYSPROP_JDK_MODULE_ILLEGALNATIVEACCESS);
if (J9SYSPROP_ERROR_NONE != rc) {
goto _end;
}
#endif /* JAVA_SPEC_VERSION >= 24 */

/* Find last --illegal-access */
rc = addPropertyForOptionWithEqualsArg(vm, VMOPT_ILLEGAL_ACCESS, LITERAL_STRLEN(VMOPT_ILLEGAL_ACCESS), SYSPROP_JDK_MODULE_ILLEGALACCESS);

Expand Down

0 comments on commit 5231fac

Please sign in to comment.