src/share/vm/prims/jvmtiCodeBlobEvents.cpp
Print this page
@@ -24,10 +24,11 @@
#include "precompiled.hpp"
#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"
#include "prims/jvmtiExport.hpp"
#include "runtime/handles.hpp"
@@ -61,10 +62,11 @@
int _pos; // iterator position
// 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;
_pos = -1;
}
@@ -117,10 +119,14 @@
// ignore nmethods
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
// enclosing BufferBlobs.
address addr = cb->code_begin();
@@ -134,11 +140,18 @@
// record the CodeBlob details as a JvmtiCodeBlobDesc
JvmtiCodeBlobDesc* scb = new JvmtiCodeBlobDesc(cb->name(), cb->code_begin(), cb->code_end());
_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.
//
// The created list is growable array of JvmtiCodeBlobDesc - each one describes
// a CodeBlob. Note that the list is static - this is because CodeBlob::blobs_do
// requires a a C or static function so we can't use an instance function. This
@@ -164,10 +177,14 @@
StubCodeDesc* desc;
while ((desc = StubCodeDesc::desc_for_index(++index)) != NULL) {
_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.
CodeCache::blobs_do(do_blob);