305 // Helper class for controlling the lifetime of JavaVMInitArgs objects.
306 class ScopedVMInitArgs;
307
308 // Most logging functions require 5 tags. Some of them may be _NO_TAG.
309 typedef struct {
310 const char* alias_name;
311 LogLevelType level;
312 bool exactMatch;
313 LogTagType tag0;
314 LogTagType tag1;
315 LogTagType tag2;
316 LogTagType tag3;
317 LogTagType tag4;
318 LogTagType tag5;
319 } AliasedLoggingFlag;
320
321 class Arguments : AllStatic {
322 friend class VMStructs;
323 friend class JvmtiExport;
324 friend class CodeCacheExtensions;
325 public:
326 // Operation modi
327 enum Mode {
328 _int, // corresponds to -Xint
329 _mixed, // corresponds to -Xmixed
330 _comp // corresponds to -Xcomp
331 };
332
333 enum ArgsRange {
334 arg_unreadable = -3,
335 arg_too_small = -2,
336 arg_too_big = -1,
337 arg_in_range = 0
338 };
339
340 enum PropertyAppendable {
341 AppendProperty,
342 AddProperty
343 };
344
497 static bool create_numbered_property(const char* prop_base_name, const char* prop_value, unsigned int count);
498
499 static int process_patch_mod_option(const char* patch_mod_tail, bool* patch_mod_javabase);
500
501 // Aggressive optimization flags.
502 static jint set_aggressive_opts_flags();
503
504 static jint set_aggressive_heap_flags();
505
506 // Argument parsing
507 static void do_pd_flag_adjustments();
508 static bool parse_argument(const char* arg, Flag::Flags origin);
509 static bool process_argument(const char* arg, jboolean ignore_unrecognized, Flag::Flags origin);
510 static void process_java_launcher_argument(const char*, void*);
511 static void process_java_compiler_argument(const char* arg);
512 static jint parse_options_environment_variable(const char* name, ScopedVMInitArgs* vm_args);
513 static jint parse_java_tool_options_environment_variable(ScopedVMInitArgs* vm_args);
514 static jint parse_java_options_environment_variable(ScopedVMInitArgs* vm_args);
515 static jint parse_vm_options_file(const char* file_name, ScopedVMInitArgs* vm_args);
516 static jint parse_options_buffer(const char* name, char* buffer, const size_t buf_len, ScopedVMInitArgs* vm_args);
517 static jint insert_vm_options_file(const JavaVMInitArgs* args,
518 const char* vm_options_file,
519 const int vm_options_file_pos,
520 ScopedVMInitArgs* vm_options_file_args,
521 ScopedVMInitArgs* args_out);
522 static bool args_contains_vm_options_file_arg(const JavaVMInitArgs* args);
523 static jint expand_vm_options_as_needed(const JavaVMInitArgs* args_in,
524 ScopedVMInitArgs* mod_args,
525 JavaVMInitArgs** args_out);
526 static jint match_special_option_and_act(const JavaVMInitArgs* args,
527 ScopedVMInitArgs* args_out);
528
529 static bool handle_deprecated_print_gc_flags();
530
531 static void handle_extra_cms_flags(const char* msg);
532
533 static jint parse_vm_init_args(const JavaVMInitArgs *java_tool_options_args,
534 const JavaVMInitArgs *java_options_args,
535 const JavaVMInitArgs *cmd_line_args);
536 static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_mod_javabase, Flag::Flags origin);
537 static jint finalize_vm_init_args();
538 static bool is_bad_option(const JavaVMOption* option, jboolean ignore, const char* option_type);
539
540 static bool is_bad_option(const JavaVMOption* option, jboolean ignore) {
541 return is_bad_option(option, ignore, NULL);
542 }
543
544 static void describe_range_error(ArgsRange errcode);
545 static ArgsRange check_memory_size(julong size, julong min_size);
546 static ArgsRange parse_memory_size(const char* s, julong* long_arg,
547 julong min_size);
548 // Parse a string for a unsigned integer. Returns true if value
549 // is an unsigned integer greater than or equal to the minimum
550 // parameter passed and returns the value in uintx_arg. Returns
551 // false otherwise, with uintx_arg undefined.
552 static bool parse_uintx(const char* value, uintx* uintx_arg,
553 uintx min_size);
554
555 // methods to build strings from individual args
556 static void build_jvm_args(const char* arg);
557 static void build_jvm_flags(const char* arg);
558 static void add_string(char*** bldarray, int* count, const char* arg);
559 static const char* build_resource_string(char** args, int count);
560
561 static bool methodExists(
562 char* className, char* methodName,
563 int classesNum, char** classes, bool* allMethods,
564 int methodsNum, char** methods, bool* allClasses
565 );
566
567 static void parseOnlyLine(
|
305 // Helper class for controlling the lifetime of JavaVMInitArgs objects.
306 class ScopedVMInitArgs;
307
308 // Most logging functions require 5 tags. Some of them may be _NO_TAG.
309 typedef struct {
310 const char* alias_name;
311 LogLevelType level;
312 bool exactMatch;
313 LogTagType tag0;
314 LogTagType tag1;
315 LogTagType tag2;
316 LogTagType tag3;
317 LogTagType tag4;
318 LogTagType tag5;
319 } AliasedLoggingFlag;
320
321 class Arguments : AllStatic {
322 friend class VMStructs;
323 friend class JvmtiExport;
324 friend class CodeCacheExtensions;
325 friend class ArgumentsTest;
326 public:
327 // Operation modi
328 enum Mode {
329 _int, // corresponds to -Xint
330 _mixed, // corresponds to -Xmixed
331 _comp // corresponds to -Xcomp
332 };
333
334 enum ArgsRange {
335 arg_unreadable = -3,
336 arg_too_small = -2,
337 arg_too_big = -1,
338 arg_in_range = 0
339 };
340
341 enum PropertyAppendable {
342 AppendProperty,
343 AddProperty
344 };
345
498 static bool create_numbered_property(const char* prop_base_name, const char* prop_value, unsigned int count);
499
500 static int process_patch_mod_option(const char* patch_mod_tail, bool* patch_mod_javabase);
501
502 // Aggressive optimization flags.
503 static jint set_aggressive_opts_flags();
504
505 static jint set_aggressive_heap_flags();
506
507 // Argument parsing
508 static void do_pd_flag_adjustments();
509 static bool parse_argument(const char* arg, Flag::Flags origin);
510 static bool process_argument(const char* arg, jboolean ignore_unrecognized, Flag::Flags origin);
511 static void process_java_launcher_argument(const char*, void*);
512 static void process_java_compiler_argument(const char* arg);
513 static jint parse_options_environment_variable(const char* name, ScopedVMInitArgs* vm_args);
514 static jint parse_java_tool_options_environment_variable(ScopedVMInitArgs* vm_args);
515 static jint parse_java_options_environment_variable(ScopedVMInitArgs* vm_args);
516 static jint parse_vm_options_file(const char* file_name, ScopedVMInitArgs* vm_args);
517 static jint parse_options_buffer(const char* name, char* buffer, const size_t buf_len, ScopedVMInitArgs* vm_args);
518 static jint parse_xss(const JavaVMOption* option, const char* tail, intx* out_ThreadStackSize);
519 static jint insert_vm_options_file(const JavaVMInitArgs* args,
520 const char* vm_options_file,
521 const int vm_options_file_pos,
522 ScopedVMInitArgs* vm_options_file_args,
523 ScopedVMInitArgs* args_out);
524 static bool args_contains_vm_options_file_arg(const JavaVMInitArgs* args);
525 static jint expand_vm_options_as_needed(const JavaVMInitArgs* args_in,
526 ScopedVMInitArgs* mod_args,
527 JavaVMInitArgs** args_out);
528 static jint match_special_option_and_act(const JavaVMInitArgs* args,
529 ScopedVMInitArgs* args_out);
530
531 static bool handle_deprecated_print_gc_flags();
532
533 static void handle_extra_cms_flags(const char* msg);
534
535 static jint parse_vm_init_args(const JavaVMInitArgs *java_tool_options_args,
536 const JavaVMInitArgs *java_options_args,
537 const JavaVMInitArgs *cmd_line_args);
538 static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_mod_javabase, Flag::Flags origin);
539 static jint finalize_vm_init_args();
540 static bool is_bad_option(const JavaVMOption* option, jboolean ignore, const char* option_type);
541
542 static bool is_bad_option(const JavaVMOption* option, jboolean ignore) {
543 return is_bad_option(option, ignore, NULL);
544 }
545
546 static void describe_range_error(ArgsRange errcode);
547 static ArgsRange check_memory_size(julong size, julong min_size, julong max_size);
548 static ArgsRange parse_memory_size(const char* s, julong* long_arg,
549 julong min_size, julong max_size = max_uintx);
550 // Parse a string for a unsigned integer. Returns true if value
551 // is an unsigned integer greater than or equal to the minimum
552 // parameter passed and returns the value in uintx_arg. Returns
553 // false otherwise, with uintx_arg undefined.
554 static bool parse_uintx(const char* value, uintx* uintx_arg,
555 uintx min_size);
556
557 // methods to build strings from individual args
558 static void build_jvm_args(const char* arg);
559 static void build_jvm_flags(const char* arg);
560 static void add_string(char*** bldarray, int* count, const char* arg);
561 static const char* build_resource_string(char** args, int count);
562
563 static bool methodExists(
564 char* className, char* methodName,
565 int classesNum, char** classes, bool* allMethods,
566 int methodsNum, char** methods, bool* allClasses
567 );
568
569 static void parseOnlyLine(
|