Mercurial > hg > truffle
comparison src/share/vm/prims/jvmtiCodeBlobEvents.cpp @ 14909:4ca6dc0799b6
Backout jdk9 merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Tue, 01 Apr 2014 13:57:07 +0200 |
parents | d8041d695d19 |
children | 52b4284cb496 |
comparison
equal
deleted
inserted
replaced
14908:8db6e76cb658 | 14909:4ca6dc0799b6 |
---|---|
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" | |
30 #include "memory/resourceArea.hpp" | 29 #include "memory/resourceArea.hpp" |
31 #include "oops/oop.inline.hpp" | 30 #include "oops/oop.inline.hpp" |
32 #include "prims/jvmtiCodeBlobEvents.hpp" | 31 #include "prims/jvmtiCodeBlobEvents.hpp" |
33 #include "prims/jvmtiExport.hpp" | 32 #include "prims/jvmtiExport.hpp" |
34 #include "runtime/handles.hpp" | 33 #include "runtime/handles.hpp" |
62 int _pos; // iterator position | 61 int _pos; // iterator position |
63 | 62 |
64 // used during a collection | 63 // used during a collection |
65 static GrowableArray<JvmtiCodeBlobDesc*>* _global_code_blobs; | 64 static GrowableArray<JvmtiCodeBlobDesc*>* _global_code_blobs; |
66 static void do_blob(CodeBlob* cb); | 65 static void do_blob(CodeBlob* cb); |
67 static void do_vtable_stub(VtableStub* vs); | |
68 public: | 66 public: |
69 CodeBlobCollector() { | 67 CodeBlobCollector() { |
70 _code_blobs = NULL; | 68 _code_blobs = NULL; |
71 _pos = -1; | 69 _pos = -1; |
72 } | 70 } |
117 | 115 |
118 void CodeBlobCollector::do_blob(CodeBlob* cb) { | 116 void CodeBlobCollector::do_blob(CodeBlob* cb) { |
119 | 117 |
120 // ignore nmethods | 118 // ignore nmethods |
121 if (cb->is_nmethod()) { | 119 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) { | |
126 return; | 120 return; |
127 } | 121 } |
128 | 122 |
129 // check if this starting address has been seen already - the | 123 // check if this starting address has been seen already - the |
130 // assumption is that stubs are inserted into the list before the | 124 // assumption is that stubs are inserted into the list before the |
140 // record the CodeBlob details as a JvmtiCodeBlobDesc | 134 // record the CodeBlob details as a JvmtiCodeBlobDesc |
141 JvmtiCodeBlobDesc* scb = new JvmtiCodeBlobDesc(cb->name(), cb->code_begin(), cb->code_end()); | 135 JvmtiCodeBlobDesc* scb = new JvmtiCodeBlobDesc(cb->name(), cb->code_begin(), cb->code_end()); |
142 _global_code_blobs->append(scb); | 136 _global_code_blobs->append(scb); |
143 } | 137 } |
144 | 138 |
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 } | |
152 | 139 |
153 // collects a list of CodeBlobs in the CodeCache. | 140 // collects a list of CodeBlobs in the CodeCache. |
154 // | 141 // |
155 // The created list is growable array of JvmtiCodeBlobDesc - each one describes | 142 // The created list is growable array of JvmtiCodeBlobDesc - each one describes |
156 // a CodeBlob. Note that the list is static - this is because CodeBlob::blobs_do | 143 // a CodeBlob. Note that the list is static - this is because CodeBlob::blobs_do |
176 int index = 0; | 163 int index = 0; |
177 StubCodeDesc* desc; | 164 StubCodeDesc* desc; |
178 while ((desc = StubCodeDesc::desc_for_index(++index)) != NULL) { | 165 while ((desc = StubCodeDesc::desc_for_index(++index)) != NULL) { |
179 _global_code_blobs->append(new JvmtiCodeBlobDesc(desc->name(), desc->begin(), desc->end())); | 166 _global_code_blobs->append(new JvmtiCodeBlobDesc(desc->name(), desc->begin(), desc->end())); |
180 } | 167 } |
181 | |
182 // Vtable stubs are not described with StubCodeDesc, | |
183 // process them separately | |
184 VtableStubs::vtable_stub_do(do_vtable_stub); | |
185 | 168 |
186 // next iterate over all the non-nmethod code blobs and add them to | 169 // next iterate over all the non-nmethod code blobs and add them to |
187 // the list - as noted above this will filter out duplicates and | 170 // the list - as noted above this will filter out duplicates and |
188 // enclosing blobs. | 171 // enclosing blobs. |
189 CodeCache::blobs_do(do_blob); | 172 CodeCache::blobs_do(do_blob); |