src/share/vm/runtime/globals.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 8059557_rev2_to_rev3 Cdiff src/share/vm/runtime/globals.cpp

src/share/vm/runtime/globals.cpp

Print this page

        

*** 346,356 **** // 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 printRanges, bool withComments) { // Don't print notproduct and develop flags in a product build. if (is_constant_in_binary()) { return; } --- 346,356 ---- // 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, bool printRanges) { // Don't print notproduct and develop flags in a product build. if (is_constant_in_binary()) { return; }
*** 652,662 **** 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()) { ! return (return_flag == true ? current : NULL); } // Report locked flags only if allowed. if (!(current->is_unlocked() || current->is_unlocker())) { if (!allow_locked) { // disable use of locked flags, e.g. diagnostic, experimental, --- 652,662 ---- 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()) { ! return (return_flag ? current : NULL); } // Report locked flags only if allowed. if (!(current->is_unlocked() || current->is_unlocker())) { if (!allow_locked) { // disable use of locked flags, e.g. diagnostic, experimental,
*** 756,765 **** --- 756,775 ---- e.set_new_value(new_value); e.set_origin(origin); e.commit(); } + static Flag::Error get_status_error(Flag::Error status_range, Flag::Error status_constraint) { + if (status_range != Flag::SUCCESS) { + return status_range; + } else if (status_constraint != Flag::SUCCESS) { + return status_constraint; + } else { + return Flag::SUCCESS; + } + } + static Flag::Error apply_constraint_and_check_range_bool(const char* name, bool* new_value, bool verbose = true) { Flag::Error status = Flag::SUCCESS; CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name); if (constraint != NULL) { status = constraint->apply_bool(new_value, verbose);
*** 799,820 **** faddr->set_origin(origin); return Flag::SUCCESS; } static Flag::Error apply_constraint_and_check_range_int(const char* name, int* new_value, bool verbose = true) { ! Flag::Error status = Flag::SUCCESS; CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); if (range != NULL) { ! status = range->check_int(*new_value, verbose); } ! if (status == Flag::SUCCESS) { CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name); if (constraint != NULL) { ! status = constraint->apply_int(new_value, verbose); } ! } ! return status; } Flag::Error CommandLineFlags::intAt(const char* name, size_t len, int* value, bool allow_locked, bool return_flag) { Flag* result = Flag::find_flag(name, len, allow_locked, return_flag); if (result == NULL) return Flag::INVALID_FLAG; --- 809,829 ---- faddr->set_origin(origin); return Flag::SUCCESS; } static Flag::Error apply_constraint_and_check_range_int(const char* name, int* new_value, bool verbose = true) { ! Flag::Error range_status = Flag::SUCCESS; CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); if (range != NULL) { ! range_status = range->check_int(*new_value, verbose); } ! Flag::Error constraint_status = Flag::SUCCESS; CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name); if (constraint != NULL) { ! constraint_status = constraint->apply_int(new_value, verbose); } ! return get_status_error(range_status, constraint_status); } Flag::Error CommandLineFlags::intAt(const char* name, size_t len, int* value, bool allow_locked, bool return_flag) { Flag* result = Flag::find_flag(name, len, allow_locked, return_flag); if (result == NULL) return Flag::INVALID_FLAG;
*** 845,866 **** faddr->set_origin(origin); return Flag::SUCCESS; } static Flag::Error apply_constraint_and_check_range_uint(const char* name, uint* new_value, bool verbose = true) { ! Flag::Error status = Flag::SUCCESS; CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); if (range != NULL) { ! status = range->check_uint(*new_value, verbose); } ! if (status == Flag::SUCCESS) { CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name); if (constraint != NULL) { ! status = constraint->apply_uint(new_value, verbose); ! } } ! return status; } Flag::Error CommandLineFlags::uintAt(const char* name, size_t len, uint* value, bool allow_locked, bool return_flag) { Flag* result = Flag::find_flag(name, len, allow_locked, return_flag); if (result == NULL) return Flag::INVALID_FLAG; --- 854,874 ---- faddr->set_origin(origin); return Flag::SUCCESS; } static Flag::Error apply_constraint_and_check_range_uint(const char* name, uint* new_value, bool verbose = true) { ! Flag::Error range_status = Flag::SUCCESS; CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); if (range != NULL) { ! range_status = range->check_uint(*new_value, verbose); } ! Flag::Error constraint_status = Flag::SUCCESS; CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name); if (constraint != NULL) { ! constraint_status = constraint->apply_uint(new_value, verbose); } ! return get_status_error(range_status, constraint_status); } Flag::Error CommandLineFlags::uintAt(const char* name, size_t len, uint* value, bool allow_locked, bool return_flag) { Flag* result = Flag::find_flag(name, len, allow_locked, return_flag); if (result == NULL) return Flag::INVALID_FLAG;
*** 899,920 **** *value = result->get_intx(); return Flag::SUCCESS; } static Flag::Error apply_constraint_and_check_range_intx(const char* name, intx* new_value, bool verbose = true) { ! Flag::Error status = Flag::SUCCESS; CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); if (range != NULL) { ! status = range->check_intx(*new_value, verbose); } ! if (status == Flag::SUCCESS) { CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name); if (constraint != NULL) { ! status = constraint->apply_intx(new_value, verbose); } ! } ! return status; } Flag::Error CommandLineFlags::intxAtPut(const char* name, size_t len, intx* value, Flag::Flags origin) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return Flag::INVALID_FLAG; --- 907,927 ---- *value = result->get_intx(); return Flag::SUCCESS; } static Flag::Error apply_constraint_and_check_range_intx(const char* name, intx* new_value, bool verbose = true) { ! Flag::Error range_status = Flag::SUCCESS; CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); if (range != NULL) { ! range_status = range->check_intx(*new_value, verbose); } ! Flag::Error constraint_status = Flag::SUCCESS; CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name); if (constraint != NULL) { ! constraint_status = constraint->apply_intx(new_value, verbose); } ! return get_status_error(range_status, constraint_status); } Flag::Error CommandLineFlags::intxAtPut(const char* name, size_t len, intx* value, Flag::Flags origin) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return Flag::INVALID_FLAG;
*** 947,968 **** *value = result->get_uintx(); return Flag::SUCCESS; } static Flag::Error apply_constraint_and_check_range_uintx(const char* name, uintx* new_value, bool verbose = true) { ! Flag::Error status = Flag::SUCCESS; CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); if (range != NULL) { ! status = range->check_uintx(*new_value, verbose); } ! if (status == Flag::SUCCESS) { CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name); if (constraint != NULL) { ! status = constraint->apply_uintx(new_value, verbose); ! } } ! return status; } Flag::Error CommandLineFlags::uintxAtPut(const char* name, size_t len, uintx* value, Flag::Flags origin) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return Flag::INVALID_FLAG; --- 954,974 ---- *value = result->get_uintx(); return Flag::SUCCESS; } static Flag::Error apply_constraint_and_check_range_uintx(const char* name, uintx* new_value, bool verbose = true) { ! Flag::Error range_status = Flag::SUCCESS; CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); if (range != NULL) { ! range_status = range->check_uintx(*new_value, verbose); } ! Flag::Error constraint_status = Flag::SUCCESS; CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name); if (constraint != NULL) { ! constraint_status = constraint->apply_uintx(new_value, verbose); } ! return get_status_error(range_status, constraint_status); } Flag::Error CommandLineFlags::uintxAtPut(const char* name, size_t len, uintx* value, Flag::Flags origin) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return Flag::INVALID_FLAG;
*** 995,1016 **** *value = result->get_uint64_t(); return Flag::SUCCESS; } static Flag::Error apply_constraint_and_check_range_uint64_t(const char* name, uint64_t* new_value, bool verbose = true) { ! Flag::Error status = Flag::SUCCESS; CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); if (range != NULL) { ! status = range->check_uint64_t(*new_value, verbose); } ! if (status == Flag::SUCCESS) { CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name); if (constraint != NULL) { ! status = constraint->apply_uint64_t(new_value, verbose); } ! } ! return status; } Flag::Error CommandLineFlags::uint64_tAtPut(const char* name, size_t len, uint64_t* value, Flag::Flags origin) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return Flag::INVALID_FLAG; --- 1001,1021 ---- *value = result->get_uint64_t(); return Flag::SUCCESS; } static Flag::Error apply_constraint_and_check_range_uint64_t(const char* name, uint64_t* new_value, bool verbose = true) { ! Flag::Error range_status = Flag::SUCCESS; CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); if (range != NULL) { ! range_status = range->check_uint64_t(*new_value, verbose); } ! Flag::Error constraint_status = Flag::SUCCESS; CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name); if (constraint != NULL) { ! constraint_status = constraint->apply_uint64_t(new_value, verbose); } ! return get_status_error(range_status, constraint_status); } Flag::Error CommandLineFlags::uint64_tAtPut(const char* name, size_t len, uint64_t* value, Flag::Flags origin) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return Flag::INVALID_FLAG;
*** 1043,1064 **** *value = result->get_size_t(); return Flag::SUCCESS; } static Flag::Error apply_constraint_and_check_range_size_t(const char* name, size_t* new_value, bool verbose = true) { ! Flag::Error status = Flag::SUCCESS; CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); if (range != NULL) { ! status = range->check_size_t(*new_value, verbose); } ! if (status == Flag::SUCCESS) { CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name); if (constraint != NULL) { ! status = constraint->apply_size_t(new_value, verbose); ! } } ! return status; } Flag::Error CommandLineFlags::size_tAtPut(const char* name, size_t len, size_t* value, Flag::Flags origin) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return Flag::INVALID_FLAG; --- 1048,1068 ---- *value = result->get_size_t(); return Flag::SUCCESS; } static Flag::Error apply_constraint_and_check_range_size_t(const char* name, size_t* new_value, bool verbose = true) { ! Flag::Error range_status = Flag::SUCCESS; CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); if (range != NULL) { ! range_status = range->check_size_t(*new_value, verbose); } ! Flag::Error constraint_status = Flag::SUCCESS; CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name); if (constraint != NULL) { ! constraint_status = constraint->apply_size_t(new_value, verbose); } ! return get_status_error(range_status, constraint_status); } Flag::Error CommandLineFlags::size_tAtPut(const char* name, size_t len, size_t* value, Flag::Flags origin) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return Flag::INVALID_FLAG;
*** 1091,1112 **** *value = result->get_double(); return Flag::SUCCESS; } static Flag::Error apply_constraint_and_check_range_double(const char* name, double* new_value, bool verbose = true) { ! Flag::Error status = Flag::SUCCESS; CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); if (range != NULL) { ! status = range->check_double(*new_value, verbose); } ! if (status == Flag::SUCCESS) { CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name); if (constraint != NULL) { ! status = constraint->apply_double(new_value, verbose); } ! } ! return status; } Flag::Error CommandLineFlags::doubleAtPut(const char* name, size_t len, double* value, Flag::Flags origin) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return Flag::INVALID_FLAG; --- 1095,1115 ---- *value = result->get_double(); return Flag::SUCCESS; } static Flag::Error apply_constraint_and_check_range_double(const char* name, double* new_value, bool verbose = true) { ! Flag::Error range_status = Flag::SUCCESS; CommandLineFlagRange* range = CommandLineFlagRangeList::find(name); if (range != NULL) { ! range_status = range->check_double(*new_value, verbose); } ! Flag::Error constraint_status = Flag::SUCCESS; CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name); if (constraint != NULL) { ! constraint_status = constraint->apply_double(new_value, verbose); } ! return get_status_error(range_status, constraint_status); } Flag::Error CommandLineFlags::doubleAtPut(const char* name, size_t len, double* value, Flag::Flags origin) { Flag* result = Flag::find_flag(name, len); if (result == NULL) return Flag::INVALID_FLAG;
*** 1173,1255 **** } faddr->set_origin(origin); return Flag::SUCCESS; } - //#define PRINT_FLAGS_SORTED_BY_TYPE_THEN_NAMES - #ifndef PRINT_FLAGS_SORTED_BY_TYPE_THEN_NAMES - - extern "C" { - static int compare_flags(const void* void_a, const void* void_b) { - return strcmp((*((Flag**) void_a))->_name, (*((Flag**) void_b))->_name); - } - } - - #else // PRINT_FLAGS_SORTED_BY_TYPE_THEN_NAMES - - void print_kind(Flag::Flags flags, char* string, int size) { - struct Data { - int flag; - const char* name; - }; - - Data data[] = { - { Flag::KIND_C1, "C1" }, - { Flag::KIND_C2, "C2" }, - { Flag::KIND_ARCH, "ARCH" }, - { Flag::KIND_SHARK, "SHARK" }, - { Flag::KIND_PLATFORM_DEPENDENT, "pd" }, - { Flag::KIND_PRODUCT, "product" }, - { Flag::KIND_MANAGEABLE, "manageable" }, - { Flag::KIND_DIAGNOSTIC, "diagnostic" }, - { Flag::KIND_EXPERIMENTAL, "experimental" }, - { Flag::KIND_COMMERCIAL, "commercial" }, - { Flag::KIND_NOT_PRODUCT, "notproduct" }, - { Flag::KIND_DEVELOP, "develop" }, - { Flag::KIND_LP64_PRODUCT, "lp64_product" }, - { Flag::KIND_READ_WRITE, "rw" }, - { -1, "" } - }; - - if ((flags & Flag::KIND_MASK) != 0) { - strncpy(string, "{", size); - bool is_first = true; - - for (int i = 0; data[i].flag != -1; i++) { - Data d = data[i]; - if ((flags & d.flag) != 0) { - if (is_first) { - is_first = false; - } else { - os::strlcat(string, " ", size); - } - os::strlcat(string, d.name, size); - } - } - - os::strlcat(string, "}", size); - } - } - extern "C" { - // by kind, name static int compare_flags(const void* void_a, const void* void_b) { - char buf_a[128]; - print_kind((*((Flag**) void_a))->_flags, &buf_a[0], 127); - char buf_b[128]; - print_kind((*((Flag**) void_b))->_flags, &buf_b[0], 127); - int comp_kind = strncmp(buf_a, buf_b, 127); - if (comp_kind != 0) { - return comp_kind; - } else { return strcmp((*((Flag**) void_a))->_name, (*((Flag**) void_b))->_name); } - } } - #endif //PRINT_FLAGS_SORTED_BY_TYPE_THEN_NAMES - void CommandLineFlags::printSetFlags(outputStream* out) { // Print which flags were set on the command line // note: this method is called before the thread structure is in place // which means resource allocation cannot be used. --- 1176,1191 ----
*** 1275,1284 **** --- 1211,1221 ---- } bool CommandLineFlags::_finished_initializing = false; bool CommandLineFlags::check_all_ranges_and_constraints() { + //#define PRINT_RANGES_AND_CONSTRAINTS_SIZES #ifdef PRINT_RANGES_AND_CONSTRAINTS_SIZES { size_t size_ranges = sizeof(CommandLineFlagRangeList); for (int i=0; i<CommandLineFlagRangeList::length(); i++) {
*** 1420,1440 **** array[i] = &flagTable[i]; } qsort(array, length, sizeof(Flag*), compare_flags); // Print ! if (printRanges == false) { out->print_cr("[Global flags]"); } else { out->print_cr("[Global flags ranges]"); } for (size_t i = 0; i < length; i++) { if (array[i]->is_unlocked()) { #ifdef ONLY_PRINT_PRODUCT_FLAGS if (!array[i]->is_notproduct() && !array[i]->is_develop()) #endif // ONLY_PRINT_PRODUCT_FLAGS ! array[i]->print_on(out, printRanges, withComments); } } FREE_C_HEAP_ARRAY(Flag*, array); } --- 1357,1377 ---- array[i] = &flagTable[i]; } qsort(array, length, sizeof(Flag*), compare_flags); // Print ! if (!printRanges) { out->print_cr("[Global flags]"); } else { out->print_cr("[Global flags ranges]"); } for (size_t i = 0; i < length; i++) { if (array[i]->is_unlocked()) { #ifdef ONLY_PRINT_PRODUCT_FLAGS if (!array[i]->is_notproduct() && !array[i]->is_develop()) #endif // ONLY_PRINT_PRODUCT_FLAGS ! array[i]->print_on(out, withComments, printRanges); } } FREE_C_HEAP_ARRAY(Flag*, array); }
src/share/vm/runtime/globals.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File