diff -r fb31de03f649 -r 439a7166bf0f hotspot/src/share/vm/runtime/globals.cpp --- a/hotspot/src/share/vm/runtime/globals.cpp Mon Mar 19 10:09:24 2012 +0100 +++ b/hotspot/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; }