< prev index next >

src/hotspot/share/runtime/arguments.hpp

Print this page

  1 /*
  2  * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *

 73   void append_value(const char *value);
 74 
 75   PathString(const char* value);
 76   ~PathString();
 77 
 78   // for JVM_ReadSystemPropertiesInfo
 79   static int value_offset_in_bytes()  { return (int)offset_of(PathString, _value);  }
 80 };
 81 
 82 // ModulePatchPath records the module/path pair as specified to --patch-module.
 83 class ModulePatchPath : public CHeapObj<mtInternal> {
 84 private:
 85   char* _module_name;
 86   PathString* _path;
 87 public:
 88   ModulePatchPath(const char* module_name, const char* path);
 89   ~ModulePatchPath();
 90 
 91   inline const char* module_name() const { return _module_name; }
 92   inline char* path_string() const { return _path->value(); }

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

459 
460   static void PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v,
461                                       PropertyAppendable append, PropertyWriteable writeable,
462                                       PropertyInternal internal);
463   static const char* PropertyList_get_value(SystemProperty* plist, const char* key);
464   static const char* PropertyList_get_readable_value(SystemProperty* plist, const char* key);
465   static int  PropertyList_count(SystemProperty* pl);
466   static int  PropertyList_readable_count(SystemProperty* pl);
467 
468   static bool is_internal_module_property(const char* option);
469   static bool is_incompatible_cds_internal_module_property(const char* property);
470 
471   // Miscellaneous System property value getter and setters.
472   static void set_dll_dir(const char *value) { _sun_boot_library_path->set_value(value); }
473   static void set_java_home(const char *value) { _java_home->set_value(value); }
474   static void set_library_path(const char *value) { _java_library_path->set_value(value); }
475   static void set_ext_dirs(char *value);
476 
477   // Set up the underlying pieces of the boot class path
478   static void add_patch_mod_prefix(const char *module_name, const char *path);


479   static void set_boot_class_path(const char *value, bool has_jimage) {
480     // During start up, set by os::set_boot_path()
481     assert(get_boot_class_path() == nullptr, "Boot class path previously set");
482     _boot_class_path->set_value(value);
483     _has_jimage = has_jimage;
484   }
485   static void append_sysclasspath(const char *value) {
486     _boot_class_path->append_value(value);
487     _jdk_boot_class_path_append->append_value(value);
488   }
489 
490   static GrowableArray<ModulePatchPath*>* get_patch_mod_prefix() { return _patch_mod_prefix; }
491   static char* get_boot_class_path() { return _boot_class_path->value(); }
492   static bool has_jimage() { return _has_jimage; }
493 
494   static char* get_java_home()    { return _java_home->value(); }
495   static char* get_dll_dir()      { return _sun_boot_library_path->value(); }
496   static char* get_appclasspath() { return _java_class_path->value(); }
497   static void  fix_appclasspath();
498 
499   // Operation modi
500   static Mode mode()                { return _mode;           }
501   static void set_mode_flags(Mode mode);
502   static bool is_interpreter_only() { return mode() == _int;  }
503   static bool is_compiler_only()    { return mode() == _comp; }
504 
505 
506   // preview features
507   static void set_enable_preview() { _enable_preview = true; }
508   static bool enable_preview() { return _enable_preview; }




509 
510   // jdwp
511   static bool has_jdwp_agent() { return _has_jdwp_agent; }
512 
513   // Utility: copies src into buf, replacing "%%" with "%" and "%p" with pid.
514   static bool copy_expand_pid(const char* src, size_t srclen, char* buf, size_t buflen);
515 
516   static bool atojulong(const char *s, julong* result);
517 
518   static bool has_jfr_option() NOT_JFR_RETURN_(false);
519 
520   DEBUG_ONLY(static bool verify_special_jvm_flags(bool check_globals);)
521 };
522 
523 // Disable options not supported in this release, with a warning if they
524 // were explicitly requested on the command-line
525 #define UNSUPPORTED_OPTION(opt)                          \
526 do {                                                     \
527   if (opt) {                                             \
528     if (FLAG_IS_CMDLINE(opt)) {                          \

  1 /*
  2  * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *

 73   void append_value(const char *value);
 74 
 75   PathString(const char* value);
 76   ~PathString();
 77 
 78   // for JVM_ReadSystemPropertiesInfo
 79   static int value_offset_in_bytes()  { return (int)offset_of(PathString, _value);  }
 80 };
 81 
 82 // ModulePatchPath records the module/path pair as specified to --patch-module.
 83 class ModulePatchPath : public CHeapObj<mtInternal> {
 84 private:
 85   char* _module_name;
 86   PathString* _path;
 87 public:
 88   ModulePatchPath(const char* module_name, const char* path);
 89   ~ModulePatchPath();
 90 
 91   inline const char* module_name() const { return _module_name; }
 92   inline char* path_string() const { return _path->value(); }
 93   inline void append_path(const char* path) { _path->append_value(path); }
 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; }

460 
461   static void PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v,
462                                       PropertyAppendable append, PropertyWriteable writeable,
463                                       PropertyInternal internal);
464   static const char* PropertyList_get_value(SystemProperty* plist, const char* key);
465   static const char* PropertyList_get_readable_value(SystemProperty* plist, const char* key);
466   static int  PropertyList_count(SystemProperty* pl);
467   static int  PropertyList_readable_count(SystemProperty* pl);
468 
469   static bool is_internal_module_property(const char* option);
470   static bool is_incompatible_cds_internal_module_property(const char* property);
471 
472   // Miscellaneous System property value getter and setters.
473   static void set_dll_dir(const char *value) { _sun_boot_library_path->set_value(value); }
474   static void set_java_home(const char *value) { _java_home->set_value(value); }
475   static void set_library_path(const char *value) { _java_library_path->set_value(value); }
476   static void set_ext_dirs(char *value);
477 
478   // Set up the underlying pieces of the boot class path
479   static void add_patch_mod_prefix(const char *module_name, const char *path);
480   static int finalize_patch_module();
481 
482   static void set_boot_class_path(const char *value, bool has_jimage) {
483     // During start up, set by os::set_boot_path()
484     assert(get_boot_class_path() == nullptr, "Boot class path previously set");
485     _boot_class_path->set_value(value);
486     _has_jimage = has_jimage;
487   }
488   static void append_sysclasspath(const char *value) {
489     _boot_class_path->append_value(value);
490     _jdk_boot_class_path_append->append_value(value);
491   }
492 
493   static GrowableArray<ModulePatchPath*>* get_patch_mod_prefix() { return _patch_mod_prefix; }
494   static char* get_boot_class_path() { return _boot_class_path->value(); }
495   static bool has_jimage() { return _has_jimage; }
496 
497   static char* get_java_home()    { return _java_home->value(); }
498   static char* get_dll_dir()      { return _sun_boot_library_path->value(); }
499   static char* get_appclasspath() { return _java_class_path->value(); }
500   static void  fix_appclasspath();
501 
502   // Operation modi
503   static Mode mode()                { return _mode;           }
504   static void set_mode_flags(Mode mode);
505   static bool is_interpreter_only() { return mode() == _int;  }
506   static bool is_compiler_only()    { return mode() == _comp; }
507 
508 
509   // preview features
510   static void set_enable_preview() { _enable_preview = true; }
511   static bool enable_preview() { return _enable_preview; }
512   static bool is_valhalla_enabled() {
513     // Valhalla is a feature opted-in by --enable-preview
514     return enable_preview();
515   }
516 
517   // jdwp
518   static bool has_jdwp_agent() { return _has_jdwp_agent; }
519 
520   // Utility: copies src into buf, replacing "%%" with "%" and "%p" with pid.
521   static bool copy_expand_pid(const char* src, size_t srclen, char* buf, size_t buflen);
522 
523   static bool atojulong(const char *s, julong* result);
524 
525   static bool has_jfr_option() NOT_JFR_RETURN_(false);
526 
527   DEBUG_ONLY(static bool verify_special_jvm_flags(bool check_globals);)
528 };
529 
530 // Disable options not supported in this release, with a warning if they
531 // were explicitly requested on the command-line
532 #define UNSUPPORTED_OPTION(opt)                          \
533 do {                                                     \
534   if (opt) {                                             \
535     if (FLAG_IS_CMDLINE(opt)) {                          \
< prev index next >