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

src/share/vm/compiler/compilerOracle.cpp

Print this page
rev 7383 : 8027829: CompileCommand does not accept all JLS-conformant class/method names
Summary: Fix parsing and updated comments
Reviewed-by:


  88 
  89   static void print_symbol(Symbol* h, Mode mode) {
  90     ResourceMark rm;
  91 
  92     if (mode == Suffix || mode == Substring || mode == Any) {
  93       tty->print("*");
  94     }
  95     if (mode != Any) {
  96       h->print_symbol_on(tty);
  97     }
  98     if (mode == Prefix || mode == Substring) {
  99       tty->print("*");
 100     }
 101   }
 102 
 103   void print_base() {
 104     print_symbol(class_name(), _class_mode);
 105     tty->print(".");
 106     print_symbol(method_name(), _method_mode);
 107     if (signature() != NULL) {
 108       tty->print(" ");
 109       signature()->print_symbol_on(tty);
 110     }
 111   }
 112 
 113   virtual void print() {
 114     print_base();
 115     tty->cr();
 116   }
 117 };
 118 
 119 MethodMatcher::MethodMatcher(Symbol* class_name, Symbol* method_name, MethodMatcher* next) {
 120   _class_name  = class_name;
 121   _method_name = method_name;
 122   _next        = next;
 123   _class_mode  = MethodMatcher::Exact;
 124   _method_mode = MethodMatcher::Exact;
 125   _signature   = NULL;
 126 }
 127 
 128 


 450 bool CompilerOracle::should_break_at(methodHandle method) {
 451   return check_predicate(BreakCommand, method);
 452 }
 453 
 454 
 455 static OracleCommand parse_command_name(const char * line, int* bytes_read) {
 456   assert(ARRAY_SIZE(command_names) == OracleCommandCount,
 457          "command_names size mismatch");
 458 
 459   *bytes_read = 0;
 460   char command[33];
 461   int result = sscanf(line, "%32[a-z]%n", command, bytes_read);
 462   for (uint i = 0; i < ARRAY_SIZE(command_names); i++) {
 463     if (strcmp(command, command_names[i]) == 0) {
 464       return (OracleCommand)i;
 465     }
 466   }
 467   return UnknownCommand;
 468 }
 469 
 470 
 471 static void usage() {
 472   tty->print_cr("  CompileCommand and the CompilerOracle allows simple control over");
 473   tty->print_cr("  what's allowed to be compiled.  The standard supported directives");
 474   tty->print_cr("  are exclude and compileonly.  The exclude directive stops a method");
 475   tty->print_cr("  from being compiled and compileonly excludes all methods except for");
 476   tty->print_cr("  the ones mentioned by compileonly directives.  The basic form of");
 477   tty->print_cr("  all commands is a command name followed by the name of the method");
 478   tty->print_cr("  in one of two forms: the standard class file format as in");
 479   tty->print_cr("  class/name.methodName or the PrintCompilation format");
 480   tty->print_cr("  class.name::methodName.  The method name can optionally be followed");
 481   tty->print_cr("  by a space then the signature of the method in the class file");
 482   tty->print_cr("  format.  Otherwise the directive applies to all methods with the");
 483   tty->print_cr("  same name and class regardless of signature.  Leading and trailing");
 484   tty->print_cr("  *'s in the class and/or method name allows a small amount of");
 485   tty->print_cr("  wildcarding.  ");
 486   tty->cr();
 487   tty->print_cr("  Examples:");
 488   tty->cr();
 489   tty->print_cr("  exclude java/lang/StringBuffer.append");
 490   tty->print_cr("  compileonly java/lang/StringBuffer.toString ()Ljava/lang/String;");
 491   tty->print_cr("  exclude java/lang/String*.*");
 492   tty->print_cr("  exclude *.toString");
 493 }
 494 
























 495 
 496 // The characters allowed in a class or method name.  All characters > 0x7f
 497 // are allowed in order to handle obfuscated class files (e.g. Volano)
 498 #define RANGEBASE "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$_<>" \



















 499         "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" \
 500         "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" \
 501         "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf" \
 502         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" \
 503         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" \
 504         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" \
 505         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" \
 506         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
 507 
 508 #define RANGE0 "[*" RANGEBASE "]"
 509 #define RANGESLASH "[*" RANGEBASE "/]"
 510 
 511 static MethodMatcher::Mode check_mode(char name[], const char*& error_msg) {
 512   int match = MethodMatcher::Exact;
 513   while (name[0] == '*') {
 514     match |= MethodMatcher::Suffix;
 515     strcpy(name, name + 1);
 516   }
 517 
 518   if (strcmp(name, "*") == 0) return MethodMatcher::Any;
 519 
 520   size_t len = strlen(name);
 521   while (len > 0 && name[len - 1] == '*') {
 522     match |= MethodMatcher::Prefix;
 523     name[--len] = '\0';
 524   }
 525 
 526   if (strstr(name, "*") != NULL) {


 664     //      exclude,java/lang/String,indexOf
 665     // For easy cut-and-paste of method names, allow VM output format
 666     // as produced by Method::print_short_name:
 667     //      exclude java.lang.String::indexOf
 668     // For simple implementation convenience here, convert them all to space.
 669     if (have_colon) {
 670       if (*lp == '.')  *lp = '/';   // dots build the package prefix
 671       if (*lp == ':')  *lp = ' ';
 672     }
 673     if (*lp == ',' || *lp == '.')  *lp = ' ';
 674   }
 675 
 676   char* original_line = line;
 677   int bytes_read;
 678   OracleCommand command = parse_command_name(line, &bytes_read);
 679   line += bytes_read;
 680   ResourceMark rm;
 681 
 682   if (command == UnknownCommand) {
 683     ttyLocker ttyl;
 684     tty->print_cr("CompilerOracle: unrecognized line");
 685     tty->print_cr("  \"%s\"", original_line);

 686     return;
 687   }
 688 
 689   if (command == QuietCommand) {
 690     _quiet = true;
 691     return;
 692   }
 693 
 694   if (command == HelpCommand) {
 695     usage();
 696     return;
 697   }
 698 
 699   MethodMatcher::Mode c_match = MethodMatcher::Exact;
 700   MethodMatcher::Mode m_match = MethodMatcher::Exact;
 701   char class_name[256];
 702   char method_name[256];
 703   char sig[1024];
 704   char errorbuf[1024];
 705   const char* error_msg = NULL; // description of first error that appears
 706   MethodMatcher* match = NULL;
 707 
 708   if (scan_line(line, class_name, &c_match, method_name, &m_match, &bytes_read, error_msg)) {
 709     EXCEPTION_MARK;
 710     Symbol* c_name = SymbolTable::new_symbol(class_name, CHECK);
 711     Symbol* m_name = SymbolTable::new_symbol(method_name, CHECK);
 712     Symbol* signature = NULL;
 713 
 714     line += bytes_read;








 715     // there might be a signature following the method.
 716     // signatures always begin with ( so match that by hand
 717     if (1 == sscanf(line, "%*[ \t](%254[[);/" RANGEBASE "]%n", sig + 1, &bytes_read)) {
 718       sig[0] = '(';
 719       line += bytes_read;
 720       signature = SymbolTable::new_symbol(sig, CHECK);
 721     }
 722 
 723     if (command == OptionCommand) {
 724       // Look for trailing options.
 725       //
 726       // Two types of trailing options are
 727       // supported:
 728       //
 729       // (1) CompileCommand=option,Klass::method,flag
 730       // (2) CompileCommand=option,Klass::method,type,flag,value
 731       //
 732       // Type (1) is used to enable a boolean flag for a method.
 733       //
 734       // Type (2) is used to support options with a value. Values can have the
 735       // the following types: intx, uintx, bool, ccstr, ccstrlist, and double.
 736       //
 737       // For future extensions: extend scan_flag_and_value()
 738       char option[256]; // stores flag for Type (1) and type of Type (2)
 739       while (sscanf(line, "%*[ \t]%255[a-zA-Z0-9]%n", option, &bytes_read) == 1) {
 740         if (match != NULL && !_quiet) {
 741           // Print out the last match added
 742           ttyLocker ttyl;
 743           tty->print("CompilerOracle: %s ", command_names[command]);
 744           match->print();
 745         }
 746         line += bytes_read;
 747 
 748         if (strcmp(option, "intx") == 0
 749             || strcmp(option, "uintx") == 0
 750             || strcmp(option, "bool") == 0
 751             || strcmp(option, "ccstr") == 0
 752             || strcmp(option, "ccstrlist") == 0
 753             || strcmp(option, "double") == 0
 754             ) {
 755 
 756           // Type (2) option: parse flag name and value.
 757           match = scan_flag_and_value(option, line, bytes_read,
 758                                       c_name, c_match, m_name, m_match, signature,
 759                                       errorbuf, sizeof(errorbuf));
 760           if (match == NULL) {
 761             error_msg = errorbuf;
 762             break;
 763           }
 764           line += bytes_read;
 765         } else {
 766           // Type (1) option
 767           match = add_option_string(c_name, c_match, m_name, m_match, signature, option, true);
 768         }
 769       } // while(
 770     } else {
 771       match = add_predicate(command, c_name, c_match, m_name, m_match, signature);
 772     }
 773   }
 774 
 775   ttyLocker ttyl;
 776   if (error_msg != NULL) {
 777     // an error has happened
 778     tty->print_cr("CompilerOracle: unrecognized line");
 779     tty->print_cr("  \"%s\"", original_line);
 780     if (error_msg != NULL) {
 781       tty->print_cr("%s", error_msg);
 782     }


 783   } else {
 784     // check for remaining characters
 785     bytes_read = 0;
 786     sscanf(line, "%*[ \t]%n", &bytes_read);
 787     if (line[bytes_read] != '\0') {
 788       tty->print_cr("CompilerOracle: unrecognized line");
 789       tty->print_cr("  \"%s\"", original_line);
 790       tty->print_cr("  Unrecognized text %s after command ", line);

 791     } else if (match != NULL && !_quiet) {
 792       tty->print("CompilerOracle: %s ", command_names[command]);
 793       match->print();
 794     }
 795   }







 796 }
 797 
 798 static const char* default_cc_file = ".hotspot_compiler";
 799 
 800 static const char* cc_file() {
 801 #ifdef ASSERT
 802   if (CompileCommandFile == NULL)
 803     return default_cc_file;
 804 #endif
 805   return CompileCommandFile;
 806 }
 807 
 808 bool CompilerOracle::has_command_file() {
 809   return cc_file() != NULL;
 810 }
 811 
 812 bool CompilerOracle::_quiet = false;
 813 
 814 void CompilerOracle::parse_from_file() {
 815   assert(has_command_file(), "command file must be specified");




  88 
  89   static void print_symbol(Symbol* h, Mode mode) {
  90     ResourceMark rm;
  91 
  92     if (mode == Suffix || mode == Substring || mode == Any) {
  93       tty->print("*");
  94     }
  95     if (mode != Any) {
  96       h->print_symbol_on(tty);
  97     }
  98     if (mode == Prefix || mode == Substring) {
  99       tty->print("*");
 100     }
 101   }
 102 
 103   void print_base() {
 104     print_symbol(class_name(), _class_mode);
 105     tty->print(".");
 106     print_symbol(method_name(), _method_mode);
 107     if (signature() != NULL) {

 108       signature()->print_symbol_on(tty);
 109     }
 110   }
 111 
 112   virtual void print() {
 113     print_base();
 114     tty->cr();
 115   }
 116 };
 117 
 118 MethodMatcher::MethodMatcher(Symbol* class_name, Symbol* method_name, MethodMatcher* next) {
 119   _class_name  = class_name;
 120   _method_name = method_name;
 121   _next        = next;
 122   _class_mode  = MethodMatcher::Exact;
 123   _method_mode = MethodMatcher::Exact;
 124   _signature   = NULL;
 125 }
 126 
 127 


 449 bool CompilerOracle::should_break_at(methodHandle method) {
 450   return check_predicate(BreakCommand, method);
 451 }
 452 
 453 
 454 static OracleCommand parse_command_name(const char * line, int* bytes_read) {
 455   assert(ARRAY_SIZE(command_names) == OracleCommandCount,
 456          "command_names size mismatch");
 457 
 458   *bytes_read = 0;
 459   char command[33];
 460   int result = sscanf(line, "%32[a-z]%n", command, bytes_read);
 461   for (uint i = 0; i < ARRAY_SIZE(command_names); i++) {
 462     if (strcmp(command, command_names[i]) == 0) {
 463       return (OracleCommand)i;
 464     }
 465   }
 466   return UnknownCommand;
 467 }
 468 

 469 static void usage() {
 470   tty->cr();
 471   tty->print_cr("The CompileCommand option enables the user of the JVM to control specific");
 472   tty->print_cr("behavior of the dynamic compilers. The CompileCommand option defines the");
 473   tty->print_cr("following commands:");
 474   tty->cr();
 475   tty->print_cr("  break,<pattern>       - debug breakpoint in compiler and in generated code");
 476   tty->print_cr("  print,<pattern>       - print assembly of method");
 477   tty->print_cr("  exclude,<pattern>     - don't compile or inline this ");
 478   tty->print_cr("  inline,<pattern>      - always inline this method");
 479   tty->print_cr("  dontinline,<pattern>  - don't inline this method");
 480   tty->print_cr("  compileonly,<pattern> - compile only this method");
 481   tty->print_cr("  log,<pattern>         - log compilation of method");
 482   tty->print_cr("  option,<pattern>,<option type>,<option name>,<value>");
 483   tty->print_cr("                        - set value of custom option");
 484   tty->print_cr("  option,<pattern>,<bool option name>");
 485   tty->print_cr("                        - shorthand for setting boolean flag");
 486   tty->print_cr("  quiet                 - silence the compile command output");
 487   tty->print_cr("  help                  - print this text");
 488   tty->cr();
 489   tty->print_cr("The preferred pattern for referencing a method is:");
 490   tty->print_cr("  \"package/Class.method()\"");
 491   tty->cr();
 492   tty->print_cr("For backwards compatibility this form is also allowed:");
 493   tty->print_cr("  \"package.Class::method()\"");
 494   tty->cr();
 495   tty->print_cr("The signature can be separated by an optional whitespace or comma:");
 496   tty->print_cr("  \"package/Class.method ()\"");
 497   tty->print_cr("  \"package.Class::method ()\"");
 498   tty->print_cr("  \"package/Class,method,()\"");
 499   tty->cr();
 500   tty->print_cr("The class identifier and method can can be used together with leading or");
 501   tty->print_cr("trailing *'s for a small amount of wildcarding:");
 502   tty->print_cr("  \"*ackage/Clas*.*etho*()\"");
 503   tty->cr();
 504   tty->print_cr("It is possible to use more than one CompileCommand:");
 505   tty->print_cr("  -XX:CompileCommand=exclude,\"java/*.*\" -XX:CompileCommand=log,\"java*.*\"");
 506   tty->cr();
 507   tty->print_cr("The CompileCommands can be loaded from a file with the flag");
 508   tty->print_cr("-XX:CompileCommandFile=<file>. Use the same format without the flag:");
 509   tty->print_cr("  exclude,\"java/*.*\"");
 510   tty->print_cr("  log,\"java*.*\"");
 511   tty->cr();
 512   tty->print_cr("The following commands have conflicting behavior: 'exclude', 'inline', 'dontinline',");
 513   tty->print_cr("and 'compileonly'. There is no priority of commands. Applying (a subset of) these");
 514   tty->print_cr("commands to the same method results in undefined behavior.");
 515   tty->cr();
 516 };
 517 
 518 // The characters allowed is based on the JVM specification.
 519 // Some tokens disallowed in the JVMS have some meaning
 520 // when parsing so we need to include them here.
 521 // The parser do not enforce all rules of the JVMS - a successful parse
 522 // does not mean that it is an allowed name. Illegal names will simply
 523 // be ignored since they never can match a class or method.
 524 //
 525 // '\0' and 0xf0-0xff are disallowed in constant string values
 526 // 0x20 ' ', 0x09 '\t' are used in the matching
 527 // 0x5b '[' and 0x5d ']' can not be used by the matcher
 528 // 0x28 '(' and 0x29 ')' are used for the signature
 529 // 0x2e '.' is always replaced before the matching
 530 // 0x2f '/' is only used in the class name (package separator)
 531 
 532 #define RANGEBASE "\x1\x2\x3\x4\x5\x6\x7\x8\xa\xb\xc\xd\xe\xf" \
 533     "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" \
 534     "\x21\x22\x23\x24\x25\x26\x27\x2a\x2b\x2c\x2d" \
 535     "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" \
 536     "\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" \
 537     "\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5c\x5e\x5f" \
 538     "\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" \
 539     "\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" \
 540     "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" \
 541     "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" \
 542     "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf" \
 543     "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" \
 544     "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" \
 545     "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" \
 546     "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef"

 547 
 548 #define RANGE0 "[*" RANGEBASE "]"
 549 #define RANGESLASH "[*" RANGEBASE "/]"
 550 
 551 static MethodMatcher::Mode check_mode(char name[], const char*& error_msg) {
 552   int match = MethodMatcher::Exact;
 553   while (name[0] == '*') {
 554     match |= MethodMatcher::Suffix;
 555     strcpy(name, name + 1);
 556   }
 557 
 558   if (strcmp(name, "*") == 0) return MethodMatcher::Any;
 559 
 560   size_t len = strlen(name);
 561   while (len > 0 && name[len - 1] == '*') {
 562     match |= MethodMatcher::Prefix;
 563     name[--len] = '\0';
 564   }
 565 
 566   if (strstr(name, "*") != NULL) {


 704     //      exclude,java/lang/String,indexOf
 705     // For easy cut-and-paste of method names, allow VM output format
 706     // as produced by Method::print_short_name:
 707     //      exclude java.lang.String::indexOf
 708     // For simple implementation convenience here, convert them all to space.
 709     if (have_colon) {
 710       if (*lp == '.')  *lp = '/';   // dots build the package prefix
 711       if (*lp == ':')  *lp = ' ';
 712     }
 713     if (*lp == ',' || *lp == '.')  *lp = ' ';
 714   }
 715 
 716   char* original_line = line;
 717   int bytes_read;
 718   OracleCommand command = parse_command_name(line, &bytes_read);
 719   line += bytes_read;
 720   ResourceMark rm;
 721 
 722   if (command == UnknownCommand) {
 723     ttyLocker ttyl;
 724     tty->print_cr("CompileCommand: unrecognized command");
 725     tty->print_cr("  \"%s\"", original_line);
 726     CompilerOracle::print_tip();
 727     return;
 728   }
 729 
 730   if (command == QuietCommand) {
 731     _quiet = true;
 732     return;
 733   }
 734 
 735   if (command == HelpCommand) {
 736     usage();
 737     return;
 738   }
 739 
 740   MethodMatcher::Mode c_match = MethodMatcher::Exact;
 741   MethodMatcher::Mode m_match = MethodMatcher::Exact;
 742   char class_name[256];
 743   char method_name[256];
 744   char sig[1024];
 745   char errorbuf[1024];
 746   const char* error_msg = NULL; // description of first error that appears
 747   MethodMatcher* match = NULL;
 748 
 749   if (scan_line(line, class_name, &c_match, method_name, &m_match, &bytes_read, error_msg)) {
 750     EXCEPTION_MARK;
 751     Symbol* c_name = SymbolTable::new_symbol(class_name, CHECK);
 752     Symbol* m_name = SymbolTable::new_symbol(method_name, CHECK);
 753     Symbol* signature = NULL;
 754 
 755     line += bytes_read;
 756 
 757     // Skip any leading spaces before signature
 758     int whitespace_read = 0;
 759     sscanf(line, "%*[ \t]%n", &whitespace_read);
 760     if (whitespace_read > 0) {
 761       line += whitespace_read;
 762     }
 763 
 764     // there might be a signature following the method.
 765     // signatures always begin with ( so match that by hand
 766     if (1 == sscanf(line, "(%254[[);/" RANGEBASE "]%n", sig + 1, &bytes_read)) {
 767       sig[0] = '(';
 768       line += bytes_read;
 769       signature = SymbolTable::new_symbol(sig, CHECK);
 770     }
 771 
 772     if (command == OptionCommand) {
 773       // Look for trailing options.
 774       //
 775       // Two types of trailing options are
 776       // supported:
 777       //
 778       // (1) CompileCommand=option,Klass::method,flag
 779       // (2) CompileCommand=option,Klass::method,type,flag,value
 780       //
 781       // Type (1) is used to enable a boolean flag for a method.
 782       //
 783       // Type (2) is used to support options with a value. Values can have the
 784       // the following types: intx, uintx, bool, ccstr, ccstrlist, and double.
 785       //
 786       // For future extensions: extend scan_flag_and_value()
 787       char option[256]; // stores flag for Type (1) and type of Type (2)
 788       while (sscanf(line, "%*[ \t]%255[a-zA-Z0-9]%n", option, &bytes_read) == 1) {
 789         if (match != NULL && !_quiet) {
 790           // Print out the last match added
 791           ttyLocker ttyl;
 792           tty->print("CompileCommand: %s ", command_names[command]);
 793           match->print();
 794         }
 795         line += bytes_read;
 796 
 797         if (strcmp(option, "intx") == 0
 798             || strcmp(option, "uintx") == 0
 799             || strcmp(option, "bool") == 0
 800             || strcmp(option, "ccstr") == 0
 801             || strcmp(option, "ccstrlist") == 0
 802             || strcmp(option, "double") == 0
 803             ) {
 804 
 805           // Type (2) option: parse flag name and value.
 806           match = scan_flag_and_value(option, line, bytes_read,
 807                                       c_name, c_match, m_name, m_match, signature,
 808                                       errorbuf, sizeof(errorbuf));
 809           if (match == NULL) {
 810             error_msg = errorbuf;
 811             break;
 812           }
 813           line += bytes_read;
 814         } else {
 815           // Type (1) option
 816           match = add_option_string(c_name, c_match, m_name, m_match, signature, option, true);
 817         }
 818       } // while(
 819     } else {
 820       match = add_predicate(command, c_name, c_match, m_name, m_match, signature);
 821     }
 822   }
 823 
 824   ttyLocker ttyl;
 825   if (error_msg != NULL) {
 826     // an error has happened
 827     tty->print_cr("CompileCommand: An error occured during parsing");
 828     tty->print_cr("  \"%s\"", original_line);
 829     if (error_msg != NULL) {
 830       tty->print_cr("%s", error_msg);
 831     }
 832     CompilerOracle::print_tip();
 833 
 834   } else {
 835     // check for remaining characters
 836     bytes_read = 0;
 837     sscanf(line, "%*[ \t]%n", &bytes_read);
 838     if (line[bytes_read] != '\0') {
 839       tty->print_cr("CompileCommand: Bad pattern");
 840       tty->print_cr("  \"%s\"", original_line);
 841       tty->print_cr("  Unrecognized text %s after command ", line);
 842       CompilerOracle::print_tip();
 843     } else if (match != NULL && !_quiet) {
 844       tty->print("CompileCommand: %s ", command_names[command]);
 845       match->print();
 846     }
 847   }
 848 }
 849 
 850 void CompilerOracle::print_tip() {
 851   tty->cr();
 852   tty->print_cr("Usage: '-XX:CompileCommand=command,\"package/Class.method()\"'");
 853   tty->print_cr("Use:   '-XX:CompileCommand=help' for more information.");
 854   tty->cr();
 855 }
 856 
 857 static const char* default_cc_file = ".hotspot_compiler";
 858 
 859 static const char* cc_file() {
 860 #ifdef ASSERT
 861   if (CompileCommandFile == NULL)
 862     return default_cc_file;
 863 #endif
 864   return CompileCommandFile;
 865 }
 866 
 867 bool CompilerOracle::has_command_file() {
 868   return cc_file() != NULL;
 869 }
 870 
 871 bool CompilerOracle::_quiet = false;
 872 
 873 void CompilerOracle::parse_from_file() {
 874   assert(has_command_file(), "command file must be specified");


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