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

src/share/vm/compiler/compilerOracle.cpp

Print this page




  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);


 125 }
 126 
 127 
 128 MethodMatcher::MethodMatcher(Symbol* class_name, Mode class_mode,
 129                              Symbol* method_name, Mode method_mode,
 130                              Symbol* signature, MethodMatcher* next):
 131     _class_mode(class_mode)
 132   , _method_mode(method_mode)
 133   , _next(next)
 134   , _class_name(class_name)
 135   , _method_name(method_name)
 136   , _signature(signature) {
 137 }
 138 
 139 bool MethodMatcher::match(Symbol* candidate, Symbol* match, Mode match_mode) {
 140   if (match_mode == Any) {
 141     return true;
 142   }
 143 
 144   if (match_mode == Exact) {
 145     return candidate == match;
 146   }
 147 
 148   ResourceMark rm;
 149   const char * candidate_string = candidate->as_C_string();
 150   const char * match_string = match->as_C_string();
 151 
 152   switch (match_mode) {
 153   case Prefix:
 154     return strstr(candidate_string, match_string) == candidate_string;
 155 
 156   case Suffix: {
 157     size_t clen = strlen(candidate_string);
 158     size_t mlen = strlen(match_string);
 159     return clen >= mlen && strcmp(candidate_string + clen - mlen, match_string) == 0;
 160   }
 161 
 162   case Substring:
 163     return strstr(candidate_string, match_string) != NULL;
 164 
 165   default:




  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()->equals(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);


 125 }
 126 
 127 
 128 MethodMatcher::MethodMatcher(Symbol* class_name, Mode class_mode,
 129                              Symbol* method_name, Mode method_mode,
 130                              Symbol* signature, MethodMatcher* next):
 131     _class_mode(class_mode)
 132   , _method_mode(method_mode)
 133   , _next(next)
 134   , _class_name(class_name)
 135   , _method_name(method_name)
 136   , _signature(signature) {
 137 }
 138 
 139 bool MethodMatcher::match(Symbol* candidate, Symbol* match, Mode match_mode) {
 140   if (match_mode == Any) {
 141     return true;
 142   }
 143 
 144   if (match_mode == Exact) {
 145     return candidate->equals(match);
 146   }
 147 
 148   ResourceMark rm;
 149   const char * candidate_string = candidate->as_C_string();
 150   const char * match_string = match->as_C_string();
 151 
 152   switch (match_mode) {
 153   case Prefix:
 154     return strstr(candidate_string, match_string) == candidate_string;
 155 
 156   case Suffix: {
 157     size_t clen = strlen(candidate_string);
 158     size_t mlen = strlen(match_string);
 159     return clen >= mlen && strcmp(candidate_string + clen - mlen, match_string) == 0;
 160   }
 161 
 162   case Substring:
 163     return strstr(candidate_string, match_string) != NULL;
 164 
 165   default:


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