< prev index next >
src/share/vm/runtime/commandLineFlagConstraintList.hpp
Print this page
*** 47,80 ****
typedef Flag::Error (*CommandLineFlagConstraintFunc_uint64_t)(bool verbose, uint64_t* value);
typedef Flag::Error (*CommandLineFlagConstraintFunc_size_t)(bool verbose, size_t* value);
typedef Flag::Error (*CommandLineFlagConstraintFunc_double)(bool verbose, double* value);
class CommandLineFlagConstraint : public CHeapObj<mtInternal> {
- private:
- const char* _name;
public:
// the "name" argument must be a string literal
! CommandLineFlagConstraint(const char* name) { _name=name; };
~CommandLineFlagConstraint() {};
const char* name() { return _name; }
virtual Flag::Error apply_bool(bool* value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; };
virtual Flag::Error apply_int(int* value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; };
virtual Flag::Error apply_intx(intx* value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; };
virtual Flag::Error apply_uint(uint* value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; };
virtual Flag::Error apply_uintx(uintx* value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; };
virtual Flag::Error apply_uint64_t(uint64_t* value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; };
virtual Flag::Error apply_size_t(size_t* value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; };
virtual Flag::Error apply_double(double* value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; };
};
class CommandLineFlagConstraintList : public AllStatic {
private:
static GrowableArray<CommandLineFlagConstraint*>* _constraints;
public:
static void init();
static int length() { return (_constraints != NULL) ? _constraints->length() : 0; }
static CommandLineFlagConstraint* at(int i) { return (_constraints != NULL) ? _constraints->at(i) : NULL; }
! static CommandLineFlagConstraint* find(const char* name);
static void add(CommandLineFlagConstraint* constraint) { _constraints->append(constraint); }
};
#endif /* SHARE_VM_RUNTIME_COMMANDLINEFLAGCONSTRAINTLIST_HPP */
--- 47,101 ----
typedef Flag::Error (*CommandLineFlagConstraintFunc_uint64_t)(bool verbose, uint64_t* value);
typedef Flag::Error (*CommandLineFlagConstraintFunc_size_t)(bool verbose, size_t* value);
typedef Flag::Error (*CommandLineFlagConstraintFunc_double)(bool verbose, double* value);
class CommandLineFlagConstraint : public CHeapObj<mtInternal> {
public:
+ // During VM initialization, constraint validation will be done order of ConstraintType.
+ enum ConstraintType {
+ // Will be validated during argument processing.
+ Anytime = 0,
+ // Will be validated by CommandLineFlags::check_ranges_and_constraints_of_after_parse().
+ AfterParse = 1,
+ // Will be validated by CommandLineFlags::check_constraints_of_after_memory_init().
+ AfterMemoryInit = 2
+ };
// the "name" argument must be a string literal
! CommandLineFlagConstraint(const char* name, ConstraintType type) { _name=name; _validate_type=type; };
~CommandLineFlagConstraint() {};
const char* name() { return _name; }
+ ConstraintType type() { return _validate_type; }
virtual Flag::Error apply_bool(bool* value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; };
virtual Flag::Error apply_int(int* value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; };
virtual Flag::Error apply_intx(intx* value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; };
virtual Flag::Error apply_uint(uint* value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; };
virtual Flag::Error apply_uintx(uintx* value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; };
virtual Flag::Error apply_uint64_t(uint64_t* value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; };
virtual Flag::Error apply_size_t(size_t* value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; };
virtual Flag::Error apply_double(double* value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; };
+
+ // Change a string literal to ConstraintType
+ static ConstraintType change_to_enum(const char* type);
+
+ private:
+ const char* _name;
+ ConstraintType _validate_type;
};
class CommandLineFlagConstraintList : public AllStatic {
private:
static GrowableArray<CommandLineFlagConstraint*>* _constraints;
+ // Latest constraint validation type.
+ static CommandLineFlagConstraint::ConstraintType _validationType;
public:
static void init();
static int length() { return (_constraints != NULL) ? _constraints->length() : 0; }
static CommandLineFlagConstraint* at(int i) { return (_constraints != NULL) ? _constraints->at(i) : NULL; }
! static CommandLineFlagConstraint* find_if_validated(const char* name);
static void add(CommandLineFlagConstraint* constraint) { _constraints->append(constraint); }
+ // True if 'AfterParse' or later constraint functions are validated.
+ static bool validatedAfterParse() { return _validationType >= CommandLineFlagConstraint::AfterParse; };
+ // Set current validation type
+ static void setValidatingType(CommandLineFlagConstraint::ConstraintType type) { _validationType = type; };
};
#endif /* SHARE_VM_RUNTIME_COMMANDLINEFLAGCONSTRAINTLIST_HPP */
< prev index next >