hotspot/src/share/vm/compiler/methodMatcher.hpp
changeset 33451 0712796e4039
parent 33069 d8eed614f298
child 33626 3c94db05e903
equal deleted inserted replaced
33450:08222df07d0d 33451:0712796e4039
    79 
    79 
    80   BasicMatcher(BasicMatcher* next) :
    80   BasicMatcher(BasicMatcher* next) :
    81     _next(next) {
    81     _next(next) {
    82   }
    82   }
    83 
    83 
    84   static BasicMatcher* parse_method_pattern(char* line, const char*& error_msg) {
    84   static BasicMatcher* parse_method_pattern(char* line, const char*& error_msg);
    85     assert(error_msg == NULL, "Dont call here with error_msg already set");
    85   bool match(methodHandle method);
    86     BasicMatcher* bm = new BasicMatcher();
       
    87     MethodMatcher::parse_method_pattern(line, error_msg, bm);
       
    88     if (error_msg != NULL) {
       
    89       delete bm;
       
    90       return NULL;
       
    91     }
       
    92 
       
    93     // check for bad trailing characters
       
    94     int bytes_read = 0;
       
    95     sscanf(line, "%*[ \t]%n", &bytes_read);
       
    96     if (line[bytes_read] != '\0') {
       
    97       error_msg = "Unrecognized trailing text after method pattern";
       
    98       delete bm;
       
    99       return NULL;
       
   100     }
       
   101     return bm;
       
   102   }
       
   103 
       
   104   bool match(methodHandle method) {
       
   105     for (BasicMatcher* current = this; current != NULL; current = current->next()) {
       
   106       if (current->matches(method)) {
       
   107         return true;
       
   108       }
       
   109     }
       
   110     return false;
       
   111   }
       
   112 
       
   113   void set_next(BasicMatcher* next) { _next = next; }
    86   void set_next(BasicMatcher* next) { _next = next; }
   114   BasicMatcher* next() { return _next; }
    87   BasicMatcher* next() { return _next; }
   115 
    88 
   116   void print(outputStream* st) { print_base(st); }
    89   void print(outputStream* st) { print_base(st); }
   117   void print_all(outputStream* st) {
    90   void print_all(outputStream* st) {
   120       _next->print_all(st);
    93       _next->print_all(st);
   121     }
    94     }
   122   }
    95   }
   123 };
    96 };
   124 
    97 
       
    98 class InlineMatcher : public MethodMatcher {
       
    99 public:
       
   100   enum InlineType {
       
   101       unknown_inline,
       
   102       dont_inline,
       
   103       force_inline
       
   104     };
       
   105 
       
   106 private:
       
   107   InlineType _inline_action;
       
   108   InlineMatcher * _next;
       
   109 
       
   110   InlineMatcher() : MethodMatcher(),
       
   111     _inline_action(unknown_inline), _next(NULL) {
       
   112   }
       
   113 
       
   114 public:
       
   115   static InlineMatcher* parse_method_pattern(char* line, const char*& error_msg);
       
   116   bool match(methodHandle method, int inline_action);
       
   117   void print(outputStream* st);
       
   118   void set_next(InlineMatcher* next) { _next = next; }
       
   119   InlineMatcher* next() { return _next; }
       
   120   void set_action(InlineType inline_action) { _inline_action = inline_action; }
       
   121   int inline_action() { return _inline_action; }
       
   122   static InlineMatcher* parse_inline_pattern(char* line, const char*& error_msg);
       
   123   InlineMatcher* clone();
       
   124 };
       
   125 
   125 #endif // SHARE_VM_COMPILER_METHODMATCHER_HPP
   126 #endif // SHARE_VM_COMPILER_METHODMATCHER_HPP
   126 
   127