262 // no error
263 SUCCESS = 0,
264 // flag name is missing
265 MISSING_NAME,
266 // flag value is missing
267 MISSING_VALUE,
268 // error parsing the textual form of the value
269 WRONG_FORMAT,
270 // flag is not writeable
271 NON_WRITABLE,
272 // flag value is outside of its bounds
273 OUT_OF_BOUNDS,
274 // flag value violates its constraint
275 VIOLATES_CONSTRAINT,
276 // there is no flag with the given name
277 INVALID_FLAG,
278 // other, unspecified error related to setting the flag
279 ERR_OTHER
280 };
281
282 const char* _type;
283 const char* _name;
284 void* _addr;
285 NOT_PRODUCT(const char* _doc;)
286 Flags _flags;
287
288 // points to all Flags static array
289 static Flag* flags;
290
291 // number of flags
292 static size_t numFlags;
293
294 static Flag* find_flag(const char* name) { return find_flag(name, strlen(name), true, true); };
295 static Flag* find_flag(const char* name, size_t length, bool allow_locked = false, bool return_flag = false);
296 static Flag* fuzzy_match(const char* name, size_t length, bool allow_locked = false);
297
298 void check_writable();
299
300 bool is_bool() const;
301 bool get_bool() const;
347 bool is_experimental() const;
348 bool is_notproduct() const;
349 bool is_develop() const;
350 bool is_read_write() const;
351 bool is_commercial() const;
352
353 bool is_constant_in_binary() const;
354
355 bool is_unlocker() const;
356 bool is_unlocked() const;
357 bool is_writeable() const;
358 bool is_external() const;
359
360 bool is_unlocker_ext() const;
361 bool is_unlocked_ext() const;
362 bool is_writeable_ext() const;
363 bool is_external_ext() const;
364
365 void unlock_diagnostic();
366
367 void get_locked_message(char*, int) const;
368 void get_locked_message_ext(char*, int) const;
369
370 // printRanges will print out flags type, name and range values as expected by -XX:+PrintFlagsRanges
371 void print_on(outputStream* st, bool withComments = false, bool printRanges = false);
372 void print_kind(outputStream* st);
373 void print_as_flag(outputStream* st);
374
375 static const char* flag_error_str(Flag::Error error);
376 };
377
378 // debug flags control various aspects of the VM and are global accessible
379
380 // use FlagSetting to temporarily change some debug flag
381 // e.g. FlagSetting fs(DebugThisAndThat, true);
382 // restored to previous value upon leaving scope
383 class FlagSetting {
384 bool val;
385 bool* flag;
386 public:
387 FlagSetting(bool& fl, bool newValue) { flag = &fl; val = fl; fl = newValue; }
|
262 // no error
263 SUCCESS = 0,
264 // flag name is missing
265 MISSING_NAME,
266 // flag value is missing
267 MISSING_VALUE,
268 // error parsing the textual form of the value
269 WRONG_FORMAT,
270 // flag is not writeable
271 NON_WRITABLE,
272 // flag value is outside of its bounds
273 OUT_OF_BOUNDS,
274 // flag value violates its constraint
275 VIOLATES_CONSTRAINT,
276 // there is no flag with the given name
277 INVALID_FLAG,
278 // other, unspecified error related to setting the flag
279 ERR_OTHER
280 };
281
282 enum MsgType {
283 NONE = 0,
284 DIAGNOSTIC_FLAG_BUT_LOCKED,
285 EXPERIMENTAL_FLAG_BUT_LOCKED,
286 DEVELOPER_FLAG_BUT_PRODUCT_BUILD,
287 NOTPRODUCT_FLAG_BUT_PRODUCT_BUILD
288 };
289
290 const char* _type;
291 const char* _name;
292 void* _addr;
293 NOT_PRODUCT(const char* _doc;)
294 Flags _flags;
295
296 // points to all Flags static array
297 static Flag* flags;
298
299 // number of flags
300 static size_t numFlags;
301
302 static Flag* find_flag(const char* name) { return find_flag(name, strlen(name), true, true); };
303 static Flag* find_flag(const char* name, size_t length, bool allow_locked = false, bool return_flag = false);
304 static Flag* fuzzy_match(const char* name, size_t length, bool allow_locked = false);
305
306 void check_writable();
307
308 bool is_bool() const;
309 bool get_bool() const;
355 bool is_experimental() const;
356 bool is_notproduct() const;
357 bool is_develop() const;
358 bool is_read_write() const;
359 bool is_commercial() const;
360
361 bool is_constant_in_binary() const;
362
363 bool is_unlocker() const;
364 bool is_unlocked() const;
365 bool is_writeable() const;
366 bool is_external() const;
367
368 bool is_unlocker_ext() const;
369 bool is_unlocked_ext() const;
370 bool is_writeable_ext() const;
371 bool is_external_ext() const;
372
373 void unlock_diagnostic();
374
375 Flag::MsgType get_locked_message(char*, int) const;
376 void get_locked_message_ext(char*, int) const;
377
378 // printRanges will print out flags type, name and range values as expected by -XX:+PrintFlagsRanges
379 void print_on(outputStream* st, bool withComments = false, bool printRanges = false);
380 void print_kind(outputStream* st);
381 void print_as_flag(outputStream* st);
382
383 static const char* flag_error_str(Flag::Error error);
384 };
385
386 // debug flags control various aspects of the VM and are global accessible
387
388 // use FlagSetting to temporarily change some debug flag
389 // e.g. FlagSetting fs(DebugThisAndThat, true);
390 // restored to previous value upon leaving scope
391 class FlagSetting {
392 bool val;
393 bool* flag;
394 public:
395 FlagSetting(bool& fl, bool newValue) { flag = &fl; val = fl; fl = newValue; }
|