Mercurial > hg > graal-compiler
diff src/share/vm/runtime/globals.cpp @ 18041:52b4284cb496
Merge with jdk8u20-b26
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Wed, 15 Oct 2014 16:02:50 +0200 |
parents | dffc37fa7157 78bbf4d43a14 |
children | 7848fc12602b |
line wrap: on
line diff
--- a/src/share/vm/runtime/globals.cpp Thu Oct 16 10:21:29 2014 +0200 +++ b/src/share/vm/runtime/globals.cpp Wed Oct 15 16:02:50 2014 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, 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 @@ -31,6 +31,7 @@ #include "utilities/ostream.hpp" #include "utilities/macros.hpp" #include "utilities/top.hpp" +#include "trace/tracing.hpp" #if INCLUDE_ALL_GCS #include "gc_implementation/g1/g1_globals.hpp" #endif // INCLUDE_ALL_GCS @@ -47,6 +48,8 @@ #include "shark/shark_globals.hpp" #endif +PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + RUNTIME_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, \ MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, \ MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_EXPERIMENTAL_FLAG, \ @@ -65,6 +68,14 @@ MATERIALIZE_FLAGS_EXT +static bool is_product_build() { +#ifdef PRODUCT + return true; +#else + return false; +#endif +} + void Flag::check_writable() { if (is_constant_in_binary()) { fatal(err_msg("flag is constant: %s", _name)); @@ -238,6 +249,27 @@ // Get custom message for this locked flag, or return NULL if // none is available. void Flag::get_locked_message(char* buf, int buflen) const { + buf[0] = '\0'; + if (is_diagnostic() && !is_unlocked()) { + jio_snprintf(buf, buflen, "Error: VM option '%s' is diagnostic and must be enabled via -XX:+UnlockDiagnosticVMOptions.\n", + _name); + return; + } + if (is_experimental() && !is_unlocked()) { + jio_snprintf(buf, buflen, "Error: VM option '%s' is experimental and must be enabled via -XX:+UnlockExperimentalVMOptions.\n", + _name); + return; + } + if (is_develop() && is_product_build()) { + jio_snprintf(buf, buflen, "Error: VM option '%s' is develop and is available only in debug version of VM.\n", + _name); + return; + } + if (is_notproduct() && is_product_build()) { + jio_snprintf(buf, buflen, "Error: VM option '%s' is notproduct and is available only in debug version of VM.\n", + _name); + return; + } get_locked_message_ext(buf, buflen); } @@ -256,6 +288,7 @@ // Length of format string (e.g. "%.1234s") for printing ccstr below #define FORMAT_BUFFER_LEN 16 +PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL void Flag::print_on(outputStream* st, bool withComments) { // Don't print notproduct and develop flags in a product build. if (is_constant_in_binary()) { @@ -288,7 +321,10 @@ size_t llen = pointer_delta(eol, cp, sizeof(char)); jio_snprintf(format_buffer, FORMAT_BUFFER_LEN, "%%." SIZE_FORMAT "s", llen); +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL st->print(format_buffer, cp); +PRAGMA_DIAG_POP st->cr(); cp = eol+1; st->print("%5s %-35s += ", "", _name); @@ -298,7 +334,7 @@ else st->print("%-16s", ""); } - st->print("%-20"); + st->print("%-20s", " "); print_kind(st); if (withComments) { @@ -346,7 +382,7 @@ } else { st->print(" "); } - st->print(d.name); + st->print_raw(d.name); } } @@ -477,13 +513,13 @@ } // Search the flag table for a named flag -Flag* Flag::find_flag(const char* name, size_t length, bool allow_locked, bool allow_constant) { +Flag* Flag::find_flag(const char* name, size_t length, bool allow_locked, bool return_flag) { for (Flag* current = &flagTable[0]; current->_name != NULL; current++) { if (str_equal(current->_name, name, length)) { // Found a matching entry. // Don't report notproduct and develop flags in product builds. - if (current->is_constant_in_binary() && !allow_constant) { - return NULL; + if (current->is_constant_in_binary()) { + return (return_flag == true ? current : NULL); } // Report locked flags only if allowed. if (!(current->is_unlocked() || current->is_unlocker())) { @@ -577,6 +613,17 @@ return true; } +template<class E, class T> +static void trace_flag_changed(const char* name, const T old_value, const T new_value, const Flag::Flags origin) +{ + E e; + e.set_name(name); + e.set_old_value(old_value); + e.set_new_value(new_value); + e.set_origin(origin); + e.commit(); +} + bool CommandLineFlags::boolAt(char* name, size_t len, bool* value) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return false; @@ -590,6 +637,7 @@ if (result == NULL) return false; if (!result->is_bool()) return false; bool old_value = result->get_bool(); + trace_flag_changed<EventBooleanFlagChanged, bool>(name, old_value, *value, origin); result->set_bool(*value); *value = old_value; result->set_origin(origin); @@ -599,6 +647,7 @@ void CommandLineFlagsEx::boolAtPut(CommandLineFlagWithType flag, bool value, Flag::Flags origin) { Flag* faddr = address_of_flag(flag); guarantee(faddr != NULL && faddr->is_bool(), "wrong flag type"); + trace_flag_changed<EventBooleanFlagChanged, bool>(faddr->_name, faddr->get_bool(), value, origin); faddr->set_bool(value); faddr->set_origin(origin); } @@ -616,6 +665,7 @@ if (result == NULL) return false; if (!result->is_intx()) return false; intx old_value = result->get_intx(); + trace_flag_changed<EventLongFlagChanged, s8>(name, old_value, *value, origin); result->set_intx(*value); *value = old_value; result->set_origin(origin); @@ -625,6 +675,7 @@ void CommandLineFlagsEx::intxAtPut(CommandLineFlagWithType flag, intx value, Flag::Flags origin) { Flag* faddr = address_of_flag(flag); guarantee(faddr != NULL && faddr->is_intx(), "wrong flag type"); + trace_flag_changed<EventLongFlagChanged, s8>(faddr->_name, faddr->get_intx(), value, origin); faddr->set_intx(value); faddr->set_origin(origin); } @@ -642,6 +693,7 @@ if (result == NULL) return false; if (!result->is_uintx()) return false; uintx old_value = result->get_uintx(); + trace_flag_changed<EventUnsignedLongFlagChanged, u8>(name, old_value, *value, origin); result->set_uintx(*value); *value = old_value; result->set_origin(origin); @@ -651,6 +703,7 @@ void CommandLineFlagsEx::uintxAtPut(CommandLineFlagWithType flag, uintx value, Flag::Flags origin) { Flag* faddr = address_of_flag(flag); guarantee(faddr != NULL && faddr->is_uintx(), "wrong flag type"); + trace_flag_changed<EventUnsignedLongFlagChanged, u8>(faddr->_name, faddr->get_uintx(), value, origin); faddr->set_uintx(value); faddr->set_origin(origin); } @@ -668,6 +721,7 @@ if (result == NULL) return false; if (!result->is_uint64_t()) return false; uint64_t old_value = result->get_uint64_t(); + trace_flag_changed<EventUnsignedLongFlagChanged, u8>(name, old_value, *value, origin); result->set_uint64_t(*value); *value = old_value; result->set_origin(origin); @@ -677,6 +731,7 @@ void CommandLineFlagsEx::uint64_tAtPut(CommandLineFlagWithType flag, uint64_t value, Flag::Flags origin) { Flag* faddr = address_of_flag(flag); guarantee(faddr != NULL && faddr->is_uint64_t(), "wrong flag type"); + trace_flag_changed<EventUnsignedLongFlagChanged, u8>(faddr->_name, faddr->get_uint64_t(), value, origin); faddr->set_uint64_t(value); faddr->set_origin(origin); } @@ -694,6 +749,7 @@ if (result == NULL) return false; if (!result->is_double()) return false; double old_value = result->get_double(); + trace_flag_changed<EventDoubleFlagChanged, double>(name, old_value, *value, origin); result->set_double(*value); *value = old_value; result->set_origin(origin); @@ -703,6 +759,7 @@ void CommandLineFlagsEx::doubleAtPut(CommandLineFlagWithType flag, double value, Flag::Flags origin) { Flag* faddr = address_of_flag(flag); guarantee(faddr != NULL && faddr->is_double(), "wrong flag type"); + trace_flag_changed<EventDoubleFlagChanged, double>(faddr->_name, faddr->get_double(), value, origin); faddr->set_double(value); faddr->set_origin(origin); } @@ -722,6 +779,7 @@ if (result == NULL) return false; if (!result->is_ccstr()) return false; ccstr old_value = result->get_ccstr(); + trace_flag_changed<EventStringFlagChanged, const char*>(name, old_value, *value, origin); char* new_value = NULL; if (*value != NULL) { new_value = NEW_C_HEAP_ARRAY(char, strlen(*value)+1, mtInternal); @@ -744,6 +802,7 @@ Flag* faddr = address_of_flag(flag); guarantee(faddr != NULL && faddr->is_ccstr(), "wrong flag type"); ccstr old_value = faddr->get_ccstr(); + trace_flag_changed<EventStringFlagChanged, const char*>(faddr->_name, old_value, value, origin); char* new_value = NEW_C_HEAP_ARRAY(char, strlen(value)+1, mtInternal); strcpy(new_value, value); faddr->set_ccstr(new_value);