src/share/vm/runtime/commandLineFlagConstraintList.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/src/share/vm/runtime/commandLineFlagConstraintList.cpp	Fri Aug  7 10:29:21 2015
--- new/src/share/vm/runtime/commandLineFlagConstraintList.cpp	Fri Aug  7 10:29:21 2015

*** 43,54 **** --- 43,54 ---- CommandLineFlagConstraintFunc_bool func, ConstraintType type) : CommandLineFlagConstraint(name, type) { _constraint=func; } - Flag::Error apply_bool(bool* value, bool verbose) { ! return _constraint(verbose, value); ! return _constraint(value, verbose); } }; class CommandLineFlagConstraint_int : public CommandLineFlagConstraint { CommandLineFlagConstraintFunc_int _constraint;
*** 59,70 **** --- 59,70 ---- CommandLineFlagConstraintFunc_int func, ConstraintType type) : CommandLineFlagConstraint(name, type) { _constraint=func; } - Flag::Error apply_int(int* value, bool verbose) { ! return _constraint(verbose, value); ! return _constraint(value, verbose); } }; class CommandLineFlagConstraint_intx : public CommandLineFlagConstraint { CommandLineFlagConstraintFunc_intx _constraint;
*** 75,86 **** --- 75,86 ---- CommandLineFlagConstraintFunc_intx func, ConstraintType type) : CommandLineFlagConstraint(name, type) { _constraint=func; } - Flag::Error apply_intx(intx* value, bool verbose) { ! return _constraint(verbose, value); ! return _constraint(value, verbose); } }; class CommandLineFlagConstraint_uint : public CommandLineFlagConstraint { CommandLineFlagConstraintFunc_uint _constraint;
*** 91,102 **** --- 91,102 ---- CommandLineFlagConstraintFunc_uint func, ConstraintType type) : CommandLineFlagConstraint(name, type) { _constraint=func; } - Flag::Error apply_uint(uint* value, bool verbose) { ! return _constraint(verbose, value); ! return _constraint(value, verbose); } }; class CommandLineFlagConstraint_uintx : public CommandLineFlagConstraint { CommandLineFlagConstraintFunc_uintx _constraint;
*** 107,118 **** --- 107,118 ---- CommandLineFlagConstraintFunc_uintx func, ConstraintType type) : CommandLineFlagConstraint(name, type) { _constraint=func; } - Flag::Error apply_uintx(uintx* value, bool verbose) { ! return _constraint(verbose, value); ! return _constraint(value, verbose); } }; class CommandLineFlagConstraint_uint64_t : public CommandLineFlagConstraint { CommandLineFlagConstraintFunc_uint64_t _constraint;
*** 123,134 **** --- 123,134 ---- CommandLineFlagConstraintFunc_uint64_t func, ConstraintType type) : CommandLineFlagConstraint(name, type) { _constraint=func; } - Flag::Error apply_uint64_t(uint64_t* value, bool verbose) { ! return _constraint(verbose, value); ! return _constraint(value, verbose); } }; class CommandLineFlagConstraint_size_t : public CommandLineFlagConstraint { CommandLineFlagConstraintFunc_size_t _constraint;
*** 139,150 **** --- 139,150 ---- CommandLineFlagConstraintFunc_size_t func, ConstraintType type) : CommandLineFlagConstraint(name, type) { _constraint=func; } - Flag::Error apply_size_t(size_t* value, bool verbose) { ! return _constraint(verbose, value); ! return _constraint(value, verbose); } }; class CommandLineFlagConstraint_double : public CommandLineFlagConstraint { CommandLineFlagConstraintFunc_double _constraint;
*** 155,166 **** --- 155,166 ---- CommandLineFlagConstraintFunc_double func, ConstraintType type) : CommandLineFlagConstraint(name, type) { _constraint=func; } - Flag::Error apply_double(double* value, bool verbose) { ! return _constraint(verbose, value); ! return _constraint(value, verbose); } }; // No constraint emitting void emit_constraint_no(...) { /* NOP */ }
*** 224,234 **** --- 224,233 ---- GrowableArray<CommandLineFlagConstraint*>* CommandLineFlagConstraintList::_constraints = NULL; CommandLineFlagConstraint::ConstraintType CommandLineFlagConstraintList::_validating_type = CommandLineFlagConstraint::AtParse; // Check the ranges of all flags that have them or print them out and exit if requested void CommandLineFlagConstraintList::init(void) { _constraints = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<CommandLineFlagConstraint*>(INITIAL_CONSTRAINTS_SIZE, true); emit_constraint_no(NULL RUNTIME_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG, EMIT_CONSTRAINT_PD_DEVELOPER_FLAG, EMIT_CONSTRAINT_PRODUCT_FLAG,
*** 304,378 **** --- 303,346 ---- return found; } // Check constraints for specific constraint type. bool CommandLineFlagConstraintList::check_constraints(CommandLineFlagConstraint::ConstraintType type) { //#define PRINT_CONSTRAINTS_SIZES #ifdef PRINT_CONSTRAINTS_SIZES { size_t size_constraints = sizeof(CommandLineFlagConstraintList); for (int i=0; i<length(); i++) { size_constraints += sizeof(CommandLineFlagConstraint); CommandLineFlagConstraint* constraint = at(i); const char* name = constraint->name(); Flag* flag = Flag::find_flag(name, strlen(name), true, true); if (flag->is_bool()) { size_constraints += sizeof(CommandLineFlagConstraintFunc_bool); size_constraints += sizeof(CommandLineFlagConstraint*); } else if (flag->is_intx()) { size_constraints += sizeof(CommandLineFlagConstraintFunc_intx); size_constraints += sizeof(CommandLineFlagConstraint*); } else if (flag->is_uintx()) { size_constraints += sizeof(CommandLineFlagConstraintFunc_uintx); size_constraints += sizeof(CommandLineFlagConstraint*); } else if (flag->is_uint64_t()) { size_constraints += sizeof(CommandLineFlagConstraintFunc_uint64_t); size_constraints += sizeof(CommandLineFlagConstraint*); } else if (flag->is_size_t()) { size_constraints += sizeof(CommandLineFlagConstraintFunc_size_t); size_constraints += sizeof(CommandLineFlagConstraint*); } else if (flag->is_double()) { size_constraints += sizeof(CommandLineFlagConstraintFunc_double); size_constraints += sizeof(CommandLineFlagConstraint*); } } fprintf(stderr, "Size of %d constraints: " SIZE_FORMAT " bytes\n", length(), size_constraints); } #endif // PRINT_CONSTRAINTS_SIZES // Skip if we already checked. if (type < _validating_type) { return true; } _validating_type = type; bool status = true; for (int i=0; i<length(); i++) { CommandLineFlagConstraint* constraint = at(i); if (type != constraint->type()) continue; ! const char* name = constraint->name(); Flag* flag = Flag::find_flag(name, strlen(name), true, true); + // We must check for NULL here as lp64_product flags on 32 bit architecture + // can generate constraint check (despite that they are declared as constants), + // but they will not be returned by Flag::find_flag() if (flag != NULL) { if (flag->is_bool()) { bool value = flag->get_bool(); - if (constraint->apply_bool(&value, true) != Flag::SUCCESS) status = false; } else if (flag->is_intx()) { intx value = flag->get_intx(); - if (constraint->apply_intx(&value, true) != Flag::SUCCESS) status = false; } else if (flag->is_uintx()) { uintx value = flag->get_uintx(); - if (constraint->apply_uintx(&value, true) != Flag::SUCCESS) status = false; } else if (flag->is_uint64_t()) { uint64_t value = flag->get_uint64_t(); - if (constraint->apply_uint64_t(&value, true) != Flag::SUCCESS) status = false; } else if (flag->is_size_t()) { size_t value = flag->get_size_t(); - if (constraint->apply_size_t(&value, true) != Flag::SUCCESS) status = false; } else if (flag->is_double()) { double value = flag->get_double(); - if (constraint->apply_double(&value, true) != Flag::SUCCESS) status = false; } } } return status; }

src/share/vm/runtime/commandLineFlagConstraintList.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File