src/share/vm/runtime/commandLineFlagConstraintList.cpp

Print this page
rev 11264 : 8150900: Implement diagnostic_pd
Reviewed-by: twisti, gziemski, kevinw


 194   CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_uintx(name, func, type));
 195 }
 196 void emit_constraint_uint64_t(const char* name, CommandLineFlagConstraintFunc_uint64_t func, CommandLineFlagConstraint::ConstraintType type) {
 197   CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_uint64_t(name, func, type));
 198 }
 199 void emit_constraint_size_t(const char* name, CommandLineFlagConstraintFunc_size_t func, CommandLineFlagConstraint::ConstraintType type) {
 200   CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_size_t(name, func, type));
 201 }
 202 void emit_constraint_double(const char* name, CommandLineFlagConstraintFunc_double func, CommandLineFlagConstraint::ConstraintType type) {
 203   CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_double(name, func, type));
 204 }
 205 
 206 // Generate code to call emit_constraint_xxx function
 207 #define EMIT_CONSTRAINT_PRODUCT_FLAG(type, name, value, doc)      ); emit_constraint_##type(#name
 208 #define EMIT_CONSTRAINT_COMMERCIAL_FLAG(type, name, value, doc)   ); emit_constraint_##type(#name
 209 #define EMIT_CONSTRAINT_DIAGNOSTIC_FLAG(type, name, value, doc)   ); emit_constraint_##type(#name
 210 #define EMIT_CONSTRAINT_EXPERIMENTAL_FLAG(type, name, value, doc) ); emit_constraint_##type(#name
 211 #define EMIT_CONSTRAINT_MANAGEABLE_FLAG(type, name, value, doc)   ); emit_constraint_##type(#name
 212 #define EMIT_CONSTRAINT_PRODUCT_RW_FLAG(type, name, value, doc)   ); emit_constraint_##type(#name
 213 #define EMIT_CONSTRAINT_PD_PRODUCT_FLAG(type, name, doc)          ); emit_constraint_##type(#name

 214 #define EMIT_CONSTRAINT_DEVELOPER_FLAG(type, name, value, doc)    ); emit_constraint_##type(#name
 215 #define EMIT_CONSTRAINT_PD_DEVELOPER_FLAG(type, name, doc)        ); emit_constraint_##type(#name
 216 #define EMIT_CONSTRAINT_NOTPRODUCT_FLAG(type, name, value, doc)   ); emit_constraint_##type(#name
 217 #define EMIT_CONSTRAINT_LP64_PRODUCT_FLAG(type, name, value, doc) ); emit_constraint_##type(#name
 218 
 219 // Generate func argument to pass into emit_constraint_xxx functions
 220 #define EMIT_CONSTRAINT_CHECK(func, type)                         , func, CommandLineFlagConstraint::type
 221 
 222 // the "name" argument must be a string literal
 223 #define INITIAL_CONSTRAINTS_SIZE 72
 224 GrowableArray<CommandLineFlagConstraint*>* CommandLineFlagConstraintList::_constraints = NULL;
 225 CommandLineFlagConstraint::ConstraintType CommandLineFlagConstraintList::_validating_type = CommandLineFlagConstraint::AtParse;
 226 
 227 // Check the ranges of all flags that have them or print them out and exit if requested
 228 void CommandLineFlagConstraintList::init(void) {
 229   _constraints = new (ResourceObj::C_HEAP, mtArguments) GrowableArray<CommandLineFlagConstraint*>(INITIAL_CONSTRAINTS_SIZE, true);
 230 
 231   emit_constraint_no(NULL RUNTIME_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
 232                                         EMIT_CONSTRAINT_PD_DEVELOPER_FLAG,
 233                                         EMIT_CONSTRAINT_PRODUCT_FLAG,
 234                                         EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
 235                                         EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,

 236                                         EMIT_CONSTRAINT_EXPERIMENTAL_FLAG,
 237                                         EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
 238                                         EMIT_CONSTRAINT_MANAGEABLE_FLAG,
 239                                         EMIT_CONSTRAINT_PRODUCT_RW_FLAG,
 240                                         EMIT_CONSTRAINT_LP64_PRODUCT_FLAG,
 241                                         IGNORE_RANGE,
 242                                         EMIT_CONSTRAINT_CHECK,
 243                                         IGNORE_WRITEABLE));
 244 
 245   EMIT_CONSTRAINTS_FOR_GLOBALS_EXT
 246 
 247   emit_constraint_no(NULL ARCH_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
 248                                      EMIT_CONSTRAINT_PRODUCT_FLAG,
 249                                      EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
 250                                      EMIT_CONSTRAINT_EXPERIMENTAL_FLAG,
 251                                      EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
 252                                      IGNORE_RANGE,
 253                                      EMIT_CONSTRAINT_CHECK,
 254                                      IGNORE_WRITEABLE));
 255 
 256 
 257 #ifdef COMPILER1
 258   emit_constraint_no(NULL C1_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
 259                                    EMIT_CONSTRAINT_PD_DEVELOPER_FLAG,
 260                                    EMIT_CONSTRAINT_PRODUCT_FLAG,
 261                                    EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
 262                                    EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,

 263                                    EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
 264                                    IGNORE_RANGE,
 265                                    EMIT_CONSTRAINT_CHECK,
 266                                    IGNORE_WRITEABLE));
 267 #endif // COMPILER1
 268 
 269 #ifdef COMPILER2
 270   emit_constraint_no(NULL C2_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
 271                                    EMIT_CONSTRAINT_PD_DEVELOPER_FLAG,
 272                                    EMIT_CONSTRAINT_PRODUCT_FLAG,
 273                                    EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
 274                                    EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,

 275                                    EMIT_CONSTRAINT_EXPERIMENTAL_FLAG,
 276                                    EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
 277                                    IGNORE_RANGE,
 278                                    EMIT_CONSTRAINT_CHECK,
 279                                    IGNORE_WRITEABLE));
 280 #endif // COMPILER2
 281 
 282 #if INCLUDE_ALL_GCS
 283   emit_constraint_no(NULL G1_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
 284                                    EMIT_CONSTRAINT_PD_DEVELOPER_FLAG,
 285                                    EMIT_CONSTRAINT_PRODUCT_FLAG,
 286                                    EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
 287                                    EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,

 288                                    EMIT_CONSTRAINT_EXPERIMENTAL_FLAG,
 289                                    EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
 290                                    EMIT_CONSTRAINT_MANAGEABLE_FLAG,
 291                                    EMIT_CONSTRAINT_PRODUCT_RW_FLAG,
 292                                    IGNORE_RANGE,
 293                                    EMIT_CONSTRAINT_CHECK,
 294                                    IGNORE_WRITEABLE));
 295 #endif // INCLUDE_ALL_GCS
 296 }
 297 
 298 CommandLineFlagConstraint* CommandLineFlagConstraintList::find(const char* name) {
 299   CommandLineFlagConstraint* found = NULL;
 300   for (int i=0; i<length(); i++) {
 301     CommandLineFlagConstraint* constraint = at(i);
 302     if (strcmp(constraint->name(), name) == 0) {
 303       found = constraint;
 304       break;
 305     }
 306   }
 307   return found;




 194   CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_uintx(name, func, type));
 195 }
 196 void emit_constraint_uint64_t(const char* name, CommandLineFlagConstraintFunc_uint64_t func, CommandLineFlagConstraint::ConstraintType type) {
 197   CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_uint64_t(name, func, type));
 198 }
 199 void emit_constraint_size_t(const char* name, CommandLineFlagConstraintFunc_size_t func, CommandLineFlagConstraint::ConstraintType type) {
 200   CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_size_t(name, func, type));
 201 }
 202 void emit_constraint_double(const char* name, CommandLineFlagConstraintFunc_double func, CommandLineFlagConstraint::ConstraintType type) {
 203   CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_double(name, func, type));
 204 }
 205 
 206 // Generate code to call emit_constraint_xxx function
 207 #define EMIT_CONSTRAINT_PRODUCT_FLAG(type, name, value, doc)      ); emit_constraint_##type(#name
 208 #define EMIT_CONSTRAINT_COMMERCIAL_FLAG(type, name, value, doc)   ); emit_constraint_##type(#name
 209 #define EMIT_CONSTRAINT_DIAGNOSTIC_FLAG(type, name, value, doc)   ); emit_constraint_##type(#name
 210 #define EMIT_CONSTRAINT_EXPERIMENTAL_FLAG(type, name, value, doc) ); emit_constraint_##type(#name
 211 #define EMIT_CONSTRAINT_MANAGEABLE_FLAG(type, name, value, doc)   ); emit_constraint_##type(#name
 212 #define EMIT_CONSTRAINT_PRODUCT_RW_FLAG(type, name, value, doc)   ); emit_constraint_##type(#name
 213 #define EMIT_CONSTRAINT_PD_PRODUCT_FLAG(type, name, doc)          ); emit_constraint_##type(#name
 214 #define EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG(type, name, doc)       ); emit_constraint_##type(#name
 215 #define EMIT_CONSTRAINT_DEVELOPER_FLAG(type, name, value, doc)    ); emit_constraint_##type(#name
 216 #define EMIT_CONSTRAINT_PD_DEVELOPER_FLAG(type, name, doc)        ); emit_constraint_##type(#name
 217 #define EMIT_CONSTRAINT_NOTPRODUCT_FLAG(type, name, value, doc)   ); emit_constraint_##type(#name
 218 #define EMIT_CONSTRAINT_LP64_PRODUCT_FLAG(type, name, value, doc) ); emit_constraint_##type(#name
 219 
 220 // Generate func argument to pass into emit_constraint_xxx functions
 221 #define EMIT_CONSTRAINT_CHECK(func, type)                         , func, CommandLineFlagConstraint::type
 222 
 223 // the "name" argument must be a string literal
 224 #define INITIAL_CONSTRAINTS_SIZE 72
 225 GrowableArray<CommandLineFlagConstraint*>* CommandLineFlagConstraintList::_constraints = NULL;
 226 CommandLineFlagConstraint::ConstraintType CommandLineFlagConstraintList::_validating_type = CommandLineFlagConstraint::AtParse;
 227 
 228 // Check the ranges of all flags that have them or print them out and exit if requested
 229 void CommandLineFlagConstraintList::init(void) {
 230   _constraints = new (ResourceObj::C_HEAP, mtArguments) GrowableArray<CommandLineFlagConstraint*>(INITIAL_CONSTRAINTS_SIZE, true);
 231 
 232   emit_constraint_no(NULL RUNTIME_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
 233                                         EMIT_CONSTRAINT_PD_DEVELOPER_FLAG,
 234                                         EMIT_CONSTRAINT_PRODUCT_FLAG,
 235                                         EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
 236                                         EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
 237                                         EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG,
 238                                         EMIT_CONSTRAINT_EXPERIMENTAL_FLAG,
 239                                         EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
 240                                         EMIT_CONSTRAINT_MANAGEABLE_FLAG,
 241                                         EMIT_CONSTRAINT_PRODUCT_RW_FLAG,
 242                                         EMIT_CONSTRAINT_LP64_PRODUCT_FLAG,
 243                                         IGNORE_RANGE,
 244                                         EMIT_CONSTRAINT_CHECK,
 245                                         IGNORE_WRITEABLE));
 246 
 247   EMIT_CONSTRAINTS_FOR_GLOBALS_EXT
 248 
 249   emit_constraint_no(NULL ARCH_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
 250                                      EMIT_CONSTRAINT_PRODUCT_FLAG,
 251                                      EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
 252                                      EMIT_CONSTRAINT_EXPERIMENTAL_FLAG,
 253                                      EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
 254                                      IGNORE_RANGE,
 255                                      EMIT_CONSTRAINT_CHECK,
 256                                      IGNORE_WRITEABLE));
 257 
 258 
 259 #ifdef COMPILER1
 260   emit_constraint_no(NULL C1_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
 261                                    EMIT_CONSTRAINT_PD_DEVELOPER_FLAG,
 262                                    EMIT_CONSTRAINT_PRODUCT_FLAG,
 263                                    EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
 264                                    EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
 265                                    EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG,
 266                                    EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
 267                                    IGNORE_RANGE,
 268                                    EMIT_CONSTRAINT_CHECK,
 269                                    IGNORE_WRITEABLE));
 270 #endif // COMPILER1
 271 
 272 #ifdef COMPILER2
 273   emit_constraint_no(NULL C2_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
 274                                    EMIT_CONSTRAINT_PD_DEVELOPER_FLAG,
 275                                    EMIT_CONSTRAINT_PRODUCT_FLAG,
 276                                    EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
 277                                    EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
 278                                    EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG,
 279                                    EMIT_CONSTRAINT_EXPERIMENTAL_FLAG,
 280                                    EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
 281                                    IGNORE_RANGE,
 282                                    EMIT_CONSTRAINT_CHECK,
 283                                    IGNORE_WRITEABLE));
 284 #endif // COMPILER2
 285 
 286 #if INCLUDE_ALL_GCS
 287   emit_constraint_no(NULL G1_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
 288                                    EMIT_CONSTRAINT_PD_DEVELOPER_FLAG,
 289                                    EMIT_CONSTRAINT_PRODUCT_FLAG,
 290                                    EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
 291                                    EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
 292                                    EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG,
 293                                    EMIT_CONSTRAINT_EXPERIMENTAL_FLAG,
 294                                    EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
 295                                    EMIT_CONSTRAINT_MANAGEABLE_FLAG,
 296                                    EMIT_CONSTRAINT_PRODUCT_RW_FLAG,
 297                                    IGNORE_RANGE,
 298                                    EMIT_CONSTRAINT_CHECK,
 299                                    IGNORE_WRITEABLE));
 300 #endif // INCLUDE_ALL_GCS
 301 }
 302 
 303 CommandLineFlagConstraint* CommandLineFlagConstraintList::find(const char* name) {
 304   CommandLineFlagConstraint* found = NULL;
 305   for (int i=0; i<length(); i++) {
 306     CommandLineFlagConstraint* constraint = at(i);
 307     if (strcmp(constraint->name(), name) == 0) {
 308       found = constraint;
 309       break;
 310     }
 311   }
 312   return found;