hotspot/src/share/vm/runtime/fprofiler.cpp
changeset 38133 78b95467b9f1
parent 37248 11a660dbbb8e
equal deleted inserted replaced
38132:ba888a4f352a 38133:78b95467b9f1
   536   }
   536   }
   537 };
   537 };
   538 
   538 
   539 class runtimeStubNode : public ProfilerNode {
   539 class runtimeStubNode : public ProfilerNode {
   540  private:
   540  private:
   541    const CodeBlob* _stub;
   541   const RuntimeStub* _stub;
   542   const char* _symbol;     // The name of the nearest VM symbol when ProfileVM is on. Points to a unique string.
   542   const char* _symbol;     // The name of the nearest VM symbol when ProfileVM is on. Points to a unique string.
   543  public:
   543  public:
   544    runtimeStubNode(const CodeBlob* stub, const char* name, TickPosition where) : ProfilerNode(), _stub(stub),  _symbol(name) {
   544    runtimeStubNode(const CodeBlob* stub, const char* name, TickPosition where) : ProfilerNode(), _stub(NULL),  _symbol(name) {
   545      assert(stub->is_runtime_stub(), "wrong code blob");
   545      assert(stub->is_runtime_stub(), "wrong code blob");
       
   546      _stub = (RuntimeStub*) stub;
   546      update(where);
   547      update(where);
   547    }
   548    }
   548 
   549 
   549   bool is_runtime_stub() const { return true; }
   550   bool is_runtime_stub() const { return true; }
   550 
   551 
   551   bool runtimeStub_match(const CodeBlob* stub, const char* name) const {
   552   bool runtimeStub_match(const CodeBlob* stub, const char* name) const {
   552     assert(stub->is_runtime_stub(), "wrong code blob");
   553     assert(stub->is_runtime_stub(), "wrong code blob");
   553     return ((RuntimeStub*)_stub)->entry_point() == ((RuntimeStub*)stub)->entry_point() &&
   554     return _stub->entry_point() == ((RuntimeStub*)stub)->entry_point() &&
   554             (_symbol == name);
   555             (_symbol == name);
   555   }
   556   }
   556 
   557 
   557   Method* method() { return NULL; }
   558   Method* method() { return NULL; }
   558 
   559 
   569   void print(outputStream* st, int total_ticks) {
   570   void print(outputStream* st, int total_ticks) {
   570     ProfilerNode::print(st, total_ticks);
   571     ProfilerNode::print(st, total_ticks);
   571   }
   572   }
   572 
   573 
   573   void print_method_on(outputStream* st) {
   574   void print_method_on(outputStream* st) {
   574     st->print("%s", ((RuntimeStub*)_stub)->name());
   575     st->print("%s", _stub->name());
   575     print_symbol_on(st);
   576     print_symbol_on(st);
   576   }
   577   }
   577 
   578 
   578   void print_symbol_on(outputStream* st) {
   579   void print_symbol_on(outputStream* st) {
   579     if(_symbol) {
   580     if(_symbol) {
   586 class unknown_compiledNode : public ProfilerNode {
   587 class unknown_compiledNode : public ProfilerNode {
   587  const char *_name;
   588  const char *_name;
   588  public:
   589  public:
   589    unknown_compiledNode(const CodeBlob* cb, TickPosition where) : ProfilerNode() {
   590    unknown_compiledNode(const CodeBlob* cb, TickPosition where) : ProfilerNode() {
   590      if ( cb->is_buffer_blob() )
   591      if ( cb->is_buffer_blob() )
   591        _name = ((BufferBlob*)cb)->name();
   592        _name = ((const BufferBlob*)cb)->name();
   592      else
   593      else
   593        _name = ((SingletonBlob*)cb)->name();
   594        _name = ((const SingletonBlob*)cb)->name();
   594      update(where);
   595      update(where);
   595   }
   596   }
   596   bool is_compiled()    const { return true; }
   597   bool is_compiled()    const { return true; }
   597 
   598 
   598   bool unknown_compiled_match(const CodeBlob* cb) const {
   599   bool unknown_compiled_match(const CodeBlob* cb) const {
   599      if ( cb->is_buffer_blob() )
   600      if ( cb->is_buffer_blob() )
   600        return !strcmp(((BufferBlob*)cb)->name(), _name);
   601        return !strcmp(((const BufferBlob*)cb)->name(), _name);
   601      else
   602      else
   602        return !strcmp(((SingletonBlob*)cb)->name(), _name);
   603        return !strcmp(((const SingletonBlob*)cb)->name(), _name);
   603   }
   604   }
   604 
   605 
   605   Method* method()         { return NULL; }
   606   Method* method()         { return NULL; }
   606 
   607 
   607   void oops_do(OopClosure* f) {
   608   void oops_do(OopClosure* f) {
   991   FlatProfiler::all_comp_ticks++;
   992   FlatProfiler::all_comp_ticks++;
   992   if (!FlatProfiler::full_profile()) return;
   993   if (!FlatProfiler::full_profile()) return;
   993 
   994 
   994   CodeBlob* cb = fr.cb();
   995   CodeBlob* cb = fr.cb();
   995 
   996 
   996 // For runtime stubs, record as native rather than as compiled
   997   // For runtime stubs, record as native rather than as compiled
   997    if (cb->is_runtime_stub()) {
   998   if (cb->is_runtime_stub()) {
   998         RegisterMap map(thread, false);
   999     RegisterMap map(thread, false);
   999         fr = fr.sender(&map);
  1000     fr = fr.sender(&map);
  1000         cb = fr.cb();
  1001     cb = fr.cb();
  1001         localwhere = tp_native;
  1002     localwhere = tp_native;
  1002   }
  1003  }
  1003   Method* method = (cb->is_nmethod()) ? ((nmethod *)cb)->method() :
  1004 
  1004                                           (Method*)NULL;
  1005   Method* method = cb->is_compiled() ? cb->as_compiled_method()->method() : (Method*) NULL;
  1005 
       
  1006   if (method == NULL) {
  1006   if (method == NULL) {
  1007     if (cb->is_runtime_stub())
  1007     if (cb->is_runtime_stub())
  1008       runtime_stub_update(cb, name, localwhere);
  1008       runtime_stub_update(cb, name, localwhere);
  1009     else
  1009     else
  1010       unknown_compiled_update(cb, localwhere);
  1010       unknown_compiled_update(cb, localwhere);