src/share/vm/compiler/compilerOracle.cpp

Print this page




 370         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" \
 371         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" \
 372         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" \
 373         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" \
 374         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
 375 
 376 #define RANGE0 "[*" RANGEBASE "]"
 377 #define RANGEDOT "[*" RANGEBASE ".]"
 378 #define RANGESLASH "[*" RANGEBASE "/]"
 379 
 380 
 381 // Accept several syntaxes for these patterns
 382 //  original syntax
 383 //   cmd  java.lang.String foo
 384 //  PrintCompilation syntax
 385 //   cmd  java.lang.String::foo
 386 //  VM syntax
 387 //   cmd  java/lang/String[. ]foo
 388 //
 389 
 390 static const char* patterns[] = {
 391   "%*[ \t]%255" RANGEDOT    " "     "%255"  RANGE0 "%n",
 392   "%*[ \t]%255" RANGEDOT   "::"     "%255"  RANGE0 "%n",
 393   "%*[ \t]%255" RANGESLASH "%*[ .]" "%255"  RANGE0 "%n",
 394 };
 395 
 396 static MethodMatcher::Mode check_mode(char name[], const char*& error_msg) {
 397   int match = MethodMatcher::Exact;
 398   while (name[0] == '*') {
 399     match |= MethodMatcher::Suffix;
 400     strcpy(name, name + 1);
 401   }
 402 
 403   if (strcmp(name, "*") == 0) return MethodMatcher::Any;
 404 
 405   size_t len = strlen(name);
 406   while (len > 0 && name[len - 1] == '*') {
 407     match |= MethodMatcher::Prefix;
 408     name[--len] = '\0';
 409   }
 410 
 411   if (strstr(name, "*") != NULL) {
 412     error_msg = "  Embedded * not allowed";
 413     return MethodMatcher::Unknown;
 414   }
 415   return (MethodMatcher::Mode)match;
 416 }
 417 
 418 static bool scan_line(const char * line,
 419                       char class_name[],  MethodMatcher::Mode* c_mode,
 420                       char method_name[], MethodMatcher::Mode* m_mode,
 421                       int* bytes_read, const char*& error_msg) {
 422   *bytes_read = 0;
 423   error_msg = NULL;
 424   for (uint i = 0; i < ARRAY_SIZE(patterns); i++) {
 425     if (2 == sscanf(line, patterns[i], class_name, method_name, bytes_read)) {






 426       *c_mode = check_mode(class_name, error_msg);
 427       *m_mode = check_mode(method_name, error_msg);
 428       return *c_mode != MethodMatcher::Unknown && *m_mode != MethodMatcher::Unknown;
 429     }
 430   }
 431   return false;
 432 }
 433 
 434 
 435 
 436 void CompilerOracle::parse_from_line(char* line) {
 437   if (line[0] == '\0') return;
 438   if (line[0] == '#')  return;
 439 
 440   bool have_colon = (strstr(line, "::") != NULL);
 441   for (char* lp = line; *lp != '\0'; lp++) {
 442     // Allow '.' to separate the class name from the method name.
 443     // This is the preferred spelling of methods:
 444     //      exclude java/lang/String.indexOf(I)I
 445     // Allow ',' for spaces (eases command line quoting).
 446     //      exclude,java/lang/String.indexOf
 447     // For backward compatibility, allow space as separator also.
 448     //      exclude java/lang/String indexOf
 449     //      exclude,java/lang/String,indexOf
 450     // For easy cut-and-paste of method names, allow VM output format




 370         "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" \
 371         "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" \
 372         "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" \
 373         "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" \
 374         "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
 375 
 376 #define RANGE0 "[*" RANGEBASE "]"
 377 #define RANGEDOT "[*" RANGEBASE ".]"
 378 #define RANGESLASH "[*" RANGEBASE "/]"
 379 
 380 
 381 // Accept several syntaxes for these patterns
 382 //  original syntax
 383 //   cmd  java.lang.String foo
 384 //  PrintCompilation syntax
 385 //   cmd  java.lang.String::foo
 386 //  VM syntax
 387 //   cmd  java/lang/String[. ]foo
 388 //
 389 






 390 static MethodMatcher::Mode check_mode(char name[], const char*& error_msg) {
 391   int match = MethodMatcher::Exact;
 392   while (name[0] == '*') {
 393     match |= MethodMatcher::Suffix;
 394     strcpy(name, name + 1);
 395   }
 396 
 397   if (strcmp(name, "*") == 0) return MethodMatcher::Any;
 398 
 399   size_t len = strlen(name);
 400   while (len > 0 && name[len - 1] == '*') {
 401     match |= MethodMatcher::Prefix;
 402     name[--len] = '\0';
 403   }
 404 
 405   if (strstr(name, "*") != NULL) {
 406     error_msg = "  Embedded * not allowed";
 407     return MethodMatcher::Unknown;
 408   }
 409   return (MethodMatcher::Mode)match;
 410 }
 411 
 412 static bool scan_line(const char * line,
 413                       char class_name[],  MethodMatcher::Mode* c_mode,
 414                       char method_name[], MethodMatcher::Mode* m_mode,
 415                       int* bytes_read, const char*& error_msg) {
 416   *bytes_read = 0;
 417   error_msg = NULL;
 418   int scanned = sscanf(line, "%*[ \t]%255" RANGEDOT    " "     "%255"  RANGE0 "%n", class_name, method_name, bytes_read);
 419   if (scanned != 2) {
 420     scanned = sscanf(line, "%*[ \t]%255" RANGEDOT   "::"     "%255"  RANGE0 "%n", class_name, method_name, bytes_read);
 421     if (scanned != 2) {
 422       scanned = sscanf(line, "%*[ \t]%255" RANGESLASH "%*[ .]" "%255"  RANGE0 "%n", class_name, method_name, bytes_read);
 423     }
 424   }
 425   if (scanned == 2) {
 426     *c_mode = check_mode(class_name, error_msg);
 427     *m_mode = check_mode(method_name, error_msg);
 428     return *c_mode != MethodMatcher::Unknown && *m_mode != MethodMatcher::Unknown;
 429   }

 430   return false;
 431 }
 432 
 433 
 434 
 435 void CompilerOracle::parse_from_line(char* line) {
 436   if (line[0] == '\0') return;
 437   if (line[0] == '#')  return;
 438 
 439   bool have_colon = (strstr(line, "::") != NULL);
 440   for (char* lp = line; *lp != '\0'; lp++) {
 441     // Allow '.' to separate the class name from the method name.
 442     // This is the preferred spelling of methods:
 443     //      exclude java/lang/String.indexOf(I)I
 444     // Allow ',' for spaces (eases command line quoting).
 445     //      exclude,java/lang/String.indexOf
 446     // For backward compatibility, allow space as separator also.
 447     //      exclude java/lang/String indexOf
 448     //      exclude,java/lang/String,indexOf
 449     // For easy cut-and-paste of method names, allow VM output format