< prev index next >

src/hotspot/share/runtime/arguments.hpp

Print this page

 71 
 72   // return false iff OOM && alloc_failmode == AllocFailStrategy::RETURN_NULL
 73   bool set_value(const char *value, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
 74   void append_value(const char *value);
 75 
 76   PathString(const char* value);
 77   ~PathString();
 78 };
 79 
 80 // ModulePatchPath records the module/path pair as specified to --patch-module.
 81 class ModulePatchPath : public CHeapObj<mtInternal> {
 82 private:
 83   char* _module_name;
 84   PathString* _path;
 85 public:
 86   ModulePatchPath(const char* module_name, const char* path);
 87   ~ModulePatchPath();
 88 
 89   inline const char* module_name() const { return _module_name; }
 90   inline char* path_string() const { return _path->value(); }

 91 };
 92 
 93 // Element describing System and User (-Dkey=value flags) defined property.
 94 //
 95 // An internal SystemProperty is one that has been removed in
 96 // jdk.internal.VM.saveAndRemoveProperties, like jdk.boot.class.path.append.
 97 //
 98 class SystemProperty : public PathString {
 99  private:
100   char*           _key;
101   SystemProperty* _next;
102   bool            _internal;
103   bool            _writeable;
104 
105  public:
106   // Accessors
107   char* value() const                 { return PathString::value(); }
108   const char* key() const             { return _key; }
109   bool internal() const               { return _internal; }
110   SystemProperty* next() const        { return _next; }

378   static void set_heap_size();
379 
380   // Bytecode rewriting
381   static void set_bytecode_flags();
382 
383   // Invocation API hooks
384   static abort_hook_t     _abort_hook;
385   static exit_hook_t      _exit_hook;
386   static vfprintf_hook_t  _vfprintf_hook;
387 
388   // System properties
389   static bool add_property(const char* prop, PropertyWriteable writeable=WriteableProperty,
390                            PropertyInternal internal=ExternalProperty);
391 
392   // Used for module system related properties: converted from command-line flags.
393   // Basic properties are writeable as they operate as "last one wins" and will get overwritten.
394   // Numbered properties are never writeable, and always internal.
395   static bool create_module_property(const char* prop_name, const char* prop_value, PropertyInternal internal);
396   static bool create_numbered_module_property(const char* prop_base_name, const char* prop_value, unsigned int count);
397 
398   static int process_patch_mod_option(const char* patch_mod_tail, bool* patch_mod_javabase);
399 
400   // Aggressive optimization flags.
401   static jint set_aggressive_opts_flags();
402 
403   static jint set_aggressive_heap_flags();
404 
405   // Argument parsing
406   static bool parse_argument(const char* arg, JVMFlagOrigin origin);
407   static bool process_argument(const char* arg, jboolean ignore_unrecognized, JVMFlagOrigin origin);
408   static void process_java_launcher_argument(const char*, void*);
409   static void process_java_compiler_argument(const char* arg);
410   static jint parse_options_environment_variable(const char* name, ScopedVMInitArgs* vm_args);
411   static jint parse_java_tool_options_environment_variable(ScopedVMInitArgs* vm_args);
412   static jint parse_java_options_environment_variable(ScopedVMInitArgs* vm_args);
413   static jint parse_vm_options_file(const char* file_name, ScopedVMInitArgs* vm_args);
414   static jint parse_options_buffer(const char* name, char* buffer, const size_t buf_len, ScopedVMInitArgs* vm_args);
415   static jint parse_xss(const JavaVMOption* option, const char* tail, intx* out_ThreadStackSize);
416   static jint insert_vm_options_file(const JavaVMInitArgs* args,
417                                      const char* vm_options_file,
418                                      const int vm_options_file_pos,
419                                      ScopedVMInitArgs* vm_options_file_args,
420                                      ScopedVMInitArgs* args_out);
421   static bool args_contains_vm_options_file_arg(const JavaVMInitArgs* args);
422   static jint expand_vm_options_as_needed(const JavaVMInitArgs* args_in,
423                                           ScopedVMInitArgs* mod_args,
424                                           JavaVMInitArgs** args_out);
425   static jint match_special_option_and_act(const JavaVMInitArgs* args,
426                                            ScopedVMInitArgs* args_out);
427 
428   static bool handle_deprecated_print_gc_flags();
429 
430   static jint parse_vm_init_args(const JavaVMInitArgs *vm_options_args,
431                                  const JavaVMInitArgs *java_tool_options_args,
432                                  const JavaVMInitArgs *java_options_args,
433                                  const JavaVMInitArgs *cmd_line_args);
434   static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_mod_javabase, JVMFlagOrigin origin);
435   static jint finalize_vm_init_args(bool patch_mod_javabase);
436   static bool is_bad_option(const JavaVMOption* option, jboolean ignore, const char* option_type);
437 
438   static bool is_bad_option(const JavaVMOption* option, jboolean ignore) {
439     return is_bad_option(option, ignore, NULL);
440   }
441 
442   static void describe_range_error(ArgsRange errcode);
443   static ArgsRange check_memory_size(julong size, julong min_size, julong max_size);
444   static ArgsRange parse_memory_size(const char* s, julong* long_arg,
445                                      julong min_size, julong max_size = max_uintx);
446 
447   // methods to build strings from individual args
448   static void build_jvm_args(const char* arg);
449   static void build_jvm_flags(const char* arg);
450   static void add_string(char*** bldarray, int* count, const char* arg);
451   static const char* build_resource_string(char** args, int count);
452 
453   // Returns true if the flag is obsolete (and not yet expired).
454   // In this case the 'version' buffer is filled in with
455   // the version number when the flag became obsolete.

583   static void PropertyList_add(SystemProperty** plist, SystemProperty *element);
584   static void PropertyList_add(SystemProperty** plist, const char* k, const char* v, bool writeable, bool internal);
585 
586   static void PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v,
587                                       PropertyAppendable append, PropertyWriteable writeable,
588                                       PropertyInternal internal);
589   static const char* PropertyList_get_value(SystemProperty* plist, const char* key);
590   static const char* PropertyList_get_readable_value(SystemProperty* plist, const char* key);
591   static int  PropertyList_count(SystemProperty* pl);
592   static int  PropertyList_readable_count(SystemProperty* pl);
593 
594   static bool is_internal_module_property(const char* option);
595 
596   // Miscellaneous System property value getter and setters.
597   static void set_dll_dir(const char *value) { _sun_boot_library_path->set_value(value); }
598   static void set_java_home(const char *value) { _java_home->set_value(value); }
599   static void set_library_path(const char *value) { _java_library_path->set_value(value); }
600   static void set_ext_dirs(char *value)     { _ext_dirs = os::strdup_check_oom(value); }
601 
602   // Set up the underlying pieces of the boot class path
603   static void add_patch_mod_prefix(const char *module_name, const char *path, bool* patch_mod_javabase);


604   static void set_boot_class_path(const char *value, bool has_jimage) {
605     // During start up, set by os::set_boot_path()
606     assert(get_boot_class_path() == NULL, "Boot class path previously set");
607     _boot_class_path->set_value(value);
608     _has_jimage = has_jimage;
609   }
610   static void append_sysclasspath(const char *value) {
611     _boot_class_path->append_value(value);
612     _jdk_boot_class_path_append->append_value(value);
613   }
614 
615   static GrowableArray<ModulePatchPath*>* get_patch_mod_prefix() { return _patch_mod_prefix; }
616   static char* get_boot_class_path() { return _boot_class_path->value(); }
617   static bool has_jimage() { return _has_jimage; }
618 
619   static char* get_java_home()    { return _java_home->value(); }
620   static char* get_dll_dir()      { return _sun_boot_library_path->value(); }
621   static char* get_appclasspath() { return _java_class_path->value(); }
622   static void  fix_appclasspath();
623 

 71 
 72   // return false iff OOM && alloc_failmode == AllocFailStrategy::RETURN_NULL
 73   bool set_value(const char *value, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
 74   void append_value(const char *value);
 75 
 76   PathString(const char* value);
 77   ~PathString();
 78 };
 79 
 80 // ModulePatchPath records the module/path pair as specified to --patch-module.
 81 class ModulePatchPath : public CHeapObj<mtInternal> {
 82 private:
 83   char* _module_name;
 84   PathString* _path;
 85 public:
 86   ModulePatchPath(const char* module_name, const char* path);
 87   ~ModulePatchPath();
 88 
 89   inline const char* module_name() const { return _module_name; }
 90   inline char* path_string() const { return _path->value(); }
 91   inline void append_path(const char* path) { _path->append_value(path); }
 92 };
 93 
 94 // Element describing System and User (-Dkey=value flags) defined property.
 95 //
 96 // An internal SystemProperty is one that has been removed in
 97 // jdk.internal.VM.saveAndRemoveProperties, like jdk.boot.class.path.append.
 98 //
 99 class SystemProperty : public PathString {
100  private:
101   char*           _key;
102   SystemProperty* _next;
103   bool            _internal;
104   bool            _writeable;
105 
106  public:
107   // Accessors
108   char* value() const                 { return PathString::value(); }
109   const char* key() const             { return _key; }
110   bool internal() const               { return _internal; }
111   SystemProperty* next() const        { return _next; }

379   static void set_heap_size();
380 
381   // Bytecode rewriting
382   static void set_bytecode_flags();
383 
384   // Invocation API hooks
385   static abort_hook_t     _abort_hook;
386   static exit_hook_t      _exit_hook;
387   static vfprintf_hook_t  _vfprintf_hook;
388 
389   // System properties
390   static bool add_property(const char* prop, PropertyWriteable writeable=WriteableProperty,
391                            PropertyInternal internal=ExternalProperty);
392 
393   // Used for module system related properties: converted from command-line flags.
394   // Basic properties are writeable as they operate as "last one wins" and will get overwritten.
395   // Numbered properties are never writeable, and always internal.
396   static bool create_module_property(const char* prop_name, const char* prop_value, PropertyInternal internal);
397   static bool create_numbered_module_property(const char* prop_base_name, const char* prop_value, unsigned int count);
398 
399   static int process_patch_mod_option(const char* patch_mod_tail);
400 
401   // Aggressive optimization flags.
402   static jint set_aggressive_opts_flags();
403 
404   static jint set_aggressive_heap_flags();
405 
406   // Argument parsing
407   static bool parse_argument(const char* arg, JVMFlagOrigin origin);
408   static bool process_argument(const char* arg, jboolean ignore_unrecognized, JVMFlagOrigin origin);
409   static void process_java_launcher_argument(const char*, void*);
410   static void process_java_compiler_argument(const char* arg);
411   static jint parse_options_environment_variable(const char* name, ScopedVMInitArgs* vm_args);
412   static jint parse_java_tool_options_environment_variable(ScopedVMInitArgs* vm_args);
413   static jint parse_java_options_environment_variable(ScopedVMInitArgs* vm_args);
414   static jint parse_vm_options_file(const char* file_name, ScopedVMInitArgs* vm_args);
415   static jint parse_options_buffer(const char* name, char* buffer, const size_t buf_len, ScopedVMInitArgs* vm_args);
416   static jint parse_xss(const JavaVMOption* option, const char* tail, intx* out_ThreadStackSize);
417   static jint insert_vm_options_file(const JavaVMInitArgs* args,
418                                      const char* vm_options_file,
419                                      const int vm_options_file_pos,
420                                      ScopedVMInitArgs* vm_options_file_args,
421                                      ScopedVMInitArgs* args_out);
422   static bool args_contains_vm_options_file_arg(const JavaVMInitArgs* args);
423   static jint expand_vm_options_as_needed(const JavaVMInitArgs* args_in,
424                                           ScopedVMInitArgs* mod_args,
425                                           JavaVMInitArgs** args_out);
426   static jint match_special_option_and_act(const JavaVMInitArgs* args,
427                                            ScopedVMInitArgs* args_out);
428 
429   static bool handle_deprecated_print_gc_flags();
430 
431   static jint parse_vm_init_args(const JavaVMInitArgs *vm_options_args,
432                                  const JavaVMInitArgs *java_tool_options_args,
433                                  const JavaVMInitArgs *java_options_args,
434                                  const JavaVMInitArgs *cmd_line_args);
435   static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, JVMFlagOrigin origin);
436   static jint finalize_vm_init_args();
437   static bool is_bad_option(const JavaVMOption* option, jboolean ignore, const char* option_type);
438 
439   static bool is_bad_option(const JavaVMOption* option, jboolean ignore) {
440     return is_bad_option(option, ignore, NULL);
441   }
442 
443   static void describe_range_error(ArgsRange errcode);
444   static ArgsRange check_memory_size(julong size, julong min_size, julong max_size);
445   static ArgsRange parse_memory_size(const char* s, julong* long_arg,
446                                      julong min_size, julong max_size = max_uintx);
447 
448   // methods to build strings from individual args
449   static void build_jvm_args(const char* arg);
450   static void build_jvm_flags(const char* arg);
451   static void add_string(char*** bldarray, int* count, const char* arg);
452   static const char* build_resource_string(char** args, int count);
453 
454   // Returns true if the flag is obsolete (and not yet expired).
455   // In this case the 'version' buffer is filled in with
456   // the version number when the flag became obsolete.

584   static void PropertyList_add(SystemProperty** plist, SystemProperty *element);
585   static void PropertyList_add(SystemProperty** plist, const char* k, const char* v, bool writeable, bool internal);
586 
587   static void PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v,
588                                       PropertyAppendable append, PropertyWriteable writeable,
589                                       PropertyInternal internal);
590   static const char* PropertyList_get_value(SystemProperty* plist, const char* key);
591   static const char* PropertyList_get_readable_value(SystemProperty* plist, const char* key);
592   static int  PropertyList_count(SystemProperty* pl);
593   static int  PropertyList_readable_count(SystemProperty* pl);
594 
595   static bool is_internal_module_property(const char* option);
596 
597   // Miscellaneous System property value getter and setters.
598   static void set_dll_dir(const char *value) { _sun_boot_library_path->set_value(value); }
599   static void set_java_home(const char *value) { _java_home->set_value(value); }
600   static void set_library_path(const char *value) { _java_library_path->set_value(value); }
601   static void set_ext_dirs(char *value)     { _ext_dirs = os::strdup_check_oom(value); }
602 
603   // Set up the underlying pieces of the boot class path
604   static void add_patch_mod_prefix(const char *module_name, const char *path, bool allow_append);
605   static bool patch_mod_javabase();
606   static int finalize_patch_module();
607   static void set_boot_class_path(const char *value, bool has_jimage) {
608     // During start up, set by os::set_boot_path()
609     assert(get_boot_class_path() == NULL, "Boot class path previously set");
610     _boot_class_path->set_value(value);
611     _has_jimage = has_jimage;
612   }
613   static void append_sysclasspath(const char *value) {
614     _boot_class_path->append_value(value);
615     _jdk_boot_class_path_append->append_value(value);
616   }
617 
618   static GrowableArray<ModulePatchPath*>* get_patch_mod_prefix() { return _patch_mod_prefix; }
619   static char* get_boot_class_path() { return _boot_class_path->value(); }
620   static bool has_jimage() { return _has_jimage; }
621 
622   static char* get_java_home()    { return _java_home->value(); }
623   static char* get_dll_dir()      { return _sun_boot_library_path->value(); }
624   static char* get_appclasspath() { return _java_class_path->value(); }
625   static void  fix_appclasspath();
626 
< prev index next >