8157986: Runtime support for javac to determine arguments to the runtime environment
Reviewed-by: alanb
--- a/jdk/make/mapfiles/libjava/mapfile-vers Fri May 27 12:34:08 2016 -0300
+++ b/jdk/make/mapfiles/libjava/mapfile-vers Fri May 27 08:52:22 2016 -0700
@@ -267,6 +267,7 @@
Java_jdk_internal_misc_VM_geteuid;
Java_jdk_internal_misc_VM_getgid;
Java_jdk_internal_misc_VM_getegid;
+ Java_jdk_internal_misc_VM_getRuntimeArguments;
Java_jdk_internal_misc_VM_initialize;
Java_java_lang_reflect_Module_defineModule0;
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/VM.java Fri May 27 12:34:08 2016 -0300
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/VM.java Fri May 27 08:52:22 2016 -0700
@@ -475,6 +475,23 @@
*/
public static native long getNanoTimeAdjustment(long offsetInSeconds);
+ /**
+ * Returns the VM arguments for this runtime environment.
+ *
+ * @implNote
+ * The HotSpot JVM processes the input arguments from multiple sources
+ * in the following order:
+ * 1. JAVA_TOOL_OPTIONS environment variable
+ * 2. Options from JNI Invocation API
+ * 3. _JAVA_OPTIONS environment variable
+ *
+ * If VM options file is specified via -XX:VMOptionsFile, the vm options
+ * file is read and expanded in place of -XX:VMOptionFile option.
+ *
+ * Open issue with -XX:Flags (see JDK-8157979)
+ */
+ public static native String[] getRuntimeArguments();
+
static {
initialize();
}
--- a/jdk/src/java.base/share/classes/module-info.java Fri May 27 12:34:08 2016 -0300
+++ b/jdk/src/java.base/share/classes/module-info.java Fri May 27 08:52:22 2016 -0700
@@ -165,6 +165,7 @@
java.sql,
java.xml,
jdk.charsets,
+ jdk.compiler,
jdk.jartool,
jdk.jlink,
jdk.net,
--- a/jdk/src/java.base/share/native/libjava/VM.c Fri May 27 12:34:08 2016 -0300
+++ b/jdk/src/java.base/share/native/libjava/VM.c Fri May 27 08:52:22 2016 -0700
@@ -55,3 +55,8 @@
(*env)->RegisterNatives(env, cls,
methods, sizeof(methods)/sizeof(methods[0]));
}
+
+JNIEXPORT jobjectArray JNICALL
+Java_jdk_internal_misc_VM_getRuntimeArguments(JNIEnv *env, jclass cls) {
+ return JVM_GetVmArguments(env);
+}