comparison src/share/vm/code/vtableStubs.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 78bbf4d43a14
children
comparison
equal deleted inserted replaced
17606:45d7b2c7029d 18041:52b4284cb496
1 /* 1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
37 #include "runtime/sharedRuntime.hpp" 37 #include "runtime/sharedRuntime.hpp"
38 #ifdef COMPILER2 38 #ifdef COMPILER2
39 #include "opto/matcher.hpp" 39 #include "opto/matcher.hpp"
40 #endif 40 #endif
41 41
42 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
43
42 // ----------------------------------------------------------------------------------------- 44 // -----------------------------------------------------------------------------------------
43 // Implementation of VtableStub 45 // Implementation of VtableStub
44 46
45 address VtableStub::_chunk = NULL; 47 address VtableStub::_chunk = NULL;
46 address VtableStub::_chunk_end = NULL; 48 address VtableStub::_chunk_end = NULL;
53 const int real_size = round_to(code_size + sizeof(VtableStub), wordSize); 55 const int real_size = round_to(code_size + sizeof(VtableStub), wordSize);
54 // malloc them in chunks to minimize header overhead 56 // malloc them in chunks to minimize header overhead
55 const int chunk_factor = 32; 57 const int chunk_factor = 32;
56 if (_chunk == NULL || _chunk + real_size > _chunk_end) { 58 if (_chunk == NULL || _chunk + real_size > _chunk_end) {
57 const int bytes = chunk_factor * real_size + pd_code_alignment(); 59 const int bytes = chunk_factor * real_size + pd_code_alignment();
60
61 // There is a dependency on the name of the blob in src/share/vm/prims/jvmtiCodeBlobEvents.cpp
62 // If changing the name, update the other file accordingly.
58 BufferBlob* blob = BufferBlob::create("vtable chunks", bytes); 63 BufferBlob* blob = BufferBlob::create("vtable chunks", bytes);
59 if (blob == NULL) { 64 if (blob == NULL) {
60 return NULL; 65 return NULL;
61 } 66 }
62 _chunk = blob->content_begin(); 67 _chunk = blob->content_begin();
63 _chunk_end = _chunk + bytes; 68 _chunk_end = _chunk + bytes;
64 Forte::register_stub("vtable stub", _chunk, _chunk_end); 69 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(); 70 align_chunk();
72 } 71 }
73 assert(_chunk + real_size <= _chunk_end, "bad allocation"); 72 assert(_chunk + real_size <= _chunk_end, "bad allocation");
74 void* res = _chunk; 73 void* res = _chunk;
75 _chunk += real_size; 74 _chunk += real_size;
128 if (PrintAdapterHandlers) { 127 if (PrintAdapterHandlers) {
129 tty->print_cr("Decoding VtableStub %s[%d]@%d", 128 tty->print_cr("Decoding VtableStub %s[%d]@%d",
130 is_vtable_stub? "vtbl": "itbl", vtable_index, VtableStub::receiver_location()); 129 is_vtable_stub? "vtbl": "itbl", vtable_index, VtableStub::receiver_location());
131 Disassembler::decode(s->code_begin(), s->code_end()); 130 Disassembler::decode(s->code_begin(), s->code_end());
132 } 131 }
132 // Notify JVMTI about this stub. The event will be recorded by the enclosing
133 // JvmtiDynamicCodeEventCollector and posted when this thread has released
134 // all locks.
135 if (JvmtiExport::should_post_dynamic_code_generated()) {
136 JvmtiExport::post_dynamic_code_generated_while_holding_locks(is_vtable_stub? "vtable stub": "itable stub",
137 s->code_begin(), s->code_end());
138 }
133 } 139 }
134 return s->entry_point(); 140 return s->entry_point();
135 } 141 }
136 142
137 143
191 return NULL; 197 return NULL;
192 } 198 }
193 199
194 void vtableStubs_init() { 200 void vtableStubs_init() {
195 VtableStubs::initialize(); 201 VtableStubs::initialize();
202 }
203
204 void VtableStubs::vtable_stub_do(void f(VtableStub*)) {
205 for (int i = 0; i < N; i++) {
206 for (VtableStub* s = _table[i]; s != NULL; s = s->next()) {
207 f(s);
208 }
209 }
196 } 210 }
197 211
198 212
199 //----------------------------------------------------------------------------------------------------- 213 //-----------------------------------------------------------------------------------------------------
200 // Non-product code 214 // Non-product code