src/share/vm/compiler/compilerOracle.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/src/share/vm/compiler/compilerOracle.cpp	Fri Aug 29 19:06:35 2014
--- new/src/share/vm/compiler/compilerOracle.cpp	Fri Aug 29 19:06:35 2014

*** 171,181 **** --- 171,180 ---- enum OptionType { IntxType, UintxType, BoolType, CcstrType, CcstrListType, UnknownType }; /* Methods to map real type names to OptionType */ template<typename T>
*** 193,202 **** --- 192,214 ---- template<> OptionType get_type_for<bool>() { return BoolType; } + template<> OptionType get_type_for<ccstr>() { + return CcstrType; + } + + template<typename T> + static const T copy_value(const T value) { + return value; + } + + template<> const ccstr copy_value<ccstr>(const ccstr value) { + return (const ccstr)os::strdup_check_oom(value); + } + template <typename T> class TypedMethodOptionMatcher : public MethodMatcher { const char* _option; OptionType _type; const T _value;
*** 205,215 **** --- 217,227 ---- TypedMethodOptionMatcher(Symbol* class_name, Mode class_mode, Symbol* method_name, Mode method_mode, Symbol* signature, const char* opt, const T value, MethodMatcher* next) : MethodMatcher(class_name, class_mode, method_name, method_mode, signature, next), ! _type(get_type_for<T>()), _value(copy_value<T>(value)) { _option = os::strdup_check_oom(opt); } ~TypedMethodOptionMatcher() { os::free((void*)_option);
*** 251,280 **** --- 263,301 ---- template<> void TypedMethodOptionMatcher<intx>::print() { ttyLocker ttyl; print_base(); ! tty->print(" intx %s", _option); ! tty->print(" " INTX_FORMAT, _value); ! tty->print(" = " INTX_FORMAT, _value); tty->cr(); }; template<> void TypedMethodOptionMatcher<uintx>::print() { ttyLocker ttyl; print_base(); ! tty->print(" uintx %s", _option); ! tty->print(" = " UINTX_FORMAT, _value); tty->cr(); }; template<> void TypedMethodOptionMatcher<bool>::print() { ttyLocker ttyl; print_base(); ! tty->print(" bool %s", _option); ! tty->print(" = %s", _value ? "true" : "false"); + tty->cr(); + }; + + template<> + void TypedMethodOptionMatcher<ccstr>::print() { + ttyLocker ttyl; + print_base(); + tty->print(" const char* %s", _option); + tty->print(" = '%s'", _value); tty->cr(); }; // this must parallel the command_names below enum OracleCommand {
*** 366,375 **** --- 387,397 ---- // Explicit instantiation for all OptionTypes supported. template bool CompilerOracle::has_option_value<intx>(methodHandle method, const char* option, intx& value); template bool CompilerOracle::has_option_value<uintx>(methodHandle method, const char* option, uintx& value); template bool CompilerOracle::has_option_value<bool>(methodHandle method, const char* option, bool& value); + template bool CompilerOracle::has_option_value<ccstr>(methodHandle method, const char* option, ccstr& value); bool CompilerOracle::should_exclude(methodHandle method, bool& quietly) { quietly = true; if (lists[ExcludeCommand] != NULL) { if (lists[ExcludeCommand]->match(method)) {
*** 541,556 **** --- 563,611 ---- total_bytes_read += bytes_read; return add_option_string(c_name, c_match, m_name, m_match, signature, flag, value); } else { jio_snprintf(errorbuf, buf_size, " Value cannot be read for flag %s of type %s", flag, type); } + } else if (strcmp(type, "ccstr") == 0) { + ResourceMark rm; + char* value = NEW_RESOURCE_ARRAY(char, strlen(line) + 1); + if (sscanf(line, "%*[ \t]%255[_a-zA-Z0-9]%n", value, &bytes_read) == 1) { + total_bytes_read += bytes_read; + return add_option_string(c_name, c_match, m_name, m_match, signature, flag, (ccstr)value); + } else { + jio_snprintf(errorbuf, buf_size, " Value cannot be read for flag %s of type %s", flag, type); + } + } else if (strcmp(type, "ccstrlist") == 0) { + // Accumulates several strings into one. The internal type is ccstr. + ResourceMark rm; + char* value = NEW_RESOURCE_ARRAY(char, strlen(line) + 1); + char* next_value = value; + if (sscanf(line, "%*[ \t]%255[_a-zA-Z0-9]%n", next_value, &bytes_read) == 1) { + total_bytes_read += bytes_read; + line += bytes_read; + next_value += bytes_read; + char* end_value = next_value-1; + while (sscanf(line, "%*[ \t]%255[_a-zA-Z0-9]%n", next_value, &bytes_read) == 1) { + total_bytes_read += bytes_read; + line += bytes_read; + *end_value = ' '; // override '\0' + next_value += bytes_read; + end_value = next_value-1; + } + return add_option_string(c_name, c_match, m_name, m_match, signature, flag, (ccstr)value); + } else { + jio_snprintf(errorbuf, buf_size, " Value cannot be read for flag %s of type %s", flag, type); + } } else if (strcmp(type, "bool") == 0) { char value[256]; if (sscanf(line, "%*[ \t]%255[a-zA-Z]%n", value, &bytes_read) == 1) { if (strcmp(value, "true") == 0) { total_bytes_read += bytes_read; return add_option_string(c_name, c_match, m_name, m_match, signature, flag, true); + } else if (strcmp(value, "false") == 0) { + total_bytes_read += bytes_read; + return add_option_string(c_name, c_match, m_name, m_match, signature, flag, false); } else { jio_snprintf(errorbuf, buf_size, " Value cannot be read for flag %s of type %s", flag, type); } } else { jio_snprintf(errorbuf, sizeof(errorbuf), " Value cannot be read for flag %s of type %s", flag, type);
*** 647,658 **** --- 702,712 ---- // // Type (1) is used to support ciMethod::has_option("someflag") // (i.e., to check if a flag "someflag" is enabled for a method). // // Type (2) is used to support options with a value. Values can have the - // the following types: intx, uintx, bool, ccstr, and ccstrlist. Currently, // values of type intx, uintx, and bool are supported. // // For future extensions: extend scan_flag_and_value() char option[256]; // stores flag for Type (1) and type of Type (2) while (sscanf(line, "%*[ \t]%255[a-zA-Z0-9]%n", option, &bytes_read) == 1) { if (match != NULL && !_quiet) {

src/share/vm/compiler/compilerOracle.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File