292 void TypedMethodOptionMatcher<ccstr>::print() { |
297 void TypedMethodOptionMatcher<ccstr>::print() { |
293 ttyLocker ttyl; |
298 ttyLocker ttyl; |
294 print_base(); |
299 print_base(); |
295 tty->print(" const char* %s", _option); |
300 tty->print(" const char* %s", _option); |
296 tty->print(" = '%s'", _value); |
301 tty->print(" = '%s'", _value); |
|
302 tty->cr(); |
|
303 }; |
|
304 |
|
305 template<> |
|
306 void TypedMethodOptionMatcher<double>::print() { |
|
307 ttyLocker ttyl; |
|
308 print_base(); |
|
309 tty->print(" double %s", _option); |
|
310 tty->print(" = %f", _value); |
297 tty->cr(); |
311 tty->cr(); |
298 }; |
312 }; |
299 |
313 |
300 // this must parallel the command_names below |
314 // this must parallel the command_names below |
301 enum OracleCommand { |
315 enum OracleCommand { |
388 // Explicit instantiation for all OptionTypes supported. |
402 // Explicit instantiation for all OptionTypes supported. |
389 template bool CompilerOracle::has_option_value<intx>(methodHandle method, const char* option, intx& value); |
403 template bool CompilerOracle::has_option_value<intx>(methodHandle method, const char* option, intx& value); |
390 template bool CompilerOracle::has_option_value<uintx>(methodHandle method, const char* option, uintx& value); |
404 template bool CompilerOracle::has_option_value<uintx>(methodHandle method, const char* option, uintx& value); |
391 template bool CompilerOracle::has_option_value<bool>(methodHandle method, const char* option, bool& value); |
405 template bool CompilerOracle::has_option_value<bool>(methodHandle method, const char* option, bool& value); |
392 template bool CompilerOracle::has_option_value<ccstr>(methodHandle method, const char* option, ccstr& value); |
406 template bool CompilerOracle::has_option_value<ccstr>(methodHandle method, const char* option, ccstr& value); |
|
407 template bool CompilerOracle::has_option_value<double>(methodHandle method, const char* option, double& value); |
393 |
408 |
394 bool CompilerOracle::should_exclude(methodHandle method, bool& quietly) { |
409 bool CompilerOracle::should_exclude(methodHandle method, bool& quietly) { |
395 quietly = true; |
410 quietly = true; |
396 if (lists[ExcludeCommand] != NULL) { |
411 if (lists[ExcludeCommand] != NULL) { |
397 if (lists[ExcludeCommand]->match(method)) { |
412 if (lists[ExcludeCommand]->match(method)) { |
608 jio_snprintf(errorbuf, buf_size, " Value cannot be read for flag %s of type %s", flag, type); |
623 jio_snprintf(errorbuf, buf_size, " Value cannot be read for flag %s of type %s", flag, type); |
609 } |
624 } |
610 } else { |
625 } else { |
611 jio_snprintf(errorbuf, sizeof(errorbuf), " Value cannot be read for flag %s of type %s", flag, type); |
626 jio_snprintf(errorbuf, sizeof(errorbuf), " Value cannot be read for flag %s of type %s", flag, type); |
612 } |
627 } |
|
628 } else if (strcmp(type, "double") == 0) { |
|
629 char buffer[2][256]; |
|
630 // Decimal separator '.' has been replaced with ' ' or '/' earlier, |
|
631 // so read integer and fraction part of double value separately. |
|
632 if (sscanf(line, "%*[ \t]%255[0-9]%*[ /\t]%255[0-9]%n", buffer[0], buffer[1], &bytes_read) == 2) { |
|
633 char value[512] = ""; |
|
634 strncat(value, buffer[0], 255); |
|
635 strcat(value, "."); |
|
636 strncat(value, buffer[1], 255); |
|
637 total_bytes_read += bytes_read; |
|
638 return add_option_string(c_name, c_match, m_name, m_match, signature, flag, atof(value)); |
|
639 } else { |
|
640 jio_snprintf(errorbuf, buf_size, " Value cannot be read for flag %s of type %s", flag, type); |
|
641 } |
613 } else { |
642 } else { |
614 jio_snprintf(errorbuf, sizeof(errorbuf), " Type %s not supported ", type); |
643 jio_snprintf(errorbuf, sizeof(errorbuf), " Type %s not supported ", type); |
615 } |
644 } |
616 } else { |
645 } else { |
617 jio_snprintf(errorbuf, sizeof(errorbuf), " Flag name for type %s should be alphanumeric ", type); |
646 jio_snprintf(errorbuf, sizeof(errorbuf), " Flag name for type %s should be alphanumeric ", type); |
698 // supported: |
727 // supported: |
699 // |
728 // |
700 // (1) CompileCommand=option,Klass::method,flag |
729 // (1) CompileCommand=option,Klass::method,flag |
701 // (2) CompileCommand=option,Klass::method,type,flag,value |
730 // (2) CompileCommand=option,Klass::method,type,flag,value |
702 // |
731 // |
703 // Type (1) is used to support ciMethod::has_option("someflag") |
732 // Type (1) is used to enable a boolean flag for a method. |
704 // (i.e., to check if a flag "someflag" is enabled for a method). |
|
705 // |
733 // |
706 // Type (2) is used to support options with a value. Values can have the |
734 // Type (2) is used to support options with a value. Values can have the |
707 // the following types: intx, uintx, bool, ccstr, and ccstrlist. |
735 // the following types: intx, uintx, bool, ccstr, ccstrlist, and double. |
708 // |
736 // |
709 // For future extensions: extend scan_flag_and_value() |
737 // For future extensions: extend scan_flag_and_value() |
710 char option[256]; // stores flag for Type (1) and type of Type (2) |
738 char option[256]; // stores flag for Type (1) and type of Type (2) |
711 while (sscanf(line, "%*[ \t]%255[a-zA-Z0-9]%n", option, &bytes_read) == 1) { |
739 while (sscanf(line, "%*[ \t]%255[a-zA-Z0-9]%n", option, &bytes_read) == 1) { |
712 if (match != NULL && !_quiet) { |
740 if (match != NULL && !_quiet) { |
720 if (strcmp(option, "intx") == 0 |
748 if (strcmp(option, "intx") == 0 |
721 || strcmp(option, "uintx") == 0 |
749 || strcmp(option, "uintx") == 0 |
722 || strcmp(option, "bool") == 0 |
750 || strcmp(option, "bool") == 0 |
723 || strcmp(option, "ccstr") == 0 |
751 || strcmp(option, "ccstr") == 0 |
724 || strcmp(option, "ccstrlist") == 0 |
752 || strcmp(option, "ccstrlist") == 0 |
|
753 || strcmp(option, "double") == 0 |
725 ) { |
754 ) { |
726 |
755 |
727 // Type (2) option: parse flag name and value. |
756 // Type (2) option: parse flag name and value. |
728 match = scan_flag_and_value(option, line, bytes_read, |
757 match = scan_flag_and_value(option, line, bytes_read, |
729 c_name, c_match, m_name, m_match, signature, |
758 c_name, c_match, m_name, m_match, signature, |