src/share/vm/runtime/commandLineFlagRangeList.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 8059557_rev2_to_rev3 Sdiff src/share/vm/runtime

src/share/vm/runtime/commandLineFlagRangeList.hpp

Print this page




  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_RUNTIME_COMMANDLINEFLAGRANGELIST_HPP
  26 #define SHARE_VM_RUNTIME_COMMANDLINEFLAGRANGELIST_HPP
  27 
  28 #include "runtime/globals.hpp"
  29 #include "utilities/growableArray.hpp"
  30 
  31 /*
  32  * Here we have a mechanism for extracting ranges specified in flag macro tables.
  33  *
  34  * The specified ranges are used to verify that flags have valid values.
  35  *
  36  * An example of a range is "min <= flag <= max". Both "min" and "max" must be
  37  * constant and can not change. If either "min" or "max" can change,
  38  * then we need to use constraint instead.
  39  */
  40 
  41 class CommandLineFlagRange : public CHeapObj<mtInternal> {
  42 public:
  43   const char* _name;


  44   CommandLineFlagRange(const char* name) { _name=name; }
  45   ~CommandLineFlagRange() {}
  46   const char* name() { return _name; }
  47   virtual Flag::Error check_int(int value, bool verbose = true) { return Flag::SUCCESS; }
  48   virtual Flag::Error check_intx(intx value, bool verbose = true) { return Flag::SUCCESS; }
  49   virtual Flag::Error check_uint(uint value, bool verbose = true) { return Flag::SUCCESS; }
  50   virtual Flag::Error check_uintx(uintx value, bool verbose = true) { return Flag::SUCCESS; }
  51   virtual Flag::Error check_uint64_t(uint64_t value, bool verbose = true) { return Flag::SUCCESS; }
  52   virtual Flag::Error check_size_t(size_t value, bool verbose = true) { return Flag::SUCCESS; }
  53   virtual Flag::Error check_double(double value, bool verbose = true) { return Flag::SUCCESS; }
  54   virtual void print(outputStream* st) { ; }
  55 };
  56 
  57 class CommandLineFlagRangeList : public CHeapObj<mtInternal> {
  58   static GrowableArray<CommandLineFlagRange*>* _ranges;
  59 public:
  60   static void init();
  61   static void add_globals_ext();
  62   static int length() { return (_ranges != NULL) ? _ranges->length() : 0; }
  63   static CommandLineFlagRange* at(int i) { return (_ranges != NULL) ? _ranges->at(i) : NULL; }
  64   static CommandLineFlagRange* find(const char* name);
  65   static void add(CommandLineFlagRange* range) { _ranges->append(range); }
  66   static void print(const char* name, outputStream* st, bool unspecified = false);
  67 };
  68 
  69 #endif // SHARE_VM_RUNTIME_COMMANDLINEFLAGRANGELIST_HPP


  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_RUNTIME_COMMANDLINEFLAGRANGELIST_HPP
  26 #define SHARE_VM_RUNTIME_COMMANDLINEFLAGRANGELIST_HPP
  27 
  28 #include "runtime/globals.hpp"
  29 #include "utilities/growableArray.hpp"
  30 
  31 /*
  32  * Here we have a mechanism for extracting ranges specified in flag macro tables.
  33  *
  34  * The specified ranges are used to verify that flags have valid values.
  35  *
  36  * An example of a range is "min <= flag <= max". Both "min" and "max" must be
  37  * constant and can not change. If either "min" or "max" can change,
  38  * then we need to use constraint instead.
  39  */
  40 
  41 class CommandLineFlagRange : public CHeapObj<mtInternal> {
  42 private:
  43   const char* _name;
  44 public:
  45   // the "name" argument must be a string literal
  46   CommandLineFlagRange(const char* name) { _name=name; }
  47   ~CommandLineFlagRange() {}
  48   const char* name() { return _name; }
  49   virtual Flag::Error check_int(int value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; }
  50   virtual Flag::Error check_intx(intx value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; }
  51   virtual Flag::Error check_uint(uint value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; }
  52   virtual Flag::Error check_uintx(uintx value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; }
  53   virtual Flag::Error check_uint64_t(uint64_t value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; }
  54   virtual Flag::Error check_size_t(size_t value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; }
  55   virtual Flag::Error check_double(double value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; }
  56   virtual void print(outputStream* st) { ; }
  57 };
  58 
  59 class CommandLineFlagRangeList : public AllStatic {
  60   static GrowableArray<CommandLineFlagRange*>* _ranges;
  61 public:
  62   static void init();
  63   static void add_globals_ext();
  64   static int length() { return (_ranges != NULL) ? _ranges->length() : 0; }
  65   static CommandLineFlagRange* at(int i) { return (_ranges != NULL) ? _ranges->at(i) : NULL; }
  66   static CommandLineFlagRange* find(const char* name);
  67   static void add(CommandLineFlagRange* range) { _ranges->append(range); }
  68   static void print(const char* name, outputStream* st, bool unspecified = false);
  69 };
  70 
  71 #endif // SHARE_VM_RUNTIME_COMMANDLINEFLAGRANGELIST_HPP
src/share/vm/runtime/commandLineFlagRangeList.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File