101 _key = NULL; 102 } else { 103 _key = AllocateHeap(strlen(key)+1, mtInternal); 104 strcpy(_key, key); 105 } 106 if (value == NULL) { 107 _value = NULL; 108 } else { 109 _value = AllocateHeap(strlen(value)+1, mtInternal); 110 strcpy(_value, value); 111 } 112 _next = NULL; 113 _writeable = writeable; 114 } 115 }; 116 117 118 // For use by -agentlib, -agentpath and -Xrun 119 class AgentLibrary : public CHeapObj<mtInternal> { 120 friend class AgentLibraryList; 121 private: 122 char* _name; 123 char* _options; 124 void* _os_lib; 125 bool _is_absolute_path; 126 AgentLibrary* _next; 127 128 public: 129 // Accessors 130 const char* name() const { return _name; } 131 char* options() const { return _options; } 132 bool is_absolute_path() const { return _is_absolute_path; } 133 void* os_lib() const { return _os_lib; } 134 void set_os_lib(void* os_lib) { _os_lib = os_lib; } 135 AgentLibrary* next() const { return _next; } 136 137 // Constructor 138 AgentLibrary(const char* name, const char* options, bool is_absolute_path, void* os_lib) { 139 _name = AllocateHeap(strlen(name)+1, mtInternal); 140 strcpy(_name, name); 141 if (options == NULL) { 142 _options = NULL; 143 } else { 144 _options = AllocateHeap(strlen(options)+1, mtInternal); 145 strcpy(_options, options); 146 } 147 _is_absolute_path = is_absolute_path; 148 _os_lib = os_lib; 149 _next = NULL; 150 } 151 }; 152 153 // maintain an order of entry list of AgentLibrary 154 class AgentLibraryList VALUE_OBJ_CLASS_SPEC { 155 private: 156 AgentLibrary* _first; 157 AgentLibrary* _last; 158 public: 159 bool is_empty() const { return _first == NULL; } 160 AgentLibrary* first() const { return _first; } 161 162 // add to the end of the list 163 void add(AgentLibrary* lib) { 164 if (is_empty()) { 165 _first = _last = lib; 166 } else { 167 _last->_next = lib; 168 _last = lib; 169 } 259 260 // was this VM created by the gamma launcher 261 static bool _created_by_gamma_launcher; 262 263 // Option flags 264 static bool _has_profile; 265 static const char* _gc_log_filename; 266 static uintx _min_heap_size; 267 268 // -Xrun arguments 269 static AgentLibraryList _libraryList; 270 static void add_init_library(const char* name, char* options) 271 { _libraryList.add(new AgentLibrary(name, options, false, NULL)); } 272 273 // -agentlib and -agentpath arguments 274 static AgentLibraryList _agentList; 275 static void add_init_agent(const char* name, char* options, bool absolute_path) 276 { _agentList.add(new AgentLibrary(name, options, absolute_path, NULL)); } 277 278 // Late-binding agents not started via arguments 279 static void add_loaded_agent(const char* name, char* options, bool absolute_path, void* os_lib) 280 { _agentList.add(new AgentLibrary(name, options, absolute_path, os_lib)); } 281 282 // Operation modi 283 static Mode _mode; 284 static void set_mode_flags(Mode mode); 285 static bool _java_compiler; 286 static void set_java_compiler(bool arg) { _java_compiler = arg; } 287 static bool java_compiler() { return _java_compiler; } 288 289 // -Xdebug flag 290 static bool _xdebug_mode; 291 static void set_xdebug_mode(bool arg) { _xdebug_mode = arg; } 292 static bool xdebug_mode() { return _xdebug_mode; } 293 294 // Used to save default settings 295 static bool _AlwaysCompileLoopMethods; 296 static bool _UseOnStackReplacement; 297 static bool _BackgroundCompilation; 298 static bool _ClipInlining; | 101 _key = NULL; 102 } else { 103 _key = AllocateHeap(strlen(key)+1, mtInternal); 104 strcpy(_key, key); 105 } 106 if (value == NULL) { 107 _value = NULL; 108 } else { 109 _value = AllocateHeap(strlen(value)+1, mtInternal); 110 strcpy(_value, value); 111 } 112 _next = NULL; 113 _writeable = writeable; 114 } 115 }; 116 117 118 // For use by -agentlib, -agentpath and -Xrun 119 class AgentLibrary : public CHeapObj<mtInternal> { 120 friend class AgentLibraryList; 121 public: 122 // Is this library valid or not. Don't rely on os_lib == NULL as statically 123 // linked lib could have handle of RTLD_DEFAULT which == 0 on some platforms 124 enum AgentState { 125 agent_invalid = 0, 126 agent_valid = 1 127 }; 128 129 private: 130 char* _name; 131 char* _options; 132 void* _os_lib; 133 bool _is_absolute_path; 134 bool _is_static_lib; 135 AgentState _state; 136 AgentLibrary* _next; 137 138 public: 139 // Accessors 140 const char* name() const { return _name; } 141 char* options() const { return _options; } 142 bool is_absolute_path() const { return _is_absolute_path; } 143 void* os_lib() const { return _os_lib; } 144 void set_os_lib(void* os_lib) { _os_lib = os_lib; } 145 AgentLibrary* next() const { return _next; } 146 bool is_static_lib() const { return _is_static_lib; } 147 void set_static_lib(bool static_lib) { _is_static_lib = static_lib; } 148 bool valid() { return (_state == agent_valid); } 149 void set_valid() { _state = agent_valid; } 150 void set_invalid() { _state = agent_invalid; } 151 152 // Constructor 153 AgentLibrary(const char* name, const char* options, bool is_absolute_path, void* os_lib) { 154 _name = AllocateHeap(strlen(name)+1, mtInternal); 155 strcpy(_name, name); 156 if (options == NULL) { 157 _options = NULL; 158 } else { 159 _options = AllocateHeap(strlen(options)+1, mtInternal); 160 strcpy(_options, options); 161 } 162 _is_absolute_path = is_absolute_path; 163 _os_lib = os_lib; 164 _next = NULL; 165 _state = agent_invalid; 166 _is_static_lib = false; 167 } 168 }; 169 170 // maintain an order of entry list of AgentLibrary 171 class AgentLibraryList VALUE_OBJ_CLASS_SPEC { 172 private: 173 AgentLibrary* _first; 174 AgentLibrary* _last; 175 public: 176 bool is_empty() const { return _first == NULL; } 177 AgentLibrary* first() const { return _first; } 178 179 // add to the end of the list 180 void add(AgentLibrary* lib) { 181 if (is_empty()) { 182 _first = _last = lib; 183 } else { 184 _last->_next = lib; 185 _last = lib; 186 } 276 277 // was this VM created by the gamma launcher 278 static bool _created_by_gamma_launcher; 279 280 // Option flags 281 static bool _has_profile; 282 static const char* _gc_log_filename; 283 static uintx _min_heap_size; 284 285 // -Xrun arguments 286 static AgentLibraryList _libraryList; 287 static void add_init_library(const char* name, char* options) 288 { _libraryList.add(new AgentLibrary(name, options, false, NULL)); } 289 290 // -agentlib and -agentpath arguments 291 static AgentLibraryList _agentList; 292 static void add_init_agent(const char* name, char* options, bool absolute_path) 293 { _agentList.add(new AgentLibrary(name, options, absolute_path, NULL)); } 294 295 // Late-binding agents not started via arguments 296 static void add_loaded_agent(AgentLibrary *agentLib) 297 { _agentList.add(agentLib); } 298 static void add_loaded_agent(const char* name, char* options, bool absolute_path, void* os_lib) 299 { _agentList.add(new AgentLibrary(name, options, absolute_path, os_lib)); } 300 301 // Operation modi 302 static Mode _mode; 303 static void set_mode_flags(Mode mode); 304 static bool _java_compiler; 305 static void set_java_compiler(bool arg) { _java_compiler = arg; } 306 static bool java_compiler() { return _java_compiler; } 307 308 // -Xdebug flag 309 static bool _xdebug_mode; 310 static void set_xdebug_mode(bool arg) { _xdebug_mode = arg; } 311 static bool xdebug_mode() { return _xdebug_mode; } 312 313 // Used to save default settings 314 static bool _AlwaysCompileLoopMethods; 315 static bool _UseOnStackReplacement; 316 static bool _BackgroundCompilation; 317 static bool _ClipInlining; |