compilerOracle.cpp revision 6856:5217fa82f1a4
1/* 2 * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25#include "precompiled.hpp" 26#include "compiler/compilerOracle.hpp" 27#include "memory/allocation.inline.hpp" 28#include "memory/oopFactory.hpp" 29#include "memory/resourceArea.hpp" 30#include "oops/klass.hpp" 31#include "oops/method.hpp" 32#include "oops/oop.inline.hpp" 33#include "oops/symbol.hpp" 34#include "runtime/handles.inline.hpp" 35#include "runtime/jniHandles.hpp" 36#include "runtime/os.hpp" 37 38class MethodMatcher : public CHeapObj<mtCompiler> { 39 public: 40 enum Mode { 41 Exact, 42 Prefix = 1, 43 Suffix = 2, 44 Substring = Prefix | Suffix, 45 Any, 46 Unknown = -1 47 }; 48 49 protected: 50 Symbol* _class_name; 51 Symbol* _method_name; 52 Symbol* _signature; 53 Mode _class_mode; 54 Mode _method_mode; 55 MethodMatcher* _next; 56 57 static bool match(Symbol* candidate, Symbol* match, Mode match_mode); 58 59 Symbol* class_name() const { return _class_name; } 60 Symbol* method_name() const { return _method_name; } 61 Symbol* signature() const { return _signature; } 62 63 public: 64 MethodMatcher(Symbol* class_name, Mode class_mode, 65 Symbol* method_name, Mode method_mode, 66 Symbol* signature, MethodMatcher* next); 67 MethodMatcher(Symbol* class_name, Symbol* method_name, MethodMatcher* next); 68 69 // utility method 70 MethodMatcher* find(methodHandle method) { 71 Symbol* class_name = method->method_holder()->name(); 72 Symbol* method_name = method->name(); 73 for (MethodMatcher* current = this; current != NULL; current = current->_next) { 74 if (match(class_name, current->class_name(), current->_class_mode) && 75 match(method_name, current->method_name(), current->_method_mode) && 76 (current->signature() == NULL || current->signature() == method->signature())) { 77 return current; 78 } 79 } 80 return NULL; 81 } 82 83 bool match(methodHandle method) { 84 return find(method) != NULL; 85 } 86 87 MethodMatcher* next() const { return _next; } 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 119MethodMatcher::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 129MethodMatcher::MethodMatcher(Symbol* class_name, Mode class_mode, 130 Symbol* method_name, Mode method_mode, 131 Symbol* signature, MethodMatcher* next): 132 _class_mode(class_mode) 133 , _method_mode(method_mode) 134 , _next(next) 135 , _class_name(class_name) 136 , _method_name(method_name) 137 , _signature(signature) { 138} 139 140bool MethodMatcher::match(Symbol* candidate, Symbol* match, Mode match_mode) { 141 if (match_mode == Any) { 142 return true; 143 } 144 145 if (match_mode == Exact) { 146 return candidate == match; 147 } 148 149 ResourceMark rm; 150 const char * candidate_string = candidate->as_C_string(); 151 const char * match_string = match->as_C_string(); 152 153 switch (match_mode) { 154 case Prefix: 155 return strstr(candidate_string, match_string) == candidate_string; 156 157 case Suffix: { 158 size_t clen = strlen(candidate_string); 159 size_t mlen = strlen(match_string); 160 return clen >= mlen && strcmp(candidate_string + clen - mlen, match_string) == 0; 161 } 162 163 case Substring: 164 return strstr(candidate_string, match_string) != NULL; 165 166 default: 167 return false; 168 } 169} 170 171 172class MethodOptionMatcher: public MethodMatcher { 173 const char * option; 174 public: 175 MethodOptionMatcher(Symbol* class_name, Mode class_mode, 176 Symbol* method_name, Mode method_mode, 177 Symbol* signature, const char * opt, MethodMatcher* next): 178 MethodMatcher(class_name, class_mode, method_name, method_mode, signature, next) { 179 option = os::strdup_check_oom(opt); 180 } 181 182 virtual ~MethodOptionMatcher() { 183 os::free((void*)option); 184 } 185 186 bool match(methodHandle method, const char* opt) { 187 MethodOptionMatcher* current = this; 188 while (current != NULL) { 189 current = (MethodOptionMatcher*)current->find(method); 190 if (current == NULL) { 191 return false; 192 } 193 if (strcmp(current->option, opt) == 0) { 194 return true; 195 } 196 current = current->next(); 197 } 198 return false; 199 } 200 201 MethodOptionMatcher* next() { 202 return (MethodOptionMatcher*)_next; 203 } 204 205 virtual void print() { 206 print_base(); 207 tty->print(" %s", option); 208 tty->cr(); 209 } 210}; 211 212 213 214// this must parallel the command_names below 215enum OracleCommand { 216 UnknownCommand = -1, 217 OracleFirstCommand = 0, 218 BreakCommand = OracleFirstCommand, 219 PrintCommand, 220 ExcludeCommand, 221 InlineCommand, 222 DontInlineCommand, 223 CompileOnlyCommand, 224 LogCommand, 225 OptionCommand, 226 QuietCommand, 227 HelpCommand, 228 OracleCommandCount 229}; 230 231// this must parallel the enum OracleCommand 232static const char * command_names[] = { 233 "break", 234 "print", 235 "exclude", 236 "inline", 237 "dontinline", 238 "compileonly", 239 "log", 240 "option", 241 "quiet", 242 "help" 243}; 244 245class MethodMatcher; 246static MethodMatcher* lists[OracleCommandCount] = { 0, }; 247 248 249static bool check_predicate(OracleCommand command, methodHandle method) { 250 return ((lists[command] != NULL) && 251 !method.is_null() && 252 lists[command]->match(method)); 253} 254 255 256static MethodMatcher* add_predicate(OracleCommand command, 257 Symbol* class_name, MethodMatcher::Mode c_mode, 258 Symbol* method_name, MethodMatcher::Mode m_mode, 259 Symbol* signature) { 260 assert(command != OptionCommand, "must use add_option_string"); 261 if (command == LogCommand && !LogCompilation && lists[LogCommand] == NULL) 262 tty->print_cr("Warning: +LogCompilation must be enabled in order for individual methods to be logged."); 263 lists[command] = new MethodMatcher(class_name, c_mode, method_name, m_mode, signature, lists[command]); 264 return lists[command]; 265} 266 267 268 269static MethodMatcher* add_option_string(Symbol* class_name, MethodMatcher::Mode c_mode, 270 Symbol* method_name, MethodMatcher::Mode m_mode, 271 Symbol* signature, 272 const char* option) { 273 lists[OptionCommand] = new MethodOptionMatcher(class_name, c_mode, method_name, m_mode, 274 signature, option, lists[OptionCommand]); 275 return lists[OptionCommand]; 276} 277 278 279bool CompilerOracle::has_option_string(methodHandle method, const char* option) { 280 return lists[OptionCommand] != NULL && 281 ((MethodOptionMatcher*)lists[OptionCommand])->match(method, option); 282} 283 284 285bool CompilerOracle::should_exclude(methodHandle method, bool& quietly) { 286 quietly = true; 287 if (lists[ExcludeCommand] != NULL) { 288 if (lists[ExcludeCommand]->match(method)) { 289 quietly = _quiet; 290 return true; 291 } 292 } 293 294 if (lists[CompileOnlyCommand] != NULL) { 295 return !lists[CompileOnlyCommand]->match(method); 296 } 297 return false; 298} 299 300 301bool CompilerOracle::should_inline(methodHandle method) { 302 return (check_predicate(InlineCommand, method)); 303} 304 305 306bool CompilerOracle::should_not_inline(methodHandle method) { 307 return (check_predicate(DontInlineCommand, method)); 308} 309 310 311bool CompilerOracle::should_print(methodHandle method) { 312 return (check_predicate(PrintCommand, method)); 313} 314 315bool CompilerOracle::should_print_methods() { 316 return lists[PrintCommand] != NULL; 317} 318 319bool CompilerOracle::should_log(methodHandle method) { 320 if (!LogCompilation) return false; 321 if (lists[LogCommand] == NULL) return true; // by default, log all 322 return (check_predicate(LogCommand, method)); 323} 324 325 326bool CompilerOracle::should_break_at(methodHandle method) { 327 return check_predicate(BreakCommand, method); 328} 329 330 331static OracleCommand parse_command_name(const char * line, int* bytes_read) { 332 assert(ARRAY_SIZE(command_names) == OracleCommandCount, 333 "command_names size mismatch"); 334 335 *bytes_read = 0; 336 char command[33]; 337 int result = sscanf(line, "%32[a-z]%n", command, bytes_read); 338 for (uint i = 0; i < ARRAY_SIZE(command_names); i++) { 339 if (strcmp(command, command_names[i]) == 0) { 340 return (OracleCommand)i; 341 } 342 } 343 return UnknownCommand; 344} 345 346 347static void usage() { 348 tty->print_cr(" CompileCommand and the CompilerOracle allows simple control over"); 349 tty->print_cr(" what's allowed to be compiled. The standard supported directives"); 350 tty->print_cr(" are exclude and compileonly. The exclude directive stops a method"); 351 tty->print_cr(" from being compiled and compileonly excludes all methods except for"); 352 tty->print_cr(" the ones mentioned by compileonly directives. The basic form of"); 353 tty->print_cr(" all commands is a command name followed by the name of the method"); 354 tty->print_cr(" in one of two forms: the standard class file format as in"); 355 tty->print_cr(" class/name.methodName or the PrintCompilation format"); 356 tty->print_cr(" class.name::methodName. The method name can optionally be followed"); 357 tty->print_cr(" by a space then the signature of the method in the class file"); 358 tty->print_cr(" format. Otherwise the directive applies to all methods with the"); 359 tty->print_cr(" same name and class regardless of signature. Leading and trailing"); 360 tty->print_cr(" *'s in the class and/or method name allows a small amount of"); 361 tty->print_cr(" wildcarding. "); 362 tty->cr(); 363 tty->print_cr(" Examples:"); 364 tty->cr(); 365 tty->print_cr(" exclude java/lang/StringBuffer.append"); 366 tty->print_cr(" compileonly java/lang/StringBuffer.toString ()Ljava/lang/String;"); 367 tty->print_cr(" exclude java/lang/String*.*"); 368 tty->print_cr(" exclude *.toString"); 369} 370 371 372// The characters allowed in a class or method name. All characters > 0x7f 373// are allowed in order to handle obfuscated class files (e.g. Volano) 374#define RANGEBASE "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$_<>" \ 375 "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" \ 376 "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" \ 377 "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf" \ 378 "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" \ 379 "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" \ 380 "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" \ 381 "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" \ 382 "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" 383 384#define RANGE0 "[*" RANGEBASE "]" 385#define RANGESLASH "[*" RANGEBASE "/]" 386 387static MethodMatcher::Mode check_mode(char name[], const char*& error_msg) { 388 int match = MethodMatcher::Exact; 389 while (name[0] == '*') { 390 match |= MethodMatcher::Suffix; 391 strcpy(name, name + 1); 392 } 393 394 if (strcmp(name, "*") == 0) return MethodMatcher::Any; 395 396 size_t len = strlen(name); 397 while (len > 0 && name[len - 1] == '*') { 398 match |= MethodMatcher::Prefix; 399 name[--len] = '\0'; 400 } 401 402 if (strstr(name, "*") != NULL) { 403 error_msg = " Embedded * not allowed"; 404 return MethodMatcher::Unknown; 405 } 406 return (MethodMatcher::Mode)match; 407} 408 409static bool scan_line(const char * line, 410 char class_name[], MethodMatcher::Mode* c_mode, 411 char method_name[], MethodMatcher::Mode* m_mode, 412 int* bytes_read, const char*& error_msg) { 413 *bytes_read = 0; 414 error_msg = NULL; 415 if (2 == sscanf(line, "%*[ \t]%255" RANGESLASH "%*[ ]" "%255" RANGE0 "%n", class_name, method_name, bytes_read)) { 416 *c_mode = check_mode(class_name, error_msg); 417 *m_mode = check_mode(method_name, error_msg); 418 return *c_mode != MethodMatcher::Unknown && *m_mode != MethodMatcher::Unknown; 419 } 420 return false; 421} 422 423 424 425void CompilerOracle::parse_from_line(char* line) { 426 if (line[0] == '\0') return; 427 if (line[0] == '#') return; 428 429 bool have_colon = (strstr(line, "::") != NULL); 430 for (char* lp = line; *lp != '\0'; lp++) { 431 // Allow '.' to separate the class name from the method name. 432 // This is the preferred spelling of methods: 433 // exclude java/lang/String.indexOf(I)I 434 // Allow ',' for spaces (eases command line quoting). 435 // exclude,java/lang/String.indexOf 436 // For backward compatibility, allow space as separator also. 437 // exclude java/lang/String indexOf 438 // exclude,java/lang/String,indexOf 439 // For easy cut-and-paste of method names, allow VM output format 440 // as produced by Method::print_short_name: 441 // exclude java.lang.String::indexOf 442 // For simple implementation convenience here, convert them all to space. 443 if (have_colon) { 444 if (*lp == '.') *lp = '/'; // dots build the package prefix 445 if (*lp == ':') *lp = ' '; 446 } 447 if (*lp == ',' || *lp == '.') *lp = ' '; 448 } 449 450 char* original_line = line; 451 int bytes_read; 452 OracleCommand command = parse_command_name(line, &bytes_read); 453 line += bytes_read; 454 455 if (command == UnknownCommand) { 456 tty->print_cr("CompilerOracle: unrecognized line"); 457 tty->print_cr(" \"%s\"", original_line); 458 return; 459 } 460 461 if (command == QuietCommand) { 462 _quiet = true; 463 return; 464 } 465 466 if (command == HelpCommand) { 467 usage(); 468 return; 469 } 470 471 MethodMatcher::Mode c_match = MethodMatcher::Exact; 472 MethodMatcher::Mode m_match = MethodMatcher::Exact; 473 char class_name[256]; 474 char method_name[256]; 475 char sig[1024]; 476 char errorbuf[1024]; 477 const char* error_msg = NULL; 478 MethodMatcher* match = NULL; 479 480 if (scan_line(line, class_name, &c_match, method_name, &m_match, &bytes_read, error_msg)) { 481 EXCEPTION_MARK; 482 Symbol* c_name = SymbolTable::new_symbol(class_name, CHECK); 483 Symbol* m_name = SymbolTable::new_symbol(method_name, CHECK); 484 Symbol* signature = NULL; 485 486 line += bytes_read; 487 // there might be a signature following the method. 488 // signatures always begin with ( so match that by hand 489 if (1 == sscanf(line, "%*[ \t](%254[[);/" RANGEBASE "]%n", sig + 1, &bytes_read)) { 490 sig[0] = '('; 491 line += bytes_read; 492 signature = SymbolTable::new_symbol(sig, CHECK); 493 } 494 495 if (command == OptionCommand) { 496 // Look for trailing options to support 497 // ciMethod::has_option("string") to control features in the 498 // compiler. Multiple options may follow the method name. 499 char option[256]; 500 while (sscanf(line, "%*[ \t]%255[a-zA-Z0-9]%n", option, &bytes_read) == 1) { 501 if (match != NULL && !_quiet) { 502 // Print out the last match added 503 tty->print("CompilerOracle: %s ", command_names[command]); 504 match->print(); 505 } 506 match = add_option_string(c_name, c_match, m_name, m_match, signature, option); 507 line += bytes_read; 508 } 509 } else { 510 bytes_read = 0; 511 sscanf(line, "%*[ \t]%n", &bytes_read); 512 if (line[bytes_read] != '\0') { 513 jio_snprintf(errorbuf, sizeof(errorbuf), " Unrecognized text after command: %s", line); 514 error_msg = errorbuf; 515 } else { 516 match = add_predicate(command, c_name, c_match, m_name, m_match, signature); 517 } 518 } 519 } 520 521 if (match != NULL) { 522 if (!_quiet) { 523 ResourceMark rm; 524 tty->print("CompilerOracle: %s ", command_names[command]); 525 match->print(); 526 } 527 } else { 528 tty->print_cr("CompilerOracle: unrecognized line"); 529 tty->print_cr(" \"%s\"", original_line); 530 if (error_msg != NULL) { 531 tty->print_cr("%s", error_msg); 532 } 533 } 534} 535 536static const char* default_cc_file = ".hotspot_compiler"; 537 538static const char* cc_file() { 539#ifdef ASSERT 540 if (CompileCommandFile == NULL) 541 return default_cc_file; 542#endif 543 return CompileCommandFile; 544} 545 546bool CompilerOracle::has_command_file() { 547 return cc_file() != NULL; 548} 549 550bool CompilerOracle::_quiet = false; 551 552void CompilerOracle::parse_from_file() { 553 assert(has_command_file(), "command file must be specified"); 554 FILE* stream = fopen(cc_file(), "rt"); 555 if (stream == NULL) return; 556 557 char token[1024]; 558 int pos = 0; 559 int c = getc(stream); 560 while(c != EOF && pos < (int)(sizeof(token)-1)) { 561 if (c == '\n') { 562 token[pos++] = '\0'; 563 parse_from_line(token); 564 pos = 0; 565 } else { 566 token[pos++] = c; 567 } 568 c = getc(stream); 569 } 570 token[pos++] = '\0'; 571 parse_from_line(token); 572 573 fclose(stream); 574} 575 576void CompilerOracle::parse_from_string(const char* str, void (*parse_line)(char*)) { 577 char token[1024]; 578 int pos = 0; 579 const char* sp = str; 580 int c = *sp++; 581 while (c != '\0' && pos < (int)(sizeof(token)-1)) { 582 if (c == '\n') { 583 token[pos++] = '\0'; 584 parse_line(token); 585 pos = 0; 586 } else { 587 token[pos++] = c; 588 } 589 c = *sp++; 590 } 591 token[pos++] = '\0'; 592 parse_line(token); 593} 594 595void CompilerOracle::append_comment_to_file(const char* message) { 596 assert(has_command_file(), "command file must be specified"); 597 fileStream stream(fopen(cc_file(), "at")); 598 stream.print("# "); 599 for (int index = 0; message[index] != '\0'; index++) { 600 stream.put(message[index]); 601 if (message[index] == '\n') stream.print("# "); 602 } 603 stream.cr(); 604} 605 606void CompilerOracle::append_exclude_to_file(methodHandle method) { 607 assert(has_command_file(), "command file must be specified"); 608 fileStream stream(fopen(cc_file(), "at")); 609 stream.print("exclude "); 610 method->method_holder()->name()->print_symbol_on(&stream); 611 stream.print("."); 612 method->name()->print_symbol_on(&stream); 613 method->signature()->print_symbol_on(&stream); 614 stream.cr(); 615 stream.cr(); 616} 617 618 619void compilerOracle_init() { 620 CompilerOracle::parse_from_string(CompileCommand, CompilerOracle::parse_from_line); 621 CompilerOracle::parse_from_string(CompileOnly, CompilerOracle::parse_compile_only); 622 if (CompilerOracle::has_command_file()) { 623 CompilerOracle::parse_from_file(); 624 } else { 625 struct stat buf; 626 if (os::stat(default_cc_file, &buf) == 0) { 627 warning("%s file is present but has been ignored. " 628 "Run with -XX:CompileCommandFile=%s to load the file.", 629 default_cc_file, default_cc_file); 630 } 631 } 632 if (lists[PrintCommand] != NULL) { 633 if (PrintAssembly) { 634 warning("CompileCommand and/or %s file contains 'print' commands, but PrintAssembly is also enabled", default_cc_file); 635 } else if (FLAG_IS_DEFAULT(DebugNonSafepoints)) { 636 warning("printing of assembly code is enabled; turning on DebugNonSafepoints to gain additional output"); 637 DebugNonSafepoints = true; 638 } 639 } 640} 641 642 643void CompilerOracle::parse_compile_only(char * line) { 644 int i; 645 char name[1024]; 646 const char* className = NULL; 647 const char* methodName = NULL; 648 649 bool have_colon = (strstr(line, "::") != NULL); 650 char method_sep = have_colon ? ':' : '.'; 651 652 if (Verbose) { 653 tty->print_cr("%s", line); 654 } 655 656 ResourceMark rm; 657 while (*line != '\0') { 658 MethodMatcher::Mode c_match = MethodMatcher::Exact; 659 MethodMatcher::Mode m_match = MethodMatcher::Exact; 660 661 for (i = 0; 662 i < 1024 && *line != '\0' && *line != method_sep && *line != ',' && !isspace(*line); 663 line++, i++) { 664 name[i] = *line; 665 if (name[i] == '.') name[i] = '/'; // package prefix uses '/' 666 } 667 668 if (i > 0) { 669 char* newName = NEW_RESOURCE_ARRAY( char, i + 1); 670 if (newName == NULL) 671 return; 672 strncpy(newName, name, i); 673 newName[i] = '\0'; 674 675 if (className == NULL) { 676 className = newName; 677 c_match = MethodMatcher::Prefix; 678 } else { 679 methodName = newName; 680 } 681 } 682 683 if (*line == method_sep) { 684 if (className == NULL) { 685 className = ""; 686 c_match = MethodMatcher::Any; 687 } else { 688 // foo/bar.blah is an exact match on foo/bar, bar.blah is a suffix match on bar 689 if (strchr(className, '/') != NULL) { 690 c_match = MethodMatcher::Exact; 691 } else { 692 c_match = MethodMatcher::Suffix; 693 } 694 } 695 } else { 696 // got foo or foo/bar 697 if (className == NULL) { 698 ShouldNotReachHere(); 699 } else { 700 // got foo or foo/bar 701 if (strchr(className, '/') != NULL) { 702 c_match = MethodMatcher::Prefix; 703 } else if (className[0] == '\0') { 704 c_match = MethodMatcher::Any; 705 } else { 706 c_match = MethodMatcher::Substring; 707 } 708 } 709 } 710 711 // each directive is terminated by , or NUL or . followed by NUL 712 if (*line == ',' || *line == '\0' || (line[0] == '.' && line[1] == '\0')) { 713 if (methodName == NULL) { 714 methodName = ""; 715 if (*line != method_sep) { 716 m_match = MethodMatcher::Any; 717 } 718 } 719 720 EXCEPTION_MARK; 721 Symbol* c_name = SymbolTable::new_symbol(className, CHECK); 722 Symbol* m_name = SymbolTable::new_symbol(methodName, CHECK); 723 Symbol* signature = NULL; 724 725 add_predicate(CompileOnlyCommand, c_name, c_match, m_name, m_match, signature); 726 if (PrintVMOptions) { 727 tty->print("CompileOnly: compileonly "); 728 lists[CompileOnlyCommand]->print(); 729 } 730 731 className = NULL; 732 methodName = NULL; 733 } 734 735 line = *line == '\0' ? line : line + 1; 736 } 737} 738