352 class UIntFlagSetting {
353 uintx val;
354 uintx* flag;
355 public:
356 UIntFlagSetting(uintx& fl, uintx newValue) { flag = &fl; val = fl; fl = newValue; }
357 ~UIntFlagSetting() { *flag = val; }
358 };
359
360
361 class DoubleFlagSetting {
362 double val;
363 double* flag;
364 public:
365 DoubleFlagSetting(double& fl, double newValue) { flag = &fl; val = fl; fl = newValue; }
366 ~DoubleFlagSetting() { *flag = val; }
367 };
368
369
370 class CommandLineFlags {
371 public:
372 static bool boolAt(const char* name, size_t len, bool* value);
373 static bool boolAt(const char* name, bool* value) { return boolAt(name, strlen(name), value); }
374 static bool boolAtPut(const char* name, size_t len, bool* value, Flag::Flags origin);
375 static bool boolAtPut(const char* name, bool* value, Flag::Flags origin) { return boolAtPut(name, strlen(name), value, origin); }
376
377 static bool intxAt(const char* name, size_t len, intx* value);
378 static bool intxAt(const char* name, intx* value) { return intxAt(name, strlen(name), value); }
379 static bool intxAtPut(const char* name, size_t len, intx* value, Flag::Flags origin);
380 static bool intxAtPut(const char* name, intx* value, Flag::Flags origin) { return intxAtPut(name, strlen(name), value, origin); }
381
382 static bool uintxAt(const char* name, size_t len, uintx* value);
383 static bool uintxAt(const char* name, uintx* value) { return uintxAt(name, strlen(name), value); }
384 static bool uintxAtPut(const char* name, size_t len, uintx* value, Flag::Flags origin);
385 static bool uintxAtPut(const char* name, uintx* value, Flag::Flags origin) { return uintxAtPut(name, strlen(name), value, origin); }
386
387 static bool uint64_tAt(const char* name, size_t len, uint64_t* value);
388 static bool uint64_tAt(const char* name, uint64_t* value) { return uint64_tAt(name, strlen(name), value); }
389 static bool uint64_tAtPut(const char* name, size_t len, uint64_t* value, Flag::Flags origin);
390 static bool uint64_tAtPut(const char* name, uint64_t* value, Flag::Flags origin) { return uint64_tAtPut(name, strlen(name), value, origin); }
391
392 static bool doubleAt(const char* name, size_t len, double* value);
393 static bool doubleAt(const char* name, double* value) { return doubleAt(name, strlen(name), value); }
394 static bool doubleAtPut(const char* name, size_t len, double* value, Flag::Flags origin);
395 static bool doubleAtPut(const char* name, double* value, Flag::Flags origin) { return doubleAtPut(name, strlen(name), value, origin); }
396
397 static bool ccstrAt(const char* name, size_t len, ccstr* value);
398 static bool ccstrAt(const char* name, ccstr* value) { return ccstrAt(name, strlen(name), value); }
399 // Contract: Flag will make private copy of the incoming value.
400 // Outgoing value is always malloc-ed, and caller MUST call free.
401 static bool ccstrAtPut(const char* name, size_t len, ccstr* value, Flag::Flags origin);
402 static bool ccstrAtPut(const char* name, ccstr* value, Flag::Flags origin) { return ccstrAtPut(name, strlen(name), value, origin); }
403
404 // Returns false if name is not a command line flag.
405 static bool wasSetOnCmdline(const char* name, bool* value);
406 static void printSetFlags(outputStream* out);
407
408 static void printFlags(outputStream* out, bool withComments);
409
410 static void verify() PRODUCT_RETURN;
411 };
412
413 // use this for flags that are true by default in the debug version but
414 // false in the optimized version, and vice versa
415 #ifdef ASSERT
416 #define trueInDebug true
417 #define falseInDebug false
418 #else
|
352 class UIntFlagSetting {
353 uintx val;
354 uintx* flag;
355 public:
356 UIntFlagSetting(uintx& fl, uintx newValue) { flag = &fl; val = fl; fl = newValue; }
357 ~UIntFlagSetting() { *flag = val; }
358 };
359
360
361 class DoubleFlagSetting {
362 double val;
363 double* flag;
364 public:
365 DoubleFlagSetting(double& fl, double newValue) { flag = &fl; val = fl; fl = newValue; }
366 ~DoubleFlagSetting() { *flag = val; }
367 };
368
369
370 class CommandLineFlags {
371 public:
372 static bool boolAt(const char* name, size_t len, bool* value, bool allow_locked = false, bool return_flag = false);
373 static bool boolAt(const char* name, bool* value, bool allow_locked = false, bool return_flag = false) { return boolAt(name, strlen(name), value, allow_locked, return_flag); }
374 static bool boolAtPut(const char* name, size_t len, bool* value, Flag::Flags origin);
375 static bool boolAtPut(const char* name, bool* value, Flag::Flags origin) { return boolAtPut(name, strlen(name), value, origin); }
376
377 static bool intxAt(const char* name, size_t len, intx* value, bool allow_locked = false, bool return_flag = false);
378 static bool intxAt(const char* name, intx* value, bool allow_locked = false, bool return_flag = false) { return intxAt(name, strlen(name), value, allow_locked, return_flag); }
379 static bool intxAtPut(const char* name, size_t len, intx* value, Flag::Flags origin);
380 static bool intxAtPut(const char* name, intx* value, Flag::Flags origin) { return intxAtPut(name, strlen(name), value, origin); }
381
382 static bool uintxAt(const char* name, size_t len, uintx* value, bool allow_locked = false, bool return_flag = false);
383 static bool uintxAt(const char* name, uintx* value, bool allow_locked = false, bool return_flag = false) { return uintxAt(name, strlen(name), value, allow_locked, return_flag); }
384 static bool uintxAtPut(const char* name, size_t len, uintx* value, Flag::Flags origin);
385 static bool uintxAtPut(const char* name, uintx* value, Flag::Flags origin) { return uintxAtPut(name, strlen(name), value, origin); }
386
387 static bool uint64_tAt(const char* name, size_t len, uint64_t* value, bool allow_locked = false, bool return_flag = false);
388 static bool uint64_tAt(const char* name, uint64_t* value, bool allow_locked = false, bool return_flag = false) { return uint64_tAt(name, strlen(name), value, allow_locked, return_flag); }
389 static bool uint64_tAtPut(const char* name, size_t len, uint64_t* value, Flag::Flags origin);
390 static bool uint64_tAtPut(const char* name, uint64_t* value, Flag::Flags origin) { return uint64_tAtPut(name, strlen(name), value, origin); }
391
392 static bool doubleAt(const char* name, size_t len, double* value, bool allow_locked = false, bool return_flag = false);
393 static bool doubleAt(const char* name, double* value, bool allow_locked = false, bool return_flag = false) { return doubleAt(name, strlen(name), value, allow_locked, return_flag); }
394 static bool doubleAtPut(const char* name, size_t len, double* value, Flag::Flags origin);
395 static bool doubleAtPut(const char* name, double* value, Flag::Flags origin) { return doubleAtPut(name, strlen(name), value, origin); }
396
397 static bool ccstrAt(const char* name, size_t len, ccstr* value, bool allow_locked = false, bool return_flag = false);
398 static bool ccstrAt(const char* name, ccstr* value, bool allow_locked = false, bool return_flag = false) { return ccstrAt(name, strlen(name), value, allow_locked, return_flag); }
399 // Contract: Flag will make private copy of the incoming value.
400 // Outgoing value is always malloc-ed, and caller MUST call free.
401 static bool ccstrAtPut(const char* name, size_t len, ccstr* value, Flag::Flags origin);
402 static bool ccstrAtPut(const char* name, ccstr* value, Flag::Flags origin) { return ccstrAtPut(name, strlen(name), value, origin); }
403
404 // Returns false if name is not a command line flag.
405 static bool wasSetOnCmdline(const char* name, bool* value);
406 static void printSetFlags(outputStream* out);
407
408 static void printFlags(outputStream* out, bool withComments);
409
410 static void verify() PRODUCT_RETURN;
411 };
412
413 // use this for flags that are true by default in the debug version but
414 // false in the optimized version, and vice versa
415 #ifdef ASSERT
416 #define trueInDebug true
417 #define falseInDebug false
418 #else
|