hotspot/src/share/vm/runtime/arguments.hpp
changeset 37491 edf4cc53f5a3
parent 37466 287c4ebd11b0
child 38195 d317aafcc87c
child 37773 e5b3e9732c3c
equal deleted inserted replaced
37473:8af1deb0c879 37491:edf4cc53f5a3
    45 class ArgumentBootClassPath;
    45 class ArgumentBootClassPath;
    46 
    46 
    47 // PathString is used as the underlying value container for a
    47 // PathString is used as the underlying value container for a
    48 // SystemProperty and for the string that represents the system
    48 // SystemProperty and for the string that represents the system
    49 // boot class path, Arguments::_system_boot_class_path.
    49 // boot class path, Arguments::_system_boot_class_path.
    50 class PathString : public CHeapObj<mtInternal> {
    50 class PathString : public CHeapObj<mtArguments> {
    51  protected:
    51  protected:
    52   char*           _value;
    52   char*           _value;
    53  public:
    53  public:
    54   char* value() const                       { return _value; }
    54   char* value() const                       { return _value; }
    55 
    55 
    56   bool set_value(const char *value) {
    56   bool set_value(const char *value) {
    57     if (_value != NULL) {
    57     if (_value != NULL) {
    58       FreeHeap(_value);
    58       FreeHeap(_value);
    59     }
    59     }
    60     _value = AllocateHeap(strlen(value)+1, mtInternal);
    60     _value = AllocateHeap(strlen(value)+1, mtArguments);
    61     assert(_value != NULL, "Unable to allocate space for new path value");
    61     assert(_value != NULL, "Unable to allocate space for new path value");
    62     if (_value != NULL) {
    62     if (_value != NULL) {
    63       strcpy(_value, value);
    63       strcpy(_value, value);
    64     } else {
    64     } else {
    65       // not able to allocate
    65       // not able to allocate
    74     if (value != NULL) {
    74     if (value != NULL) {
    75       len = strlen(value);
    75       len = strlen(value);
    76       if (_value != NULL) {
    76       if (_value != NULL) {
    77         len += strlen(_value);
    77         len += strlen(_value);
    78       }
    78       }
    79       sp = AllocateHeap(len+2, mtInternal);
    79       sp = AllocateHeap(len+2, mtArguments);
    80       assert(sp != NULL, "Unable to allocate space for new append path value");
    80       assert(sp != NULL, "Unable to allocate space for new append path value");
    81       if (sp != NULL) {
    81       if (sp != NULL) {
    82         if (_value != NULL) {
    82         if (_value != NULL) {
    83           strcpy(sp, _value);
    83           strcpy(sp, _value);
    84           strcat(sp, os::path_separator());
    84           strcat(sp, os::path_separator());
    95   // Constructor
    95   // Constructor
    96   PathString(const char* value) {
    96   PathString(const char* value) {
    97     if (value == NULL) {
    97     if (value == NULL) {
    98       _value = NULL;
    98       _value = NULL;
    99     } else {
    99     } else {
   100       _value = AllocateHeap(strlen(value)+1, mtInternal);
   100       _value = AllocateHeap(strlen(value)+1, mtArguments);
   101       strcpy(_value, value);
   101       strcpy(_value, value);
   102     }
   102     }
   103   }
   103   }
   104 };
   104 };
   105 
   105 
   141   // Constructor
   141   // Constructor
   142   SystemProperty(const char* key, const char* value, bool writeable, bool internal = false) : PathString(value) {
   142   SystemProperty(const char* key, const char* value, bool writeable, bool internal = false) : PathString(value) {
   143     if (key == NULL) {
   143     if (key == NULL) {
   144       _key = NULL;
   144       _key = NULL;
   145     } else {
   145     } else {
   146       _key = AllocateHeap(strlen(key)+1, mtInternal);
   146       _key = AllocateHeap(strlen(key)+1, mtArguments);
   147       strcpy(_key, key);
   147       strcpy(_key, key);
   148     }
   148     }
   149     _next = NULL;
   149     _next = NULL;
   150     _internal = internal;
   150     _internal = internal;
   151     _writeable = writeable;
   151     _writeable = writeable;
   152   }
   152   }
   153 };
   153 };
   154 
   154 
   155 
   155 
   156 // For use by -agentlib, -agentpath and -Xrun
   156 // For use by -agentlib, -agentpath and -Xrun
   157 class AgentLibrary : public CHeapObj<mtInternal> {
   157 class AgentLibrary : public CHeapObj<mtArguments> {
   158   friend class AgentLibraryList;
   158   friend class AgentLibraryList;
   159 public:
   159 public:
   160   // Is this library valid or not. Don't rely on os_lib == NULL as statically
   160   // Is this library valid or not. Don't rely on os_lib == NULL as statically
   161   // linked lib could have handle of RTLD_DEFAULT which == 0 on some platforms
   161   // linked lib could have handle of RTLD_DEFAULT which == 0 on some platforms
   162   enum AgentState {
   162   enum AgentState {
   187   void set_valid()                          { _state = agent_valid; }
   187   void set_valid()                          { _state = agent_valid; }
   188   void set_invalid()                        { _state = agent_invalid; }
   188   void set_invalid()                        { _state = agent_invalid; }
   189 
   189 
   190   // Constructor
   190   // Constructor
   191   AgentLibrary(const char* name, const char* options, bool is_absolute_path, void* os_lib) {
   191   AgentLibrary(const char* name, const char* options, bool is_absolute_path, void* os_lib) {
   192     _name = AllocateHeap(strlen(name)+1, mtInternal);
   192     _name = AllocateHeap(strlen(name)+1, mtArguments);
   193     strcpy(_name, name);
   193     strcpy(_name, name);
   194     if (options == NULL) {
   194     if (options == NULL) {
   195       _options = NULL;
   195       _options = NULL;
   196     } else {
   196     } else {
   197       _options = AllocateHeap(strlen(options)+1, mtInternal);
   197       _options = AllocateHeap(strlen(options)+1, mtArguments);
   198       strcpy(_options, options);
   198       strcpy(_options, options);
   199     }
   199     }
   200     _is_absolute_path = is_absolute_path;
   200     _is_absolute_path = is_absolute_path;
   201     _os_lib = os_lib;
   201     _os_lib = os_lib;
   202     _next = NULL;
   202     _next = NULL;