Mercurial > hg > graal-compiler
comparison src/share/vm/code/vtableStubs.cpp @ 17668:22b3b2f888bc
8025841: JVMTI: "vtable stub" dynamic code notification is misplaced
Summary: Generate correct "vtable stub" dynamic code notifications
Reviewed-by: sspitsyn, kvn, coleenp
Contributed-by: oleg.mazurov@oracle.com
author | sspitsyn |
---|---|
date | Thu, 06 Feb 2014 20:13:38 -0800 |
parents | 891687731b59 |
children | 4ca6dc0799b6 78bbf4d43a14 |
comparison
equal
deleted
inserted
replaced
17667:cd7a42c7be06 | 17668:22b3b2f888bc |
---|---|
53 const int real_size = round_to(code_size + sizeof(VtableStub), wordSize); | 53 const int real_size = round_to(code_size + sizeof(VtableStub), wordSize); |
54 // malloc them in chunks to minimize header overhead | 54 // malloc them in chunks to minimize header overhead |
55 const int chunk_factor = 32; | 55 const int chunk_factor = 32; |
56 if (_chunk == NULL || _chunk + real_size > _chunk_end) { | 56 if (_chunk == NULL || _chunk + real_size > _chunk_end) { |
57 const int bytes = chunk_factor * real_size + pd_code_alignment(); | 57 const int bytes = chunk_factor * real_size + pd_code_alignment(); |
58 | |
59 // There is a dependency on the name of the blob in src/share/vm/prims/jvmtiCodeBlobEvents.cpp | |
60 // If changing the name, update the other file accordingly. | |
58 BufferBlob* blob = BufferBlob::create("vtable chunks", bytes); | 61 BufferBlob* blob = BufferBlob::create("vtable chunks", bytes); |
59 if (blob == NULL) { | 62 if (blob == NULL) { |
60 return NULL; | 63 return NULL; |
61 } | 64 } |
62 _chunk = blob->content_begin(); | 65 _chunk = blob->content_begin(); |
63 _chunk_end = _chunk + bytes; | 66 _chunk_end = _chunk + bytes; |
64 Forte::register_stub("vtable stub", _chunk, _chunk_end); | 67 Forte::register_stub("vtable stub", _chunk, _chunk_end); |
65 // Notify JVMTI about this stub. The event will be recorded by the enclosing | |
66 // JvmtiDynamicCodeEventCollector and posted when this thread has released | |
67 // all locks. | |
68 if (JvmtiExport::should_post_dynamic_code_generated()) { | |
69 JvmtiExport::post_dynamic_code_generated_while_holding_locks("vtable stub", _chunk, _chunk_end); | |
70 } | |
71 align_chunk(); | 68 align_chunk(); |
72 } | 69 } |
73 assert(_chunk + real_size <= _chunk_end, "bad allocation"); | 70 assert(_chunk + real_size <= _chunk_end, "bad allocation"); |
74 void* res = _chunk; | 71 void* res = _chunk; |
75 _chunk += real_size; | 72 _chunk += real_size; |
128 if (PrintAdapterHandlers) { | 125 if (PrintAdapterHandlers) { |
129 tty->print_cr("Decoding VtableStub %s[%d]@%d", | 126 tty->print_cr("Decoding VtableStub %s[%d]@%d", |
130 is_vtable_stub? "vtbl": "itbl", vtable_index, VtableStub::receiver_location()); | 127 is_vtable_stub? "vtbl": "itbl", vtable_index, VtableStub::receiver_location()); |
131 Disassembler::decode(s->code_begin(), s->code_end()); | 128 Disassembler::decode(s->code_begin(), s->code_end()); |
132 } | 129 } |
130 // Notify JVMTI about this stub. The event will be recorded by the enclosing | |
131 // JvmtiDynamicCodeEventCollector and posted when this thread has released | |
132 // all locks. | |
133 if (JvmtiExport::should_post_dynamic_code_generated()) { | |
134 JvmtiExport::post_dynamic_code_generated_while_holding_locks(is_vtable_stub? "vtable stub": "itable stub", | |
135 s->code_begin(), s->code_end()); | |
136 } | |
133 } | 137 } |
134 return s->entry_point(); | 138 return s->entry_point(); |
135 } | 139 } |
136 | 140 |
137 | 141 |
191 return NULL; | 195 return NULL; |
192 } | 196 } |
193 | 197 |
194 void vtableStubs_init() { | 198 void vtableStubs_init() { |
195 VtableStubs::initialize(); | 199 VtableStubs::initialize(); |
200 } | |
201 | |
202 void VtableStubs::vtable_stub_do(void f(VtableStub*)) { | |
203 for (int i = 0; i < N; i++) { | |
204 for (VtableStub* s = _table[i]; s != NULL; s = s->next()) { | |
205 f(s); | |
206 } | |
207 } | |
196 } | 208 } |
197 | 209 |
198 | 210 |
199 //----------------------------------------------------------------------------------------------------- | 211 //----------------------------------------------------------------------------------------------------- |
200 // Non-product code | 212 // Non-product code |