hotspot/src/share/vm/prims/jvmtiCodeBlobEvents.cpp
changeset 22747 f467c14746f5
parent 13963 e5b53c306fb5
child 26796 666464578742
--- a/hotspot/src/share/vm/prims/jvmtiCodeBlobEvents.cpp	Thu Feb 06 20:32:08 2014 +0000
+++ b/hotspot/src/share/vm/prims/jvmtiCodeBlobEvents.cpp	Thu Feb 06 20:13:38 2014 -0800
@@ -26,6 +26,7 @@
 #include "code/codeBlob.hpp"
 #include "code/codeCache.hpp"
 #include "code/scopeDesc.hpp"
+#include "code/vtableStubs.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiCodeBlobEvents.hpp"
@@ -63,6 +64,7 @@
   // used during a collection
   static GrowableArray<JvmtiCodeBlobDesc*>* _global_code_blobs;
   static void do_blob(CodeBlob* cb);
+  static void do_vtable_stub(VtableStub* vs);
  public:
   CodeBlobCollector() {
     _code_blobs = NULL;
@@ -119,6 +121,10 @@
   if (cb->is_nmethod()) {
     return;
   }
+  // exclude VtableStubs, which are processed separately
+  if (cb->is_buffer_blob() && strcmp(cb->name(), "vtable chunks") == 0) {
+    return;
+  }
 
   // check if this starting address has been seen already - the
   // assumption is that stubs are inserted into the list before the
@@ -136,6 +142,13 @@
   _global_code_blobs->append(scb);
 }
 
+// called for each VtableStub in VtableStubs
+
+void CodeBlobCollector::do_vtable_stub(VtableStub* vs) {
+    JvmtiCodeBlobDesc* scb = new JvmtiCodeBlobDesc(vs->is_vtable_stub() ? "vtable stub" : "itable stub",
+                                                   vs->code_begin(), vs->code_end());
+    _global_code_blobs->append(scb);
+}
 
 // collects a list of CodeBlobs in the CodeCache.
 //
@@ -166,6 +179,10 @@
     _global_code_blobs->append(new JvmtiCodeBlobDesc(desc->name(), desc->begin(), desc->end()));
   }
 
+  // Vtable stubs are not described with StubCodeDesc,
+  // process them separately
+  VtableStubs::vtable_stub_do(do_vtable_stub);
+
   // next iterate over all the non-nmethod code blobs and add them to
   // the list - as noted above this will filter out duplicates and
   // enclosing blobs.