Mercurial > hg > graal-compiler
diff src/share/vm/runtime/globals.cpp @ 5947:80fe40862b02
7144328: Improper commandlines for -XX:+-UnlockCommercialFeatures require proper warning/error messages
Summary: Provide custom error messages for locked commercial feature options which are not first unlocked.
Reviewed-by: dcubed, jcoomes, kamg
Contributed-by: james.melvin@oracle.com
author | jmelvin |
---|---|
date | Tue, 20 Mar 2012 16:46:39 -0400 |
parents | 4f25538b54c9 |
children | f47478089efc |
line wrap: on
line diff
--- a/src/share/vm/runtime/globals.cpp Mon Mar 19 10:09:24 2012 +0100 +++ b/src/share/vm/runtime/globals.cpp Tue Mar 20 16:46:39 2012 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -81,6 +81,12 @@ } } +// Get custom message for this locked flag, or return NULL if +// none is available. +void Flag::get_locked_message(char* buf, int buflen) const { + get_locked_message_ext(buf, buflen); +} + bool Flag::is_writeable() const { return strcmp(kind, "{manageable}") == 0 || strcmp(kind, "{product rw}") == 0 || @@ -260,17 +266,22 @@ return strncmp(s, q, len) == 0; } -Flag* Flag::find_flag(char* name, size_t length) { - for (Flag* current = &flagTable[0]; current->name; current++) { +// Search the flag table for a named flag +Flag* Flag::find_flag(char* name, size_t length, bool allow_locked) { + for (Flag* current = &flagTable[0]; current->name != NULL; current++) { if (str_equal(current->name, name, length)) { + // Found a matching entry. Report locked flags only if allowed. if (!(current->is_unlocked() || current->is_unlocker())) { - // disable use of diagnostic or experimental flags until they - // are explicitly unlocked - return NULL; + if (!allow_locked) { + // disable use of locked flags, e.g. diagnostic, experimental, + // commercial... until they are explicitly unlocked + return NULL; + } } return current; } } + // Flag name is not in the flag table return NULL; }