mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
6788376: allow to ignore unrecognized VM options
Add new product flag -XX:+IgnoreUnrecognizedVMOptions Reviewed-by: ysr, xlu
This commit is contained in:
parent
67f20d82c9
commit
72b75d1adf
3 changed files with 25 additions and 5 deletions
|
@ -2478,7 +2478,7 @@ jint Arguments::parse_options_environment_variable(const char* name, SysClassPat
|
||||||
vm_args.version = JNI_VERSION_1_2;
|
vm_args.version = JNI_VERSION_1_2;
|
||||||
vm_args.options = options;
|
vm_args.options = options;
|
||||||
vm_args.nOptions = i;
|
vm_args.nOptions = i;
|
||||||
vm_args.ignoreUnrecognized = false;
|
vm_args.ignoreUnrecognized = IgnoreUnrecognizedVMOptions;
|
||||||
|
|
||||||
if (PrintVMOptions) {
|
if (PrintVMOptions) {
|
||||||
const char* tail;
|
const char* tail;
|
||||||
|
@ -2525,13 +2525,12 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
|
||||||
|
|
||||||
// If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.
|
// If flag "-XX:Flags=flags-file" is used it will be the first option to be processed.
|
||||||
bool settings_file_specified = false;
|
bool settings_file_specified = false;
|
||||||
|
const char* flags_file;
|
||||||
int index;
|
int index;
|
||||||
for (index = 0; index < args->nOptions; index++) {
|
for (index = 0; index < args->nOptions; index++) {
|
||||||
const JavaVMOption *option = args->options + index;
|
const JavaVMOption *option = args->options + index;
|
||||||
if (match_option(option, "-XX:Flags=", &tail)) {
|
if (match_option(option, "-XX:Flags=", &tail)) {
|
||||||
if (!process_settings_file(tail, true, args->ignoreUnrecognized)) {
|
flags_file = tail;
|
||||||
return JNI_EINVAL;
|
|
||||||
}
|
|
||||||
settings_file_specified = true;
|
settings_file_specified = true;
|
||||||
}
|
}
|
||||||
if (match_option(option, "-XX:+PrintVMOptions", &tail)) {
|
if (match_option(option, "-XX:+PrintVMOptions", &tail)) {
|
||||||
|
@ -2540,6 +2539,24 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
|
||||||
if (match_option(option, "-XX:-PrintVMOptions", &tail)) {
|
if (match_option(option, "-XX:-PrintVMOptions", &tail)) {
|
||||||
PrintVMOptions = false;
|
PrintVMOptions = false;
|
||||||
}
|
}
|
||||||
|
if (match_option(option, "-XX:+IgnoreUnrecognizedVMOptions", &tail)) {
|
||||||
|
IgnoreUnrecognizedVMOptions = true;
|
||||||
|
}
|
||||||
|
if (match_option(option, "-XX:-IgnoreUnrecognizedVMOptions", &tail)) {
|
||||||
|
IgnoreUnrecognizedVMOptions = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IgnoreUnrecognizedVMOptions) {
|
||||||
|
// uncast const to modify the flag args->ignoreUnrecognized
|
||||||
|
*(jboolean*)(&args->ignoreUnrecognized) = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse specified settings file
|
||||||
|
if (settings_file_specified) {
|
||||||
|
if (!process_settings_file(flags_file, true, args->ignoreUnrecognized)) {
|
||||||
|
return JNI_EINVAL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse default .hotspotrc settings file
|
// Parse default .hotspotrc settings file
|
||||||
|
|
|
@ -2167,6 +2167,9 @@ class CommandLineFlags {
|
||||||
product(bool, PrintVMOptions, trueInDebug, \
|
product(bool, PrintVMOptions, trueInDebug, \
|
||||||
"print VM flag settings") \
|
"print VM flag settings") \
|
||||||
\
|
\
|
||||||
|
product(bool, IgnoreUnrecognizedVMOptions, false, \
|
||||||
|
"Ignore unrecognized VM options") \
|
||||||
|
\
|
||||||
diagnostic(bool, SerializeVMOutput, true, \
|
diagnostic(bool, SerializeVMOutput, true, \
|
||||||
"Use a mutex to serialize output to tty and hotspot.log") \
|
"Use a mutex to serialize output to tty and hotspot.log") \
|
||||||
\
|
\
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
* @bug 6775880
|
* @bug 6775880
|
||||||
* @summary EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
|
* @summary EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now")
|
||||||
* @compile -source 1.4 -target 1.4 Test.java
|
* @compile -source 1.4 -target 1.4 Test.java
|
||||||
* @run main/othervm -server -Xbatch -XX:+DoEscapeAnalysis -XX:+DeoptimizeALot -XX:CompileCommand=exclude,java.lang.AbstractStringBuilder::append Test
|
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:+DoEscapeAnalysis -XX:+DeoptimizeALot -XX:CompileCommand=exclude,java.lang.AbstractStringBuilder::append Test
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Test {
|
public class Test {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue