257 EMIT_CONSTRAINT_PRODUCT_FLAG,
258 EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
259 EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
260 EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
261 IGNORE_RANGE,
262 EMIT_CONSTRAINT_CHECK));
263 #endif // COMPILER1
264
265 #ifdef COMPILER2
266 emit_constraint_no(NULL C2_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
267 EMIT_CONSTRAINT_PD_DEVELOPER_FLAG,
268 EMIT_CONSTRAINT_PRODUCT_FLAG,
269 EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
270 EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
271 EMIT_CONSTRAINT_EXPERIMENTAL_FLAG,
272 EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
273 IGNORE_RANGE,
274 EMIT_CONSTRAINT_CHECK));
275 #endif // COMPILER2
276
277 #ifndef INCLUDE_ALL_GCS
278 emit_constraint_no(NULL G1_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
279 EMIT_CONSTRAINT_PD_DEVELOPER_FLAG,
280 EMIT_CONSTRAINT_PRODUCT_FLAG,
281 EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
282 EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
283 EMIT_CONSTRAINT_EXPERIMENTAL_FLAG,
284 EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
285 EMIT_CONSTRAINT_MANAGEABLE_FLAG,
286 EMIT_CONSTRAINT_PRODUCT_RW_FLAG,
287 IGNORE_RANGE,
288 EMIT_CONSTRAINT_CHECK));
289 #endif // INCLUDE_ALL_GCS
290 }
291
292 // Find constraints by name and return only if found constraint's type is equal or lower than current validating type.
293 CommandLineFlagConstraint* CommandLineFlagConstraintList::find_if_needs_check(const char* name) {
294 CommandLineFlagConstraint* found = NULL;
295 for (int i=0; i<length(); i++) {
296 CommandLineFlagConstraint* constraint = at(i);
297 if ((strcmp(constraint->name(), name) == 0) &&
298 (constraint->type() <= _validating_type)) {
299 found = constraint;
300 break;
301 }
302 }
303 return found;
304 }
305
306 // Check constraints for specific constraint type.
307 bool CommandLineFlagConstraintList::check_constraints(CommandLineFlagConstraint::ConstraintType type) {
308 // Skip if we already checked.
309 if (type < _validating_type) {
310 return true;
311 }
312 _validating_type = type;
313
314 bool status = true;
315 for (int i=0; i<length(); i++) {
316 CommandLineFlagConstraint* constraint = at(i);
317 if (type != constraint->type()) continue;
318 const char* name = constraint->name();
319 Flag* flag = Flag::find_flag(name, strlen(name), true, true);
320 // We must check for NULL here as lp64_product flags on 32 bit architecture
321 // can generate constraint check (despite that they are declared as constants),
322 // but they will not be returned by Flag::find_flag()
323 if (flag != NULL) {
324 if (flag->is_bool()) {
325 bool value = flag->get_bool();
326 if (constraint->apply_bool(value, true) != Flag::SUCCESS) status = false;
327 } else if (flag->is_int()) {
328 int value = flag->get_int();
329 if (constraint->apply_int(value, true) != Flag::SUCCESS) status = false;
330 } else if (flag->is_uint()) {
331 uint value = flag->get_uint();
|
257 EMIT_CONSTRAINT_PRODUCT_FLAG,
258 EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
259 EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
260 EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
261 IGNORE_RANGE,
262 EMIT_CONSTRAINT_CHECK));
263 #endif // COMPILER1
264
265 #ifdef COMPILER2
266 emit_constraint_no(NULL C2_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
267 EMIT_CONSTRAINT_PD_DEVELOPER_FLAG,
268 EMIT_CONSTRAINT_PRODUCT_FLAG,
269 EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
270 EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
271 EMIT_CONSTRAINT_EXPERIMENTAL_FLAG,
272 EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
273 IGNORE_RANGE,
274 EMIT_CONSTRAINT_CHECK));
275 #endif // COMPILER2
276
277 #if INCLUDE_ALL_GCS
278 emit_constraint_no(NULL G1_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
279 EMIT_CONSTRAINT_PD_DEVELOPER_FLAG,
280 EMIT_CONSTRAINT_PRODUCT_FLAG,
281 EMIT_CONSTRAINT_PD_PRODUCT_FLAG,
282 EMIT_CONSTRAINT_DIAGNOSTIC_FLAG,
283 EMIT_CONSTRAINT_EXPERIMENTAL_FLAG,
284 EMIT_CONSTRAINT_NOTPRODUCT_FLAG,
285 EMIT_CONSTRAINT_MANAGEABLE_FLAG,
286 EMIT_CONSTRAINT_PRODUCT_RW_FLAG,
287 IGNORE_RANGE,
288 EMIT_CONSTRAINT_CHECK));
289 #endif // INCLUDE_ALL_GCS
290 }
291
292 // Find constraints by name and return only if found constraint's type is equal or lower than current validating type.
293 CommandLineFlagConstraint* CommandLineFlagConstraintList::find_if_needs_check(const char* name) {
294 CommandLineFlagConstraint* found = NULL;
295 for (int i=0; i<length(); i++) {
296 CommandLineFlagConstraint* constraint = at(i);
297 if ((strcmp(constraint->name(), name) == 0) &&
298 (constraint->type() <= _validating_type)) {
299 found = constraint;
300 break;
301 }
302 }
303 return found;
304 }
305
306 // Check constraints for specific constraint type.
307 bool CommandLineFlagConstraintList::check_constraints(CommandLineFlagConstraint::ConstraintType type) {
308 guarantee(type > _validating_type, "Constraint check is out of order.");
309 _validating_type = type;
310
311 bool status = true;
312 for (int i=0; i<length(); i++) {
313 CommandLineFlagConstraint* constraint = at(i);
314 if (type != constraint->type()) continue;
315 const char* name = constraint->name();
316 Flag* flag = Flag::find_flag(name, strlen(name), true, true);
317 // We must check for NULL here as lp64_product flags on 32 bit architecture
318 // can generate constraint check (despite that they are declared as constants),
319 // but they will not be returned by Flag::find_flag()
320 if (flag != NULL) {
321 if (flag->is_bool()) {
322 bool value = flag->get_bool();
323 if (constraint->apply_bool(value, true) != Flag::SUCCESS) status = false;
324 } else if (flag->is_int()) {
325 int value = flag->get_int();
326 if (constraint->apply_int(value, true) != Flag::SUCCESS) status = false;
327 } else if (flag->is_uint()) {
328 uint value = flag->get_uint();
|