155 } 156 }; 157 158 class JVMFlagConstraint_double : public JVMFlagConstraint { 159 JVMFlagConstraintFunc_double _constraint; 160 161 public: 162 JVMFlagConstraint_double(const JVMFlag* flag, 163 JVMFlagConstraintFunc_double func, 164 ConstraintType type) : JVMFlagConstraint(flag, type), _constraint(func) {} 165 166 JVMFlag::Error apply(bool verbose) { 167 return _constraint(_flag->get_double(), verbose); 168 } 169 170 JVMFlag::Error apply_double(double value, bool verbose) { 171 return _constraint(value, verbose); 172 } 173 }; 174 175 // No constraint emitting 176 void emit_constraint_no(...) { /* NOP */ } 177 178 // No constraint emitting if function argument is NOT provided 179 void emit_constraint_bool(const JVMFlag* /*flag*/) { /* NOP */ } 180 void emit_constraint_ccstr(const JVMFlag* /*flag*/) { /* NOP */ } 181 void emit_constraint_ccstrlist(const JVMFlag* /*flag*/) { /* NOP */ } 182 void emit_constraint_int(const JVMFlag* /*flag*/) { /* NOP */ } 183 void emit_constraint_intx(const JVMFlag* /*flag*/) { /* NOP */ } 184 void emit_constraint_uint(const JVMFlag* /*flag*/) { /* NOP */ } 185 void emit_constraint_uintx(const JVMFlag* /*flag*/) { /* NOP */ } 186 void emit_constraint_uint64_t(const JVMFlag* /*flag*/) { /* NOP */ } 187 void emit_constraint_size_t(const JVMFlag* /*flag*/) { /* NOP */ } 188 void emit_constraint_double(const JVMFlag* /*flag*/) { /* NOP */ } 189 190 // JVMFlagConstraint emitting code functions if function argument is provided 191 void emit_constraint_bool(const JVMFlag* flag, JVMFlagConstraintFunc_bool func, JVMFlagConstraint::ConstraintType type) { 192 JVMFlagConstraintList::add(new JVMFlagConstraint_bool(flag, func, type)); 193 } 194 void emit_constraint_int(const JVMFlag* flag, JVMFlagConstraintFunc_int func, JVMFlagConstraint::ConstraintType type) { 195 JVMFlagConstraintList::add(new JVMFlagConstraint_int(flag, func, type)); 196 } 197 void emit_constraint_intx(const JVMFlag* flag, JVMFlagConstraintFunc_intx func, JVMFlagConstraint::ConstraintType type) { 198 JVMFlagConstraintList::add(new JVMFlagConstraint_intx(flag, func, type)); 199 } 200 void emit_constraint_uint(const JVMFlag* flag, JVMFlagConstraintFunc_uint func, JVMFlagConstraint::ConstraintType type) { 201 JVMFlagConstraintList::add(new JVMFlagConstraint_uint(flag, func, type)); 202 } 203 void emit_constraint_uintx(const JVMFlag* flag, JVMFlagConstraintFunc_uintx func, JVMFlagConstraint::ConstraintType type) { 204 JVMFlagConstraintList::add(new JVMFlagConstraint_uintx(flag, func, type)); 205 } 206 void emit_constraint_uint64_t(const JVMFlag* flag, JVMFlagConstraintFunc_uint64_t func, JVMFlagConstraint::ConstraintType type) { 207 JVMFlagConstraintList::add(new JVMFlagConstraint_uint64_t(flag, func, type)); 208 } 209 void emit_constraint_size_t(const JVMFlag* flag, JVMFlagConstraintFunc_size_t func, JVMFlagConstraint::ConstraintType type) { 210 JVMFlagConstraintList::add(new JVMFlagConstraint_size_t(flag, func, type)); 211 } 212 void emit_constraint_double(const JVMFlag* flag, JVMFlagConstraintFunc_double func, JVMFlagConstraint::ConstraintType type) { 213 JVMFlagConstraintList::add(new JVMFlagConstraint_double(flag, func, type)); 214 } 215 216 // Generate code to call emit_constraint_xxx function 217 #define EMIT_CONSTRAINT_START (void)(0 218 #define EMIT_CONSTRAINT(type, name) ); emit_constraint_##type(JVMFlagEx::flag_from_enum(FLAG_MEMBER_ENUM(name)) 219 #define EMIT_CONSTRAINT_NO ); emit_constraint_no(0 220 #define EMIT_CONSTRAINT_PRODUCT_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name) 221 #define EMIT_CONSTRAINT_DIAGNOSTIC_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name) 222 #define EMIT_CONSTRAINT_EXPERIMENTAL_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name) 223 #define EMIT_CONSTRAINT_MANAGEABLE_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name) 224 #define EMIT_CONSTRAINT_PRODUCT_RW_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name) 225 #define EMIT_CONSTRAINT_PD_PRODUCT_FLAG(type, name, doc) EMIT_CONSTRAINT(type, name) 226 #define EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG(type, name, doc) EMIT_CONSTRAINT(type, name) 227 #ifndef PRODUCT 228 #define EMIT_CONSTRAINT_DEVELOPER_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name) 229 #define EMIT_CONSTRAINT_PD_DEVELOPER_FLAG(type, name, doc) EMIT_CONSTRAINT(type, name) 230 #define EMIT_CONSTRAINT_NOTPRODUCT_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name) 231 #else 232 #define EMIT_CONSTRAINT_DEVELOPER_FLAG(type, name, value, doc) EMIT_CONSTRAINT_NO 233 #define EMIT_CONSTRAINT_PD_DEVELOPER_FLAG(type, name, doc) EMIT_CONSTRAINT_NO | 155 } 156 }; 157 158 class JVMFlagConstraint_double : public JVMFlagConstraint { 159 JVMFlagConstraintFunc_double _constraint; 160 161 public: 162 JVMFlagConstraint_double(const JVMFlag* flag, 163 JVMFlagConstraintFunc_double func, 164 ConstraintType type) : JVMFlagConstraint(flag, type), _constraint(func) {} 165 166 JVMFlag::Error apply(bool verbose) { 167 return _constraint(_flag->get_double(), verbose); 168 } 169 170 JVMFlag::Error apply_double(double value, bool verbose) { 171 return _constraint(value, verbose); 172 } 173 }; 174 175 class JVMFlagConstraint_ccstrlist : public JVMFlagConstraint { 176 JVMFlagConstraintFunc_ccstrlist _constraint; 177 178 public: 179 JVMFlagConstraint_ccstrlist(const JVMFlag* flag, 180 JVMFlagConstraintFunc_ccstrlist func, 181 ConstraintType type) : JVMFlagConstraint(flag, type), _constraint(func) {} 182 183 JVMFlag::Error apply(bool verbose) { 184 return _constraint(_flag->get_ccstr(), verbose); 185 } 186 187 JVMFlag::Error apply_ccstrlist(ccstrlist value, bool verbose) { 188 return _constraint(value, verbose); 189 } 190 }; 191 192 // No constraint emitting 193 void emit_constraint_no(...) { /* NOP */ } 194 195 // No constraint emitting if function argument is NOT provided 196 void emit_constraint_bool(const JVMFlag* /*flag*/) { /* NOP */ } 197 void emit_constraint_ccstr(const JVMFlag* /*flag*/) { /* NOP */ } 198 void emit_constraint_ccstrlist(const JVMFlag* /*flag*/) { /* NOP */ } 199 void emit_constraint_int(const JVMFlag* /*flag*/) { /* NOP */ } 200 void emit_constraint_intx(const JVMFlag* /*flag*/) { /* NOP */ } 201 void emit_constraint_uint(const JVMFlag* /*flag*/) { /* NOP */ } 202 void emit_constraint_uintx(const JVMFlag* /*flag*/) { /* NOP */ } 203 void emit_constraint_uint64_t(const JVMFlag* /*flag*/) { /* NOP */ } 204 void emit_constraint_size_t(const JVMFlag* /*flag*/) { /* NOP */ } 205 void emit_constraint_double(const JVMFlag* /*flag*/) { /* NOP */ } 206 207 // JVMFlagConstraint emitting code functions if function argument is provided 208 void emit_constraint_bool(const JVMFlag* flag, JVMFlagConstraintFunc_bool func, JVMFlagConstraint::ConstraintType type) { 209 JVMFlagConstraintList::add(new JVMFlagConstraint_bool(flag, func, type)); 210 } 211 void emit_constraint_int(const JVMFlag* flag, JVMFlagConstraintFunc_int func, JVMFlagConstraint::ConstraintType type) { 212 JVMFlagConstraintList::add(new JVMFlagConstraint_int(flag, func, type)); 213 } 214 void emit_constraint_intx(const JVMFlag* flag, JVMFlagConstraintFunc_intx func, JVMFlagConstraint::ConstraintType type) { 215 JVMFlagConstraintList::add(new JVMFlagConstraint_intx(flag, func, type)); 216 } 217 void emit_constraint_uint(const JVMFlag* flag, JVMFlagConstraintFunc_uint func, JVMFlagConstraint::ConstraintType type) { 218 JVMFlagConstraintList::add(new JVMFlagConstraint_uint(flag, func, type)); 219 } 220 void emit_constraint_uintx(const JVMFlag* flag, JVMFlagConstraintFunc_uintx func, JVMFlagConstraint::ConstraintType type) { 221 JVMFlagConstraintList::add(new JVMFlagConstraint_uintx(flag, func, type)); 222 } 223 void emit_constraint_uint64_t(const JVMFlag* flag, JVMFlagConstraintFunc_uint64_t func, JVMFlagConstraint::ConstraintType type) { 224 JVMFlagConstraintList::add(new JVMFlagConstraint_uint64_t(flag, func, type)); 225 } 226 void emit_constraint_size_t(const JVMFlag* flag, JVMFlagConstraintFunc_size_t func, JVMFlagConstraint::ConstraintType type) { 227 JVMFlagConstraintList::add(new JVMFlagConstraint_size_t(flag, func, type)); 228 } 229 void emit_constraint_double(const JVMFlag* flag, JVMFlagConstraintFunc_double func, JVMFlagConstraint::ConstraintType type) { 230 JVMFlagConstraintList::add(new JVMFlagConstraint_double(flag, func, type)); 231 } 232 void emit_constraint_ccstrlist(const JVMFlag* flag, JVMFlagConstraintFunc_ccstrlist func, JVMFlagConstraint::ConstraintType type) { 233 JVMFlagConstraintList::add(new JVMFlagConstraint_ccstrlist(flag, func, type)); 234 } 235 236 // Generate code to call emit_constraint_xxx function 237 #define EMIT_CONSTRAINT_START (void)(0 238 #define EMIT_CONSTRAINT(type, name) ); emit_constraint_##type(JVMFlagEx::flag_from_enum(FLAG_MEMBER_ENUM(name)) 239 #define EMIT_CONSTRAINT_NO ); emit_constraint_no(0 240 #define EMIT_CONSTRAINT_PRODUCT_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name) 241 #define EMIT_CONSTRAINT_DIAGNOSTIC_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name) 242 #define EMIT_CONSTRAINT_EXPERIMENTAL_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name) 243 #define EMIT_CONSTRAINT_MANAGEABLE_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name) 244 #define EMIT_CONSTRAINT_PRODUCT_RW_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name) 245 #define EMIT_CONSTRAINT_PD_PRODUCT_FLAG(type, name, doc) EMIT_CONSTRAINT(type, name) 246 #define EMIT_CONSTRAINT_PD_DIAGNOSTIC_FLAG(type, name, doc) EMIT_CONSTRAINT(type, name) 247 #ifndef PRODUCT 248 #define EMIT_CONSTRAINT_DEVELOPER_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name) 249 #define EMIT_CONSTRAINT_PD_DEVELOPER_FLAG(type, name, doc) EMIT_CONSTRAINT(type, name) 250 #define EMIT_CONSTRAINT_NOTPRODUCT_FLAG(type, name, value, doc) EMIT_CONSTRAINT(type, name) 251 #else 252 #define EMIT_CONSTRAINT_DEVELOPER_FLAG(type, name, value, doc) EMIT_CONSTRAINT_NO 253 #define EMIT_CONSTRAINT_PD_DEVELOPER_FLAG(type, name, doc) EMIT_CONSTRAINT_NO |