src/hotspot/share/runtime/flags/jvmFlagConstraintList.cpp
changeset 54982 b18c8301b8c2
parent 50708 bd3a8f48597e
child 57876 30db6422848b
child 58678 9cf78a70fa4f
equal deleted inserted replaced
54981:0b56fc0448ec 54982:b18c8301b8c2
    29 #include "runtime/arguments.hpp"
    29 #include "runtime/arguments.hpp"
    30 #include "runtime/flags/jvmFlag.hpp"
    30 #include "runtime/flags/jvmFlag.hpp"
    31 #include "runtime/flags/jvmFlagConstraintList.hpp"
    31 #include "runtime/flags/jvmFlagConstraintList.hpp"
    32 #include "runtime/flags/jvmFlagConstraintsCompiler.hpp"
    32 #include "runtime/flags/jvmFlagConstraintsCompiler.hpp"
    33 #include "runtime/flags/jvmFlagConstraintsRuntime.hpp"
    33 #include "runtime/flags/jvmFlagConstraintsRuntime.hpp"
       
    34 #include "runtime/globals.hpp"
    34 #include "runtime/os.hpp"
    35 #include "runtime/os.hpp"
    35 #include "utilities/macros.hpp"
    36 #include "utilities/macros.hpp"
    36 #ifdef COMPILER1
       
    37 #include "c1/c1_globals.hpp"
       
    38 #endif
       
    39 #ifdef COMPILER2
       
    40 #include "opto/c2_globals.hpp"
       
    41 #endif
       
    42 
    37 
    43 class JVMFlagConstraint_bool : public JVMFlagConstraint {
    38 class JVMFlagConstraint_bool : public JVMFlagConstraint {
    44   JVMFlagConstraintFunc_bool _constraint;
    39   JVMFlagConstraintFunc_bool _constraint;
    45   const bool* _ptr;
    40   const bool* _ptr;
    46 
    41 
   239 void emit_constraint_double(const char* name, const double* ptr, JVMFlagConstraintFunc_double func, JVMFlagConstraint::ConstraintType type) {
   234 void emit_constraint_double(const char* name, const double* ptr, JVMFlagConstraintFunc_double func, JVMFlagConstraint::ConstraintType type) {
   240   JVMFlagConstraintList::add(new JVMFlagConstraint_double(name, ptr, func, type));
   235   JVMFlagConstraintList::add(new JVMFlagConstraint_double(name, ptr, func, type));
   241 }
   236 }
   242 
   237 
   243 // Generate code to call emit_constraint_xxx function
   238 // Generate code to call emit_constraint_xxx function
   244 #define EMIT_CONSTRAINT_PRODUCT_FLAG(type, name, value, doc)      ); emit_constraint_##type(#name,&name
   239 #define EMIT_CONSTRAINT_START       (void)(0
   245 #define EMIT_CONSTRAINT_DIAGNOSTIC_FLAG(type, name, value, doc)   ); emit_constraint_##type(#name,&name
   240 #define EMIT_CONSTRAINT(type, name) ); emit_constraint_##type(#name, &name
   246 #define EMIT_CONSTRAINT_EXPERIMENTAL_FLAG(type, name, value, doc) ); emit_constraint_##type(#name,&name
   241 #define EMIT_CONSTRAINT_NO          ); emit_constraint_no(0
   247 #define EMIT_CONSTRAINT_MANAGEABLE_FLAG(type, name, value, doc)   ); emit_constraint_##type(#name,&name
   242 #define EMIT_CONSTRAINT_PRODUCT_FLAG(type, name, value, doc)      EMIT_CONSTRAINT(type, name)
   248 #define EMIT_CONSTRAINT_PRODUCT_RW_FLAG(type, name, value, doc)   ); emit_constraint_##type(#name,&name
   243 #define EMIT_CONSTRAINT_DIAGNOSTIC_FLAG(type, name, value, doc)   EMIT_CONSTRAINT(type, name)
   249 #define EMIT_CONSTRAINT_PD_PRODUCT_FLAG(type, name, doc)          ); emit_constraint_##type(#name,&name
   244 #define EMIT_CONSTRAINT_EXPERIMENTAL_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name)
   250 #define EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG(type, name, doc)       ); emit_constraint_##type(#name,&name
   245 #define EMIT_CONSTRAINT_MANAGEABLE_FLAG(type, name, value, doc)   EMIT_CONSTRAINT(type, name)
       
   246 #define EMIT_CONSTRAINT_PRODUCT_RW_FLAG(type, name, value, doc)   EMIT_CONSTRAINT(type, name)
       
   247 #define EMIT_CONSTRAINT_PD_PRODUCT_FLAG(type, name, doc)          EMIT_CONSTRAINT(type, name)
       
   248 #define EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG(type, name, doc)       EMIT_CONSTRAINT(type, name)
   251 #ifndef PRODUCT
   249 #ifndef PRODUCT
   252 #define EMIT_CONSTRAINT_DEVELOPER_FLAG(type, name, value, doc)    ); emit_constraint_##type(#name,&name
   250 #define EMIT_CONSTRAINT_DEVELOPER_FLAG(type, name, value, doc)    EMIT_CONSTRAINT(type, name)
   253 #define EMIT_CONSTRAINT_PD_DEVELOPER_FLAG(type, name, doc)        ); emit_constraint_##type(#name,&name
   251 #define EMIT_CONSTRAINT_PD_DEVELOPER_FLAG(type, name, doc)        EMIT_CONSTRAINT(type, name)
   254 #define EMIT_CONSTRAINT_NOTPRODUCT_FLAG(type, name, value, doc)   ); emit_constraint_##type(#name,&name
   252 #define EMIT_CONSTRAINT_NOTPRODUCT_FLAG(type, name, value, doc)   EMIT_CONSTRAINT(type, name)
   255 #else
   253 #else
   256 #define EMIT_CONSTRAINT_DEVELOPER_FLAG(type, name, value, doc)    ); emit_constraint_no(#name,&name
   254 #define EMIT_CONSTRAINT_DEVELOPER_FLAG(type, name, value, doc)    EMIT_CONSTRAINT_NO
   257 #define EMIT_CONSTRAINT_PD_DEVELOPER_FLAG(type, name, doc)        ); emit_constraint_no(#name,&name
   255 #define EMIT_CONSTRAINT_PD_DEVELOPER_FLAG(type, name, doc)        EMIT_CONSTRAINT_NO
   258 #define EMIT_CONSTRAINT_NOTPRODUCT_FLAG(type, name, value, doc)   ); emit_constraint_no(#name,&name
   256 #define EMIT_CONSTRAINT_NOTPRODUCT_FLAG(type, name, value, doc)   EMIT_CONSTRAINT_NO
   259 #endif
   257 #endif
   260 #ifdef _LP64
   258 #ifdef _LP64
   261 #define EMIT_CONSTRAINT_LP64_PRODUCT_FLAG(type, name, value, doc) ); emit_constraint_##type(#name,&name
   259 #define EMIT_CONSTRAINT_LP64_PRODUCT_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name)
   262 #else
   260 #else
   263 #define EMIT_CONSTRAINT_LP64_PRODUCT_FLAG(type, name, value, doc) ); emit_constraint_no(#name,&name
   261 #define EMIT_CONSTRAINT_LP64_PRODUCT_FLAG(type, name, value, doc) EMIT_CONSTRAINT_NO
   264 #endif
   262 #endif
       
   263 #define EMIT_CONSTRAINT_END         );
   265 
   264 
   266 // Generate func argument to pass into emit_constraint_xxx functions
   265 // Generate func argument to pass into emit_constraint_xxx functions
   267 #define EMIT_CONSTRAINT_CHECK(func, type)                         , func, JVMFlagConstraint::type
   266 #define EMIT_CONSTRAINT_CHECK(func, type)                         , func, JVMFlagConstraint::type
   268 
   267 
   269 // the "name" argument must be a string literal
   268 // the "name" argument must be a string literal
   273 
   272 
   274 // Check the ranges of all flags that have them or print them out and exit if requested
   273 // Check the ranges of all flags that have them or print them out and exit if requested
   275 void JVMFlagConstraintList::init(void) {
   274 void JVMFlagConstraintList::init(void) {
   276   _constraints = new (ResourceObj::C_HEAP, mtArguments) GrowableArray<JVMFlagConstraint*>(INITIAL_CONSTRAINTS_SIZE, true);
   275   _constraints = new (ResourceObj::C_HEAP, mtArguments) GrowableArray<JVMFlagConstraint*>(INITIAL_CONSTRAINTS_SIZE, true);
   277 
   276 
   278   emit_constraint_no(NULL VM_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
   277   EMIT_CONSTRAINT_START
   279                                    EMIT_CONSTRAINT_PD_DEVELOPER_FLAG,
   278 
   280                                    EMIT_CONSTRAINT_PRODUCT_FLAG,
   279   ALL_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
   281                                    EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
   280             EMIT_CONSTRAINT_PD_DEVELOPER_FLAG,
   282                                    EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
   281             EMIT_CONSTRAINT_PRODUCT_FLAG,
   283                                    EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG,
   282             EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
   284                                    EMIT_CONSTRAINT_EXPERIMENTAL_FLAG,
   283             EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
   285                                    EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
   284             EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG,
   286                                    EMIT_CONSTRAINT_MANAGEABLE_FLAG,
   285             EMIT_CONSTRAINT_EXPERIMENTAL_FLAG,
   287                                    EMIT_CONSTRAINT_PRODUCT_RW_FLAG,
   286             EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
   288                                    EMIT_CONSTRAINT_LP64_PRODUCT_FLAG,
   287             EMIT_CONSTRAINT_MANAGEABLE_FLAG,
   289                                    IGNORE_RANGE,
   288             EMIT_CONSTRAINT_PRODUCT_RW_FLAG,
   290                                    EMIT_CONSTRAINT_CHECK,
   289             EMIT_CONSTRAINT_LP64_PRODUCT_FLAG,
   291                                    IGNORE_WRITEABLE));
   290             IGNORE_RANGE,
       
   291             EMIT_CONSTRAINT_CHECK,
       
   292             IGNORE_WRITEABLE)
   292 
   293 
   293   EMIT_CONSTRAINTS_FOR_GLOBALS_EXT
   294   EMIT_CONSTRAINTS_FOR_GLOBALS_EXT
   294 
   295 
   295   emit_constraint_no(NULL ARCH_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
   296   EMIT_CONSTRAINT_END
   296                                      EMIT_CONSTRAINT_PRODUCT_FLAG,
       
   297                                      EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
       
   298                                      EMIT_CONSTRAINT_EXPERIMENTAL_FLAG,
       
   299                                      EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
       
   300                                      IGNORE_RANGE,
       
   301                                      EMIT_CONSTRAINT_CHECK,
       
   302                                      IGNORE_WRITEABLE));
       
   303 
       
   304 
       
   305 #ifdef COMPILER1
       
   306   emit_constraint_no(NULL C1_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
       
   307                                    EMIT_CONSTRAINT_PD_DEVELOPER_FLAG,
       
   308                                    EMIT_CONSTRAINT_PRODUCT_FLAG,
       
   309                                    EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
       
   310                                    EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
       
   311                                    EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG,
       
   312                                    EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
       
   313                                    IGNORE_RANGE,
       
   314                                    EMIT_CONSTRAINT_CHECK,
       
   315                                    IGNORE_WRITEABLE));
       
   316 #endif // COMPILER1
       
   317 
       
   318 #ifdef COMPILER2
       
   319   emit_constraint_no(NULL C2_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
       
   320                                    EMIT_CONSTRAINT_PD_DEVELOPER_FLAG,
       
   321                                    EMIT_CONSTRAINT_PRODUCT_FLAG,
       
   322                                    EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
       
   323                                    EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
       
   324                                    EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG,
       
   325                                    EMIT_CONSTRAINT_EXPERIMENTAL_FLAG,
       
   326                                    EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
       
   327                                    IGNORE_RANGE,
       
   328                                    EMIT_CONSTRAINT_CHECK,
       
   329                                    IGNORE_WRITEABLE));
       
   330 #endif // COMPILER2
       
   331 }
   297 }
   332 
   298 
   333 JVMFlagConstraint* JVMFlagConstraintList::find(const char* name) {
   299 JVMFlagConstraint* JVMFlagConstraintList::find(const char* name) {
   334   JVMFlagConstraint* found = NULL;
   300   JVMFlagConstraint* found = NULL;
   335   for (int i=0; i<length(); i++) {
   301   for (int i=0; i<length(); i++) {