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

src/share/vm/compiler/methodMatcher.cpp

Print this page
rev 9032 : 8137167: JEP165: Compiler Control: Implementation task
Summary: Compiler Control JEP
Reviewed-by: roland, twisti


 325   if (mode == Suffix || mode == Substring || mode == Any) {
 326     st->print("*");
 327   }
 328   if (mode != Any) {
 329     h->print_symbol_on(st);
 330   }
 331   if (mode == Prefix || mode == Substring) {
 332     st->print("*");
 333   }
 334 }
 335 
 336 void MethodMatcher::print_base(outputStream* st) {
 337   print_symbol(st, class_name(), _class_mode);
 338   st->print(".");
 339   print_symbol(st, method_name(), _method_mode);
 340   if (signature() != NULL) {
 341     signature()->print_symbol_on(st);
 342   }
 343 }
 344 








 345 










 346 








 347 













































































 325   if (mode == Suffix || mode == Substring || mode == Any) {
 326     st->print("*");
 327   }
 328   if (mode != Any) {
 329     h->print_symbol_on(st);
 330   }
 331   if (mode == Prefix || mode == Substring) {
 332     st->print("*");
 333   }
 334 }
 335 
 336 void MethodMatcher::print_base(outputStream* st) {
 337   print_symbol(st, class_name(), _class_mode);
 338   st->print(".");
 339   print_symbol(st, method_name(), _method_mode);
 340   if (signature() != NULL) {
 341     signature()->print_symbol_on(st);
 342   }
 343 }
 344 
 345 BasicMatcher* BasicMatcher::parse_method_pattern(char* line, const char*& error_msg) {
 346   assert(error_msg == NULL, "Don't call here with error_msg already set");
 347   BasicMatcher* bm = new BasicMatcher();
 348   MethodMatcher::parse_method_pattern(line, error_msg, bm);
 349   if (error_msg != NULL) {
 350     delete bm;
 351     return NULL;
 352   }
 353 
 354   // check for bad trailing characters
 355   int bytes_read = 0;
 356   sscanf(line, "%*[ \t]%n", &bytes_read);
 357   if (line[bytes_read] != '\0') {
 358     error_msg = "Unrecognized trailing text after method pattern";
 359     delete bm;
 360     return NULL;
 361   }
 362   return bm;
 363 }
 364 
 365 bool BasicMatcher::match(methodHandle method) {
 366   for (BasicMatcher* current = this; current != NULL; current = current->next()) {
 367     if (current->matches(method)) {
 368       return true;
 369     }
 370   }
 371   return false;
 372 }
 373 
 374 void InlineMatcher::print(outputStream* st) {
 375   if (_inline_action == InlineMatcher::force_inline) {
 376     st->print("+");
 377   } else {
 378     st->print("-");
 379   }
 380   print_base(st);
 381 }
 382 
 383 InlineMatcher* InlineMatcher::parse_method_pattern(char* line, const char*& error_msg) {
 384   assert(error_msg == NULL, "Dont call here with error_msg already set");
 385   InlineMatcher* im = new InlineMatcher();
 386   MethodMatcher::parse_method_pattern(line, error_msg, im);
 387   if (error_msg != NULL) {
 388     delete im;
 389     return NULL;
 390   }
 391   return im;
 392 }
 393 
 394 bool InlineMatcher::match(methodHandle method, int inline_action) {
 395   for (InlineMatcher* current = this; current != NULL; current = current->next()) {
 396     if (current->matches(method)) {
 397       return (current->_inline_action == inline_action);
 398     }
 399   }
 400   return false;
 401 }
 402 
 403 InlineMatcher* InlineMatcher::parse_inline_pattern(char* str, const char*& error_msg) {
 404   // check first token is +/-
 405   InlineType _inline_action;
 406    switch (str[0]) {
 407    case '-':
 408      _inline_action = InlineMatcher::dont_inline;
 409      break;
 410    case '+':
 411      _inline_action = InlineMatcher::force_inline;
 412      break;
 413    default:
 414      error_msg = "Missing leading inline type (+/-)";
 415      return NULL;
 416    }
 417    str++;
 418 
 419    int bytes_read = 0;
 420    assert(error_msg== NULL, "error_msg must not be set yet");
 421    InlineMatcher* im = InlineMatcher::parse_method_pattern(str, error_msg);
 422    if (im == NULL) {
 423      assert(error_msg != NULL, "Must have error message");
 424      return NULL;
 425    }
 426    im->set_action(_inline_action);
 427    return im;
 428 }
 429 
 430 InlineMatcher* InlineMatcher::clone() {
 431    InlineMatcher* m = new InlineMatcher();
 432    m->_class_mode =  _class_mode;
 433    m->_method_mode = _method_mode;
 434    m->_inline_action = _inline_action;
 435    m->_class_name = _class_name;
 436    if(_class_name != NULL) {
 437      _class_name->increment_refcount();
 438    }
 439    m->_method_name = _method_name;
 440    if (_method_name != NULL) {
 441      _method_name->increment_refcount();
 442    }
 443    m->_signature = _signature;
 444    if (_signature != NULL) {
 445      _signature->increment_refcount();
 446    }
 447    return m;
 448 }
src/share/vm/compiler/methodMatcher.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File