comparison src/share/vm/prims/jvmtiCodeBlobEvents.cpp @ 18041:52b4284cb496

Merge with jdk8u20-b26
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 16:02:50 +0200
parents 4ca6dc0799b6
children
comparison
equal deleted inserted replaced
17606:45d7b2c7029d 18041:52b4284cb496
24 24
25 #include "precompiled.hpp" 25 #include "precompiled.hpp"
26 #include "code/codeBlob.hpp" 26 #include "code/codeBlob.hpp"
27 #include "code/codeCache.hpp" 27 #include "code/codeCache.hpp"
28 #include "code/scopeDesc.hpp" 28 #include "code/scopeDesc.hpp"
29 #include "code/vtableStubs.hpp"
29 #include "memory/resourceArea.hpp" 30 #include "memory/resourceArea.hpp"
30 #include "oops/oop.inline.hpp" 31 #include "oops/oop.inline.hpp"
31 #include "prims/jvmtiCodeBlobEvents.hpp" 32 #include "prims/jvmtiCodeBlobEvents.hpp"
32 #include "prims/jvmtiExport.hpp" 33 #include "prims/jvmtiExport.hpp"
33 #include "runtime/handles.hpp" 34 #include "runtime/handles.hpp"
61 int _pos; // iterator position 62 int _pos; // iterator position
62 63
63 // used during a collection 64 // used during a collection
64 static GrowableArray<JvmtiCodeBlobDesc*>* _global_code_blobs; 65 static GrowableArray<JvmtiCodeBlobDesc*>* _global_code_blobs;
65 static void do_blob(CodeBlob* cb); 66 static void do_blob(CodeBlob* cb);
67 static void do_vtable_stub(VtableStub* vs);
66 public: 68 public:
67 CodeBlobCollector() { 69 CodeBlobCollector() {
68 _code_blobs = NULL; 70 _code_blobs = NULL;
69 _pos = -1; 71 _pos = -1;
70 } 72 }
115 117
116 void CodeBlobCollector::do_blob(CodeBlob* cb) { 118 void CodeBlobCollector::do_blob(CodeBlob* cb) {
117 119
118 // ignore nmethods 120 // ignore nmethods
119 if (cb->is_nmethod()) { 121 if (cb->is_nmethod()) {
122 return;
123 }
124 // exclude VtableStubs, which are processed separately
125 if (cb->is_buffer_blob() && strcmp(cb->name(), "vtable chunks") == 0) {
120 return; 126 return;
121 } 127 }
122 128
123 // check if this starting address has been seen already - the 129 // check if this starting address has been seen already - the
124 // assumption is that stubs are inserted into the list before the 130 // assumption is that stubs are inserted into the list before the
134 // record the CodeBlob details as a JvmtiCodeBlobDesc 140 // record the CodeBlob details as a JvmtiCodeBlobDesc
135 JvmtiCodeBlobDesc* scb = new JvmtiCodeBlobDesc(cb->name(), cb->code_begin(), cb->code_end()); 141 JvmtiCodeBlobDesc* scb = new JvmtiCodeBlobDesc(cb->name(), cb->code_begin(), cb->code_end());
136 _global_code_blobs->append(scb); 142 _global_code_blobs->append(scb);
137 } 143 }
138 144
145 // called for each VtableStub in VtableStubs
146
147 void CodeBlobCollector::do_vtable_stub(VtableStub* vs) {
148 JvmtiCodeBlobDesc* scb = new JvmtiCodeBlobDesc(vs->is_vtable_stub() ? "vtable stub" : "itable stub",
149 vs->code_begin(), vs->code_end());
150 _global_code_blobs->append(scb);
151 }
139 152
140 // collects a list of CodeBlobs in the CodeCache. 153 // collects a list of CodeBlobs in the CodeCache.
141 // 154 //
142 // The created list is growable array of JvmtiCodeBlobDesc - each one describes 155 // The created list is growable array of JvmtiCodeBlobDesc - each one describes
143 // a CodeBlob. Note that the list is static - this is because CodeBlob::blobs_do 156 // a CodeBlob. Note that the list is static - this is because CodeBlob::blobs_do
163 int index = 0; 176 int index = 0;
164 StubCodeDesc* desc; 177 StubCodeDesc* desc;
165 while ((desc = StubCodeDesc::desc_for_index(++index)) != NULL) { 178 while ((desc = StubCodeDesc::desc_for_index(++index)) != NULL) {
166 _global_code_blobs->append(new JvmtiCodeBlobDesc(desc->name(), desc->begin(), desc->end())); 179 _global_code_blobs->append(new JvmtiCodeBlobDesc(desc->name(), desc->begin(), desc->end()));
167 } 180 }
181
182 // Vtable stubs are not described with StubCodeDesc,
183 // process them separately
184 VtableStubs::vtable_stub_do(do_vtable_stub);
168 185
169 // next iterate over all the non-nmethod code blobs and add them to 186 // next iterate over all the non-nmethod code blobs and add them to
170 // the list - as noted above this will filter out duplicates and 187 // the list - as noted above this will filter out duplicates and
171 // enclosing blobs. 188 // enclosing blobs.
172 CodeCache::blobs_do(do_blob); 189 CodeCache::blobs_do(do_blob);