src/share/vm/compiler/compilerOracle.cpp

changeset 2497
3582bf76420e
parent 2400
781072b12368
child 2708
1d1603768966
     1.1 --- a/src/share/vm/compiler/compilerOracle.cpp	Thu Jan 27 13:42:28 2011 -0800
     1.2 +++ b/src/share/vm/compiler/compilerOracle.cpp	Thu Jan 27 16:11:27 2011 -0800
     1.3 @@ -30,7 +30,7 @@
     1.4  #include "oops/klass.hpp"
     1.5  #include "oops/methodOop.hpp"
     1.6  #include "oops/oop.inline.hpp"
     1.7 -#include "oops/symbolOop.hpp"
     1.8 +#include "oops/symbol.hpp"
     1.9  #include "runtime/handles.inline.hpp"
    1.10  #include "runtime/jniHandles.hpp"
    1.11  
    1.12 @@ -46,33 +46,33 @@
    1.13    };
    1.14  
    1.15   protected:
    1.16 -  jobject        _class_name;
    1.17 +  Symbol*        _class_name;
    1.18 +  Symbol*        _method_name;
    1.19 +  Symbol*        _signature;
    1.20    Mode           _class_mode;
    1.21 -  jobject        _method_name;
    1.22    Mode           _method_mode;
    1.23 -  jobject        _signature;
    1.24    MethodMatcher* _next;
    1.25  
    1.26 -  static bool match(symbolHandle candidate, symbolHandle match, Mode match_mode);
    1.27 +  static bool match(Symbol* candidate, Symbol* match, Mode match_mode);
    1.28  
    1.29 -  symbolHandle class_name() const { return (symbolOop)JNIHandles::resolve_non_null(_class_name); }
    1.30 -  symbolHandle method_name() const { return (symbolOop)JNIHandles::resolve_non_null(_method_name); }
    1.31 -  symbolHandle signature() const { return (symbolOop)JNIHandles::resolve(_signature); }
    1.32 +  Symbol* class_name() const { return _class_name; }
    1.33 +  Symbol* method_name() const { return _method_name; }
    1.34 +  Symbol* signature() const { return _signature; }
    1.35  
    1.36   public:
    1.37 -  MethodMatcher(symbolHandle class_name, Mode class_mode,
    1.38 -                symbolHandle method_name, Mode method_mode,
    1.39 -                symbolHandle signature, MethodMatcher* next);
    1.40 -  MethodMatcher(symbolHandle class_name, symbolHandle method_name, MethodMatcher* next);
    1.41 +  MethodMatcher(Symbol* class_name, Mode class_mode,
    1.42 +                Symbol* method_name, Mode method_mode,
    1.43 +                Symbol* signature, MethodMatcher* next);
    1.44 +  MethodMatcher(Symbol* class_name, Symbol* method_name, MethodMatcher* next);
    1.45  
    1.46    // utility method
    1.47    MethodMatcher* find(methodHandle method) {
    1.48 -    symbolHandle class_name  = Klass::cast(method->method_holder())->name();
    1.49 -    symbolHandle method_name = method->name();
    1.50 +    Symbol* class_name  = Klass::cast(method->method_holder())->name();
    1.51 +    Symbol* method_name = method->name();
    1.52      for (MethodMatcher* current = this; current != NULL; current = current->_next) {
    1.53        if (match(class_name, current->class_name(), current->_class_mode) &&
    1.54            match(method_name, current->method_name(), current->_method_mode) &&
    1.55 -          (current->signature().is_null() || current->signature()() == method->signature())) {
    1.56 +          (current->signature() == NULL || current->signature() == method->signature())) {
    1.57          return current;
    1.58        }
    1.59      }
    1.60 @@ -85,14 +85,14 @@
    1.61  
    1.62    MethodMatcher* next() const { return _next; }
    1.63  
    1.64 -  static void print_symbol(symbolHandle h, Mode mode) {
    1.65 +  static void print_symbol(Symbol* h, Mode mode) {
    1.66      ResourceMark rm;
    1.67  
    1.68      if (mode == Suffix || mode == Substring || mode == Any) {
    1.69        tty->print("*");
    1.70      }
    1.71      if (mode != Any) {
    1.72 -      h()->print_symbol_on(tty);
    1.73 +      h->print_symbol_on(tty);
    1.74      }
    1.75      if (mode == Prefix || mode == Substring) {
    1.76        tty->print("*");
    1.77 @@ -103,7 +103,7 @@
    1.78      print_symbol(class_name(), _class_mode);
    1.79      tty->print(".");
    1.80      print_symbol(method_name(), _method_mode);
    1.81 -    if (!signature().is_null()) {
    1.82 +    if (signature() != NULL) {
    1.83        tty->print(" ");
    1.84        signature()->print_symbol_on(tty);
    1.85      }
    1.86 @@ -115,9 +115,9 @@
    1.87    }
    1.88  };
    1.89  
    1.90 -MethodMatcher::MethodMatcher(symbolHandle class_name, symbolHandle method_name, MethodMatcher* next) {
    1.91 -  _class_name  = JNIHandles::make_global(class_name);
    1.92 -  _method_name = JNIHandles::make_global(method_name);
    1.93 +MethodMatcher::MethodMatcher(Symbol* class_name, Symbol* method_name, MethodMatcher* next) {
    1.94 +  _class_name  = class_name;
    1.95 +  _method_name = method_name;
    1.96    _next        = next;
    1.97    _class_mode  = MethodMatcher::Exact;
    1.98    _method_mode = MethodMatcher::Exact;
    1.99 @@ -125,24 +125,24 @@
   1.100  }
   1.101  
   1.102  
   1.103 -MethodMatcher::MethodMatcher(symbolHandle class_name, Mode class_mode,
   1.104 -                             symbolHandle method_name, Mode method_mode,
   1.105 -                             symbolHandle signature, MethodMatcher* next):
   1.106 +MethodMatcher::MethodMatcher(Symbol* class_name, Mode class_mode,
   1.107 +                             Symbol* method_name, Mode method_mode,
   1.108 +                             Symbol* signature, MethodMatcher* next):
   1.109      _class_mode(class_mode)
   1.110    , _method_mode(method_mode)
   1.111    , _next(next)
   1.112 -  , _class_name(JNIHandles::make_global(class_name()))
   1.113 -  , _method_name(JNIHandles::make_global(method_name()))
   1.114 -  , _signature(JNIHandles::make_global(signature())) {
   1.115 +  , _class_name(class_name)
   1.116 +  , _method_name(method_name)
   1.117 +  , _signature(signature) {
   1.118  }
   1.119  
   1.120 -bool MethodMatcher::match(symbolHandle candidate, symbolHandle match, Mode match_mode) {
   1.121 +bool MethodMatcher::match(Symbol* candidate, Symbol* match, Mode match_mode) {
   1.122    if (match_mode == Any) {
   1.123      return true;
   1.124    }
   1.125  
   1.126    if (match_mode == Exact) {
   1.127 -    return candidate() == match();
   1.128 +    return candidate == match;
   1.129    }
   1.130  
   1.131    ResourceMark rm;
   1.132 @@ -171,9 +171,9 @@
   1.133  class MethodOptionMatcher: public MethodMatcher {
   1.134    const char * option;
   1.135   public:
   1.136 -  MethodOptionMatcher(symbolHandle class_name, Mode class_mode,
   1.137 -                             symbolHandle method_name, Mode method_mode,
   1.138 -                             symbolHandle signature, const char * opt, MethodMatcher* next):
   1.139 +  MethodOptionMatcher(Symbol* class_name, Mode class_mode,
   1.140 +                             Symbol* method_name, Mode method_mode,
   1.141 +                             Symbol* signature, const char * opt, MethodMatcher* next):
   1.142      MethodMatcher(class_name, class_mode, method_name, method_mode, signature, next) {
   1.143      option = opt;
   1.144    }
   1.145 @@ -256,9 +256,9 @@
   1.146  
   1.147  
   1.148  static MethodMatcher* add_predicate(OracleCommand command,
   1.149 -                                    symbolHandle class_name, MethodMatcher::Mode c_mode,
   1.150 -                                    symbolHandle method_name, MethodMatcher::Mode m_mode,
   1.151 -                                    symbolHandle signature) {
   1.152 +                                    Symbol* class_name, MethodMatcher::Mode c_mode,
   1.153 +                                    Symbol* method_name, MethodMatcher::Mode m_mode,
   1.154 +                                    Symbol* signature) {
   1.155    assert(command != OptionCommand, "must use add_option_string");
   1.156    if (command == LogCommand && !LogCompilation && lists[LogCommand] == NULL)
   1.157      tty->print_cr("Warning:  +LogCompilation must be enabled in order for individual methods to be logged.");
   1.158 @@ -268,9 +268,9 @@
   1.159  
   1.160  
   1.161  
   1.162 -static MethodMatcher* add_option_string(symbolHandle class_name, MethodMatcher::Mode c_mode,
   1.163 -                                        symbolHandle method_name, MethodMatcher::Mode m_mode,
   1.164 -                                        symbolHandle signature,
   1.165 +static MethodMatcher* add_option_string(Symbol* class_name, MethodMatcher::Mode c_mode,
   1.166 +                                        Symbol* method_name, MethodMatcher::Mode m_mode,
   1.167 +                                        Symbol* signature,
   1.168                                          const char* option) {
   1.169    lists[OptionCommand] = new MethodOptionMatcher(class_name, c_mode, method_name, m_mode,
   1.170                                                   signature, option, lists[OptionCommand]);
   1.171 @@ -497,9 +497,9 @@
   1.172  
   1.173    if (scan_line(line, class_name, &c_match, method_name, &m_match, &bytes_read, error_msg)) {
   1.174      EXCEPTION_MARK;
   1.175 -    symbolHandle c_name = oopFactory::new_symbol_handle(class_name, CHECK);
   1.176 -    symbolHandle m_name = oopFactory::new_symbol_handle(method_name, CHECK);
   1.177 -    symbolHandle signature;
   1.178 +    Symbol* c_name = SymbolTable::new_symbol(class_name, CHECK);
   1.179 +    Symbol* m_name = SymbolTable::new_symbol(method_name, CHECK);
   1.180 +    Symbol* signature = NULL;
   1.181  
   1.182      line += bytes_read;
   1.183      // there might be a signature following the method.
   1.184 @@ -507,7 +507,7 @@
   1.185      if (1 == sscanf(line, "%*[ \t](%254[[);/" RANGEBASE "]%n", sig + 1, &bytes_read)) {
   1.186        sig[0] = '(';
   1.187        line += bytes_read;
   1.188 -      signature = oopFactory::new_symbol_handle(sig, CHECK);
   1.189 +      signature = SymbolTable::new_symbol(sig, CHECK);
   1.190      }
   1.191  
   1.192      if (command == OptionCommand) {
   1.193 @@ -714,9 +714,9 @@
   1.194        }
   1.195  
   1.196        EXCEPTION_MARK;
   1.197 -      symbolHandle c_name = oopFactory::new_symbol_handle(className, CHECK);
   1.198 -      symbolHandle m_name = oopFactory::new_symbol_handle(methodName, CHECK);
   1.199 -      symbolHandle signature;
   1.200 +      Symbol* c_name = SymbolTable::new_symbol(className, CHECK);
   1.201 +      Symbol* m_name = SymbolTable::new_symbol(methodName, CHECK);
   1.202 +      Symbol* signature = NULL;
   1.203  
   1.204        add_predicate(CompileOnlyCommand, c_name, c_match, m_name, m_match, signature);
   1.205        if (PrintVMOptions) {

mercurial