70
71 // return false iff OOM && alloc_failmode == AllocFailStrategy::RETURN_NULL
72 bool set_value(const char *value, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
73 void append_value(const char *value);
74
75 PathString(const char* value);
76 ~PathString();
77 };
78
79 // ModulePatchPath records the module/path pair as specified to --patch-module.
80 class ModulePatchPath : public CHeapObj<mtInternal> {
81 private:
82 char* _module_name;
83 PathString* _path;
84 public:
85 ModulePatchPath(const char* module_name, const char* path);
86 ~ModulePatchPath();
87
88 inline const char* module_name() const { return _module_name; }
89 inline char* path_string() const { return _path->value(); }
90 };
91
92 // Element describing System and User (-Dkey=value flags) defined property.
93 //
94 // An internal SystemProperty is one that has been removed in
95 // jdk.internal.VM.saveAndRemoveProperties, like jdk.boot.class.path.append.
96 //
97 class SystemProperty : public PathString {
98 private:
99 char* _key;
100 SystemProperty* _next;
101 bool _internal;
102 bool _writeable;
103
104 public:
105 // Accessors
106 char* value() const { return PathString::value(); }
107 const char* key() const { return _key; }
108 bool internal() const { return _internal; }
109 SystemProperty* next() const { return _next; }
442
443 static void PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v,
444 PropertyAppendable append, PropertyWriteable writeable,
445 PropertyInternal internal);
446 static const char* PropertyList_get_value(SystemProperty* plist, const char* key);
447 static const char* PropertyList_get_readable_value(SystemProperty* plist, const char* key);
448 static int PropertyList_count(SystemProperty* pl);
449 static int PropertyList_readable_count(SystemProperty* pl);
450
451 static bool is_internal_module_property(const char* option);
452 static bool is_incompatible_cds_internal_module_property(const char* property);
453
454 // Miscellaneous System property value getter and setters.
455 static void set_dll_dir(const char *value) { _sun_boot_library_path->set_value(value); }
456 static void set_java_home(const char *value) { _java_home->set_value(value); }
457 static void set_library_path(const char *value) { _java_library_path->set_value(value); }
458 static void set_ext_dirs(char *value);
459
460 // Set up the underlying pieces of the boot class path
461 static void add_patch_mod_prefix(const char *module_name, const char *path);
462 static void set_boot_class_path(const char *value, bool has_jimage) {
463 // During start up, set by os::set_boot_path()
464 assert(get_boot_class_path() == nullptr, "Boot class path previously set");
465 _boot_class_path->set_value(value);
466 _has_jimage = has_jimage;
467 }
468 static void append_sysclasspath(const char *value) {
469 _boot_class_path->append_value(value);
470 _jdk_boot_class_path_append->append_value(value);
471 }
472
473 static GrowableArray<ModulePatchPath*>* get_patch_mod_prefix() { return _patch_mod_prefix; }
474 static char* get_boot_class_path() { return _boot_class_path->value(); }
475 static bool has_jimage() { return _has_jimage; }
476
477 static char* get_java_home() { return _java_home->value(); }
478 static char* get_dll_dir() { return _sun_boot_library_path->value(); }
479 static char* get_appclasspath() { return _java_class_path->value(); }
480 static void fix_appclasspath();
481
482 // Operation modi
483 static Mode mode() { return _mode; }
484 static void set_mode_flags(Mode mode);
485 static bool is_interpreter_only() { return mode() == _int; }
486 static bool is_compiler_only() { return mode() == _comp; }
487
488
489 // preview features
490 static void set_enable_preview() { _enable_preview = true; }
491 static bool enable_preview() { return _enable_preview; }
492
493 // jdwp
494 static bool has_jdwp_agent() { return _has_jdwp_agent; }
495
496 // Utility: copies src into buf, replacing "%%" with "%" and "%p" with pid.
497 static bool copy_expand_pid(const char* src, size_t srclen, char* buf, size_t buflen);
498
499 static bool atojulong(const char *s, julong* result);
500
501 static bool has_jfr_option() NOT_JFR_RETURN_(false);
502
503 DEBUG_ONLY(static bool verify_special_jvm_flags(bool check_globals);)
504 };
505
506 // Disable options not supported in this release, with a warning if they
507 // were explicitly requested on the command-line
508 #define UNSUPPORTED_OPTION(opt) \
509 do { \
510 if (opt) { \
511 if (FLAG_IS_CMDLINE(opt)) { \
|
70
71 // return false iff OOM && alloc_failmode == AllocFailStrategy::RETURN_NULL
72 bool set_value(const char *value, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
73 void append_value(const char *value);
74
75 PathString(const char* value);
76 ~PathString();
77 };
78
79 // ModulePatchPath records the module/path pair as specified to --patch-module.
80 class ModulePatchPath : public CHeapObj<mtInternal> {
81 private:
82 char* _module_name;
83 PathString* _path;
84 public:
85 ModulePatchPath(const char* module_name, const char* path);
86 ~ModulePatchPath();
87
88 inline const char* module_name() const { return _module_name; }
89 inline char* path_string() const { return _path->value(); }
90 inline void append_path(const char* path) { _path->append_value(path); }
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; }
443
444 static void PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v,
445 PropertyAppendable append, PropertyWriteable writeable,
446 PropertyInternal internal);
447 static const char* PropertyList_get_value(SystemProperty* plist, const char* key);
448 static const char* PropertyList_get_readable_value(SystemProperty* plist, const char* key);
449 static int PropertyList_count(SystemProperty* pl);
450 static int PropertyList_readable_count(SystemProperty* pl);
451
452 static bool is_internal_module_property(const char* option);
453 static bool is_incompatible_cds_internal_module_property(const char* property);
454
455 // Miscellaneous System property value getter and setters.
456 static void set_dll_dir(const char *value) { _sun_boot_library_path->set_value(value); }
457 static void set_java_home(const char *value) { _java_home->set_value(value); }
458 static void set_library_path(const char *value) { _java_library_path->set_value(value); }
459 static void set_ext_dirs(char *value);
460
461 // Set up the underlying pieces of the boot class path
462 static void add_patch_mod_prefix(const char *module_name, const char *path);
463
464 static void set_boot_class_path(const char *value, bool has_jimage) {
465 // During start up, set by os::set_boot_path()
466 assert(get_boot_class_path() == nullptr, "Boot class path previously set");
467 _boot_class_path->set_value(value);
468 _has_jimage = has_jimage;
469 }
470 static void append_sysclasspath(const char *value) {
471 _boot_class_path->append_value(value);
472 _jdk_boot_class_path_append->append_value(value);
473 }
474
475 static GrowableArray<ModulePatchPath*>* get_patch_mod_prefix() { return _patch_mod_prefix; }
476 static char* get_boot_class_path() { return _boot_class_path->value(); }
477 static bool has_jimage() { return _has_jimage; }
478
479 static char* get_java_home() { return _java_home->value(); }
480 static char* get_dll_dir() { return _sun_boot_library_path->value(); }
481 static char* get_appclasspath() { return _java_class_path->value(); }
482 static void fix_appclasspath();
483
484 // Operation modi
485 static Mode mode() { return _mode; }
486 static void set_mode_flags(Mode mode);
487 static bool is_interpreter_only() { return mode() == _int; }
488 static bool is_compiler_only() { return mode() == _comp; }
489
490
491 // preview features
492 static void set_enable_preview() { _enable_preview = true; }
493 static bool enable_preview() { return _enable_preview; }
494 static bool is_valhalla_enabled() {
495 // Valhalla is a feature opted-in by --enable-preview
496 return enable_preview();
497 }
498
499 // jdwp
500 static bool has_jdwp_agent() { return _has_jdwp_agent; }
501
502 // Utility: copies src into buf, replacing "%%" with "%" and "%p" with pid.
503 static bool copy_expand_pid(const char* src, size_t srclen, char* buf, size_t buflen);
504
505 static bool atojulong(const char *s, julong* result);
506
507 static bool has_jfr_option() NOT_JFR_RETURN_(false);
508
509 DEBUG_ONLY(static bool verify_special_jvm_flags(bool check_globals);)
510 };
511
512 // Disable options not supported in this release, with a warning if they
513 // were explicitly requested on the command-line
514 #define UNSUPPORTED_OPTION(opt) \
515 do { \
516 if (opt) { \
517 if (FLAG_IS_CMDLINE(opt)) { \
|