src/share/vm/runtime/fprofiler.cpp

changeset 4037
da91efe96a93
parent 3969
1d7922586cf6
child 4936
aeaca88565e6
     1.1 --- a/src/share/vm/runtime/fprofiler.cpp	Fri Aug 31 16:39:35 2012 -0700
     1.2 +++ b/src/share/vm/runtime/fprofiler.cpp	Sat Sep 01 13:25:18 2012 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -288,9 +288,9 @@
    1.11    virtual bool is_runtime_stub() const{ return false; }
    1.12    virtual void oops_do(OopClosure* f) = 0;
    1.13  
    1.14 -  virtual bool interpreted_match(methodOop m) const { return false; }
    1.15 -  virtual bool compiled_match(methodOop m ) const { return false; }
    1.16 -  virtual bool stub_match(methodOop m, const char* name) const { return false; }
    1.17 +  virtual bool interpreted_match(Method* m) const { return false; }
    1.18 +  virtual bool compiled_match(Method* m ) const { return false; }
    1.19 +  virtual bool stub_match(Method* m, const char* name) const { return false; }
    1.20    virtual bool adapter_match() const { return false; }
    1.21    virtual bool runtimeStub_match(const CodeBlob* stub, const char* name) const { return false; }
    1.22    virtual bool unknown_compiled_match(const CodeBlob* cb) const { return false; }
    1.23 @@ -312,12 +312,12 @@
    1.24      st->cr();
    1.25    }
    1.26  
    1.27 -  virtual methodOop method()         = 0;
    1.28 +  virtual Method* method()         = 0;
    1.29  
    1.30    virtual void print_method_on(outputStream* st) {
    1.31      int limit;
    1.32      int i;
    1.33 -    methodOop m = method();
    1.34 +    Method* m = method();
    1.35      Symbol* k = m->klass_name();
    1.36      // Print the class name with dots instead of slashes
    1.37      limit = k->utf8_length();
    1.38 @@ -342,7 +342,7 @@
    1.39        Symbol* sig = m->signature();
    1.40        sig->print_symbol_on(st);
    1.41      } else if (MethodHandles::is_signature_polymorphic(m->intrinsic_id()))
    1.42 -      // compare with methodOopDesc::print_short_name
    1.43 +      // compare with Method::print_short_name
    1.44        MethodHandles::print_as_basic_type_signature_on(st, m->signature(), true);
    1.45    }
    1.46  
    1.47 @@ -356,7 +356,7 @@
    1.48    }
    1.49  
    1.50    // for hashing into the table
    1.51 -  static int hash(methodOop method) {
    1.52 +  static int hash(Method* method) {
    1.53        // The point here is to try to make something fairly unique
    1.54        // out of the fields we can read without grabbing any locks
    1.55        // since the method may be locked when we need the hash.
    1.56 @@ -388,24 +388,26 @@
    1.57  
    1.58  class interpretedNode : public ProfilerNode {
    1.59   private:
    1.60 -   methodOop _method;
    1.61 +   Method* _method;
    1.62 +   oop       _class_loader;  // needed to keep metadata for the method alive
    1.63   public:
    1.64 -   interpretedNode(methodOop method, TickPosition where) : ProfilerNode() {
    1.65 +   interpretedNode(Method* method, TickPosition where) : ProfilerNode() {
    1.66       _method = method;
    1.67 +     _class_loader = method->method_holder()->class_loader();
    1.68       update(where);
    1.69     }
    1.70  
    1.71     bool is_interpreted() const { return true; }
    1.72  
    1.73 -   bool interpreted_match(methodOop m) const {
    1.74 +   bool interpreted_match(Method* m) const {
    1.75        return _method == m;
    1.76     }
    1.77  
    1.78     void oops_do(OopClosure* f) {
    1.79 -     f->do_oop((oop*)&_method);
    1.80 +     f->do_oop(&_class_loader);
    1.81     }
    1.82  
    1.83 -   methodOop method() { return _method; }
    1.84 +   Method* method() { return _method; }
    1.85  
    1.86     static void print_title(outputStream* st) {
    1.87       st->fill_to(col1);
    1.88 @@ -425,22 +427,24 @@
    1.89  
    1.90  class compiledNode : public ProfilerNode {
    1.91   private:
    1.92 -   methodOop _method;
    1.93 +   Method* _method;
    1.94 +   oop       _class_loader;  // needed to keep metadata for the method alive
    1.95   public:
    1.96 -   compiledNode(methodOop method, TickPosition where) : ProfilerNode() {
    1.97 +   compiledNode(Method* method, TickPosition where) : ProfilerNode() {
    1.98       _method = method;
    1.99 +     _class_loader = method->method_holder()->class_loader();
   1.100       update(where);
   1.101    }
   1.102    bool is_compiled()    const { return true; }
   1.103  
   1.104 -  bool compiled_match(methodOop m) const {
   1.105 +  bool compiled_match(Method* m) const {
   1.106      return _method == m;
   1.107    }
   1.108  
   1.109 -  methodOop method()         { return _method; }
   1.110 +  Method* method()         { return _method; }
   1.111  
   1.112    void oops_do(OopClosure* f) {
   1.113 -    f->do_oop((oop*)&_method);
   1.114 +    f->do_oop(&_class_loader);
   1.115    }
   1.116  
   1.117    static void print_title(outputStream* st) {
   1.118 @@ -460,26 +464,28 @@
   1.119  
   1.120  class stubNode : public ProfilerNode {
   1.121   private:
   1.122 -  methodOop _method;
   1.123 +  Method* _method;
   1.124 +  oop       _class_loader;  // needed to keep metadata for the method alive
   1.125    const char* _symbol;   // The name of the nearest VM symbol (for +ProfileVM). Points to a unique string
   1.126   public:
   1.127 -   stubNode(methodOop method, const char* name, TickPosition where) : ProfilerNode() {
   1.128 +   stubNode(Method* method, const char* name, TickPosition where) : ProfilerNode() {
   1.129       _method = method;
   1.130 +     _class_loader = method->method_holder()->class_loader();
   1.131       _symbol = name;
   1.132       update(where);
   1.133     }
   1.134  
   1.135     bool is_stub() const { return true; }
   1.136  
   1.137 -   bool stub_match(methodOop m, const char* name) const {
   1.138 +   void oops_do(OopClosure* f) {
   1.139 +     f->do_oop(&_class_loader);
   1.140 +   }
   1.141 +
   1.142 +   bool stub_match(Method* m, const char* name) const {
   1.143       return (_method == m) && (_symbol == name);
   1.144     }
   1.145  
   1.146 -   void oops_do(OopClosure* f) {
   1.147 -     f->do_oop((oop*)&_method);
   1.148 -   }
   1.149 -
   1.150 -   methodOop method() { return _method; }
   1.151 +   Method* method() { return _method; }
   1.152  
   1.153     static void print_title(outputStream* st) {
   1.154       st->fill_to(col1);
   1.155 @@ -512,7 +518,7 @@
   1.156  
   1.157    bool adapter_match() const { return true; }
   1.158  
   1.159 -  methodOop method()         { return NULL; }
   1.160 +  Method* method()         { return NULL; }
   1.161  
   1.162    void oops_do(OopClosure* f) {
   1.163      ;
   1.164 @@ -545,7 +551,7 @@
   1.165              (_symbol == name);
   1.166    }
   1.167  
   1.168 -  methodOop method() { return NULL; }
   1.169 +  Method* method() { return NULL; }
   1.170  
   1.171    static void print_title(outputStream* st) {
   1.172      st->fill_to(col1);
   1.173 @@ -593,7 +599,7 @@
   1.174         return !strcmp(((SingletonBlob*)cb)->name(), _name);
   1.175    }
   1.176  
   1.177 -  methodOop method()         { return NULL; }
   1.178 +  Method* method()         { return NULL; }
   1.179  
   1.180    void oops_do(OopClosure* f) {
   1.181      ;
   1.182 @@ -627,7 +633,7 @@
   1.183  
   1.184    bool vm_match(const char* name) const { return strcmp(name, _name) == 0; }
   1.185  
   1.186 -  methodOop method()          { return NULL; }
   1.187 +  Method* method()          { return NULL; }
   1.188  
   1.189    static int hash(const char* name){
   1.190      // Compute a simple hash
   1.191 @@ -661,7 +667,7 @@
   1.192    }
   1.193  };
   1.194  
   1.195 -void ThreadProfiler::interpreted_update(methodOop method, TickPosition where) {
   1.196 +void ThreadProfiler::interpreted_update(Method* method, TickPosition where) {
   1.197    int index = entry(ProfilerNode::hash(method));
   1.198    if (!table[index]) {
   1.199      table[index] = new (this) interpretedNode(method, where);
   1.200 @@ -678,7 +684,7 @@
   1.201    }
   1.202  }
   1.203  
   1.204 -void ThreadProfiler::compiled_update(methodOop method, TickPosition where) {
   1.205 +void ThreadProfiler::compiled_update(Method* method, TickPosition where) {
   1.206    int index = entry(ProfilerNode::hash(method));
   1.207    if (!table[index]) {
   1.208      table[index] = new (this) compiledNode(method, where);
   1.209 @@ -695,7 +701,7 @@
   1.210    }
   1.211  }
   1.212  
   1.213 -void ThreadProfiler::stub_update(methodOop method, const char* name, TickPosition where) {
   1.214 +void ThreadProfiler::stub_update(Method* method, const char* name, TickPosition where) {
   1.215    int index = entry(ProfilerNode::hash(method));
   1.216    if (!table[index]) {
   1.217      table[index] = new (this) stubNode(method, name, where);
   1.218 @@ -957,7 +963,7 @@
   1.219  
   1.220    // The frame has been fully validated so we can trust the method and bci
   1.221  
   1.222 -  methodOop method = *fr.interpreter_frame_method_addr();
   1.223 +  Method* method = *fr.interpreter_frame_method_addr();
   1.224  
   1.225    interpreted_update(method, where);
   1.226  
   1.227 @@ -984,8 +990,8 @@
   1.228          cb = fr.cb();
   1.229          localwhere = tp_native;
   1.230    }
   1.231 -  methodOop method = (cb->is_nmethod()) ? ((nmethod *)cb)->method() :
   1.232 -                                          (methodOop)NULL;
   1.233 +  Method* method = (cb->is_nmethod()) ? ((nmethod *)cb)->method() :
   1.234 +                                          (Method*)NULL;
   1.235  
   1.236    if (method == NULL) {
   1.237      if (cb->is_runtime_stub())

mercurial