74 void append_value(const char *value);
75
76 PathString(const char* value);
77 ~PathString();
78
79 // for JVM_ReadSystemPropertiesInfo
80 static int value_offset_in_bytes() { return (int)offset_of(PathString, _value); }
81 };
82
83 // ModulePatchPath records the module/path pair as specified to --patch-module.
84 class ModulePatchPath : public CHeapObj<mtInternal> {
85 private:
86 char* _module_name;
87 PathString* _path;
88 public:
89 ModulePatchPath(const char* module_name, const char* path);
90 ~ModulePatchPath();
91
92 inline const char* module_name() const { return _module_name; }
93 inline char* path_string() const { return _path->value(); }
94 };
95
96 // Element describing System and User (-Dkey=value flags) defined property.
97 //
98 // An internal SystemProperty is one that has been removed in
99 // jdk.internal.VM.saveAndRemoveProperties, like jdk.boot.class.path.append.
100 //
101 class SystemProperty : public PathString {
102 private:
103 char* _key;
104 SystemProperty* _next;
105 bool _internal;
106 bool _writeable;
107
108 public:
109 // Accessors
110 char* value() const { return PathString::value(); }
111 const char* key() const { return _key; }
112 bool internal() const { return _internal; }
113 SystemProperty* next() const { return _next; }
273 static void set_heap_size();
274
275 // Bytecode rewriting
276 static void set_bytecode_flags();
277
278 // Invocation API hooks
279 static abort_hook_t _abort_hook;
280 static exit_hook_t _exit_hook;
281 static vfprintf_hook_t _vfprintf_hook;
282
283 // System properties
284 static bool add_property(const char* prop, PropertyWriteable writeable=WriteableProperty,
285 PropertyInternal internal=ExternalProperty);
286
287 // Used for module system related properties: converted from command-line flags.
288 // Basic properties are writeable as they operate as "last one wins" and will get overwritten.
289 // Numbered properties are never writeable, and always internal.
290 static bool create_module_property(const char* prop_name, const char* prop_value, PropertyInternal internal);
291 static bool create_numbered_module_property(const char* prop_base_name, const char* prop_value, unsigned int count);
292
293 static int process_patch_mod_option(const char* patch_mod_tail, bool* patch_mod_javabase);
294
295 // Aggressive optimization flags.
296 static jint set_aggressive_opts_flags();
297
298 static jint set_aggressive_heap_flags();
299
300 // Argument parsing
301 static bool parse_argument(const char* arg, JVMFlagOrigin origin);
302 static bool process_argument(const char* arg, jboolean ignore_unrecognized, JVMFlagOrigin origin);
303 static void process_java_launcher_argument(const char*, void*);
304 static jint parse_options_environment_variable(const char* name, ScopedVMInitArgs* vm_args);
305 static jint parse_java_tool_options_environment_variable(ScopedVMInitArgs* vm_args);
306 static jint parse_java_options_environment_variable(ScopedVMInitArgs* vm_args);
307 static jint parse_vm_options_file(const char* file_name, ScopedVMInitArgs* vm_args);
308 static jint parse_options_buffer(const char* name, char* buffer, const size_t buf_len, ScopedVMInitArgs* vm_args);
309 static jint parse_xss(const JavaVMOption* option, const char* tail, intx* out_ThreadStackSize);
310 static jint insert_vm_options_file(const JavaVMInitArgs* args,
311 const char* vm_options_file,
312 const int vm_options_file_pos,
313 ScopedVMInitArgs* vm_options_file_args,
314 ScopedVMInitArgs* args_out);
315 static bool args_contains_vm_options_file_arg(const JavaVMInitArgs* args);
316 static jint expand_vm_options_as_needed(const JavaVMInitArgs* args_in,
317 ScopedVMInitArgs* mod_args,
318 JavaVMInitArgs** args_out);
319 static jint match_special_option_and_act(const JavaVMInitArgs* args,
320 ScopedVMInitArgs* args_out);
321
322 static bool handle_deprecated_print_gc_flags();
323
324 static jint parse_vm_init_args(const JavaVMInitArgs *vm_options_args,
325 const JavaVMInitArgs *java_tool_options_args,
326 const JavaVMInitArgs *java_options_args,
327 const JavaVMInitArgs *cmd_line_args);
328 static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_mod_javabase, JVMFlagOrigin origin);
329 static jint finalize_vm_init_args(bool patch_mod_javabase);
330 static bool is_bad_option(const JavaVMOption* option, jboolean ignore, const char* option_type);
331
332 static bool is_bad_option(const JavaVMOption* option, jboolean ignore) {
333 return is_bad_option(option, ignore, nullptr);
334 }
335
336 static void describe_range_error(ArgsRange errcode);
337 static ArgsRange check_memory_size(julong size, julong min_size, julong max_size);
338 static ArgsRange parse_memory_size(const char* s, julong* long_arg,
339 julong min_size, julong max_size = max_uintx);
340
341 // methods to build strings from individual args
342 static void build_jvm_args(const char* arg);
343 static void build_jvm_flags(const char* arg);
344 static void add_string(char*** bldarray, int* count, const char* arg);
345 static const char* build_resource_string(char** args, int count);
346
347 // Returns true if the flag is obsolete (and not yet expired).
348 // In this case the 'version' buffer is filled in with
349 // the version number when the flag became obsolete.
463 static void PropertyList_add(SystemProperty** plist, SystemProperty *element);
464 static void PropertyList_add(SystemProperty** plist, const char* k, const char* v, bool writeable, bool internal);
465
466 static void PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v,
467 PropertyAppendable append, PropertyWriteable writeable,
468 PropertyInternal internal);
469 static const char* PropertyList_get_value(SystemProperty* plist, const char* key);
470 static const char* PropertyList_get_readable_value(SystemProperty* plist, const char* key);
471 static int PropertyList_count(SystemProperty* pl);
472 static int PropertyList_readable_count(SystemProperty* pl);
473
474 static bool is_internal_module_property(const char* option);
475
476 // Miscellaneous System property value getter and setters.
477 static void set_dll_dir(const char *value) { _sun_boot_library_path->set_value(value); }
478 static void set_java_home(const char *value) { _java_home->set_value(value); }
479 static void set_library_path(const char *value) { _java_library_path->set_value(value); }
480 static void set_ext_dirs(char *value) { _ext_dirs = os::strdup_check_oom(value); }
481
482 // Set up the underlying pieces of the boot class path
483 static void add_patch_mod_prefix(const char *module_name, const char *path, bool* patch_mod_javabase);
484 static void set_boot_class_path(const char *value, bool has_jimage) {
485 // During start up, set by os::set_boot_path()
486 assert(get_boot_class_path() == nullptr, "Boot class path previously set");
487 _boot_class_path->set_value(value);
488 _has_jimage = has_jimage;
489 }
490 static void append_sysclasspath(const char *value) {
491 _boot_class_path->append_value(value);
492 _jdk_boot_class_path_append->append_value(value);
493 }
494
495 static GrowableArray<ModulePatchPath*>* get_patch_mod_prefix() { return _patch_mod_prefix; }
496 static char* get_boot_class_path() { return _boot_class_path->value(); }
497 static bool has_jimage() { return _has_jimage; }
498
499 static char* get_java_home() { return _java_home->value(); }
500 static char* get_dll_dir() { return _sun_boot_library_path->value(); }
501 static char* get_appclasspath() { return _java_class_path->value(); }
502 static void fix_appclasspath();
503
|
74 void append_value(const char *value);
75
76 PathString(const char* value);
77 ~PathString();
78
79 // for JVM_ReadSystemPropertiesInfo
80 static int value_offset_in_bytes() { return (int)offset_of(PathString, _value); }
81 };
82
83 // ModulePatchPath records the module/path pair as specified to --patch-module.
84 class ModulePatchPath : public CHeapObj<mtInternal> {
85 private:
86 char* _module_name;
87 PathString* _path;
88 public:
89 ModulePatchPath(const char* module_name, const char* path);
90 ~ModulePatchPath();
91
92 inline const char* module_name() const { return _module_name; }
93 inline char* path_string() const { return _path->value(); }
94 inline void append_path(const char* path) { _path->append_value(path); }
95 };
96
97 // Element describing System and User (-Dkey=value flags) defined property.
98 //
99 // An internal SystemProperty is one that has been removed in
100 // jdk.internal.VM.saveAndRemoveProperties, like jdk.boot.class.path.append.
101 //
102 class SystemProperty : public PathString {
103 private:
104 char* _key;
105 SystemProperty* _next;
106 bool _internal;
107 bool _writeable;
108
109 public:
110 // Accessors
111 char* value() const { return PathString::value(); }
112 const char* key() const { return _key; }
113 bool internal() const { return _internal; }
114 SystemProperty* next() const { return _next; }
274 static void set_heap_size();
275
276 // Bytecode rewriting
277 static void set_bytecode_flags();
278
279 // Invocation API hooks
280 static abort_hook_t _abort_hook;
281 static exit_hook_t _exit_hook;
282 static vfprintf_hook_t _vfprintf_hook;
283
284 // System properties
285 static bool add_property(const char* prop, PropertyWriteable writeable=WriteableProperty,
286 PropertyInternal internal=ExternalProperty);
287
288 // Used for module system related properties: converted from command-line flags.
289 // Basic properties are writeable as they operate as "last one wins" and will get overwritten.
290 // Numbered properties are never writeable, and always internal.
291 static bool create_module_property(const char* prop_name, const char* prop_value, PropertyInternal internal);
292 static bool create_numbered_module_property(const char* prop_base_name, const char* prop_value, unsigned int count);
293
294 static int process_patch_mod_option(const char* patch_mod_tail);
295
296 // Aggressive optimization flags.
297 static jint set_aggressive_opts_flags();
298
299 static jint set_aggressive_heap_flags();
300
301 // Argument parsing
302 static bool parse_argument(const char* arg, JVMFlagOrigin origin);
303 static bool process_argument(const char* arg, jboolean ignore_unrecognized, JVMFlagOrigin origin);
304 static void process_java_launcher_argument(const char*, void*);
305 static jint parse_options_environment_variable(const char* name, ScopedVMInitArgs* vm_args);
306 static jint parse_java_tool_options_environment_variable(ScopedVMInitArgs* vm_args);
307 static jint parse_java_options_environment_variable(ScopedVMInitArgs* vm_args);
308 static jint parse_vm_options_file(const char* file_name, ScopedVMInitArgs* vm_args);
309 static jint parse_options_buffer(const char* name, char* buffer, const size_t buf_len, ScopedVMInitArgs* vm_args);
310 static jint parse_xss(const JavaVMOption* option, const char* tail, intx* out_ThreadStackSize);
311 static jint insert_vm_options_file(const JavaVMInitArgs* args,
312 const char* vm_options_file,
313 const int vm_options_file_pos,
314 ScopedVMInitArgs* vm_options_file_args,
315 ScopedVMInitArgs* args_out);
316 static bool args_contains_vm_options_file_arg(const JavaVMInitArgs* args);
317 static jint expand_vm_options_as_needed(const JavaVMInitArgs* args_in,
318 ScopedVMInitArgs* mod_args,
319 JavaVMInitArgs** args_out);
320 static jint match_special_option_and_act(const JavaVMInitArgs* args,
321 ScopedVMInitArgs* args_out);
322
323 static bool handle_deprecated_print_gc_flags();
324
325 static jint parse_vm_init_args(const JavaVMInitArgs *vm_options_args,
326 const JavaVMInitArgs *java_tool_options_args,
327 const JavaVMInitArgs *java_options_args,
328 const JavaVMInitArgs *cmd_line_args);
329 static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, JVMFlagOrigin origin);
330 static jint finalize_vm_init_args();
331 static bool is_bad_option(const JavaVMOption* option, jboolean ignore, const char* option_type);
332
333 static bool is_bad_option(const JavaVMOption* option, jboolean ignore) {
334 return is_bad_option(option, ignore, nullptr);
335 }
336
337 static void describe_range_error(ArgsRange errcode);
338 static ArgsRange check_memory_size(julong size, julong min_size, julong max_size);
339 static ArgsRange parse_memory_size(const char* s, julong* long_arg,
340 julong min_size, julong max_size = max_uintx);
341
342 // methods to build strings from individual args
343 static void build_jvm_args(const char* arg);
344 static void build_jvm_flags(const char* arg);
345 static void add_string(char*** bldarray, int* count, const char* arg);
346 static const char* build_resource_string(char** args, int count);
347
348 // Returns true if the flag is obsolete (and not yet expired).
349 // In this case the 'version' buffer is filled in with
350 // the version number when the flag became obsolete.
464 static void PropertyList_add(SystemProperty** plist, SystemProperty *element);
465 static void PropertyList_add(SystemProperty** plist, const char* k, const char* v, bool writeable, bool internal);
466
467 static void PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v,
468 PropertyAppendable append, PropertyWriteable writeable,
469 PropertyInternal internal);
470 static const char* PropertyList_get_value(SystemProperty* plist, const char* key);
471 static const char* PropertyList_get_readable_value(SystemProperty* plist, const char* key);
472 static int PropertyList_count(SystemProperty* pl);
473 static int PropertyList_readable_count(SystemProperty* pl);
474
475 static bool is_internal_module_property(const char* option);
476
477 // Miscellaneous System property value getter and setters.
478 static void set_dll_dir(const char *value) { _sun_boot_library_path->set_value(value); }
479 static void set_java_home(const char *value) { _java_home->set_value(value); }
480 static void set_library_path(const char *value) { _java_library_path->set_value(value); }
481 static void set_ext_dirs(char *value) { _ext_dirs = os::strdup_check_oom(value); }
482
483 // Set up the underlying pieces of the boot class path
484 static void add_patch_mod_prefix(const char *module_name, const char *path, bool allow_append);
485 static bool patch_mod_javabase();
486 static int finalize_patch_module();
487 static void set_boot_class_path(const char *value, bool has_jimage) {
488 // During start up, set by os::set_boot_path()
489 assert(get_boot_class_path() == nullptr, "Boot class path previously set");
490 _boot_class_path->set_value(value);
491 _has_jimage = has_jimage;
492 }
493 static void append_sysclasspath(const char *value) {
494 _boot_class_path->append_value(value);
495 _jdk_boot_class_path_append->append_value(value);
496 }
497
498 static GrowableArray<ModulePatchPath*>* get_patch_mod_prefix() { return _patch_mod_prefix; }
499 static char* get_boot_class_path() { return _boot_class_path->value(); }
500 static bool has_jimage() { return _has_jimage; }
501
502 static char* get_java_home() { return _java_home->value(); }
503 static char* get_dll_dir() { return _sun_boot_library_path->value(); }
504 static char* get_appclasspath() { return _java_class_path->value(); }
505 static void fix_appclasspath();
506
|