author | herrick |
Fri, 18 Oct 2019 14:14:37 -0400 | |
branch | JDK-8200758-branch |
changeset 58696 | 61c44899b4eb |
parent 58537 | 30a9612a657d |
child 58679 | 9c3209ff7550 |
child 59056 | 15936b142f86 |
permissions | -rw-r--r-- |
42650 | 1 |
/* |
53147
db1d11c253d8
8216010: Change callers of build_u2_from() to call Bytes::get_Java_u2() instead
hseigel
parents:
52882
diff
changeset
|
2 |
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
42650 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
#include "precompiled.hpp" |
|
25 |
||
26 |
#include "aot/aotCodeHeap.hpp" |
|
27 |
#include "aot/aotLoader.hpp" |
|
28 |
#include "aot/compiledIC_aot.hpp" |
|
29 |
#include "code/codeCache.hpp" |
|
30 |
#include "code/compiledIC.hpp" |
|
31 |
#include "code/nativeInst.hpp" |
|
32 |
#include "compiler/compilerOracle.hpp" |
|
49455
848864ed9b17
8199604: Rename CardTableModRefBS to CardTableBarrierSet
eosterlund
parents:
49361
diff
changeset
|
33 |
#include "gc/shared/cardTableBarrierSet.hpp" |
42650 | 34 |
#include "gc/shared/collectedHeap.hpp" |
58537 | 35 |
#include "oops/klass.inline.hpp" |
49340
4e82736053ae
8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
48557
diff
changeset
|
36 |
#include "oops/method.inline.hpp" |
49480
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49455
diff
changeset
|
37 |
#include "runtime/frame.inline.hpp" |
49361
1956d0ec092a
8199319: Remove handles.inline.hpp include from reflectionUtils.hpp
stefank
parents:
49340
diff
changeset
|
38 |
#include "runtime/handles.inline.hpp" |
42650 | 39 |
#include "runtime/java.hpp" |
40 |
#include "runtime/os.hpp" |
|
49594
898ef81cbc0e
8200106: Move NoSafepointVerifier out from gcLocker.hpp
stefank
parents:
49480
diff
changeset
|
41 |
#include "runtime/safepointVerifiers.hpp" |
42650 | 42 |
#include "runtime/sharedRuntime.hpp" |
53147
db1d11c253d8
8216010: Change callers of build_u2_from() to call Bytes::get_Java_u2() instead
hseigel
parents:
52882
diff
changeset
|
43 |
#include "utilities/sizes.hpp" |
42650 | 44 |
#include "utilities/xmlstream.hpp" |
45 |
||
46 |
#include <stdio.h> |
|
47 |
||
48 |
#if 0 |
|
49 |
static void metadata_oops_do(Metadata** metadata_begin, Metadata **metadata_end, OopClosure* f) { |
|
50 |
// Visit the metadata/oops section |
|
51 |
for (Metadata** p = metadata_begin; p < metadata_end; p++) { |
|
52 |
Metadata* m = *p; |
|
53 |
||
54 |
intptr_t meta = (intptr_t)m; |
|
55 |
if ((meta & 1) == 1) { |
|
56 |
// already resolved |
|
57 |
m = (Metadata*)(meta & ~1); |
|
58 |
} else { |
|
59 |
continue; |
|
60 |
} |
|
61 |
assert(Metaspace::contains(m), ""); |
|
62 |
if (m->is_method()) { |
|
63 |
m = ((Method*)m)->method_holder(); |
|
64 |
} |
|
65 |
assert(m->is_klass(), "must be"); |
|
66 |
oop o = ((Klass*)m)->klass_holder(); |
|
67 |
if (o != NULL) { |
|
68 |
f->do_oop(&o); |
|
69 |
} |
|
70 |
} |
|
71 |
} |
|
72 |
#endif |
|
73 |
||
49480
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49455
diff
changeset
|
74 |
address* AOTCompiledMethod::orig_pc_addr(const frame* fr) { |
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49455
diff
changeset
|
75 |
return (address*) ((address)fr->unextended_sp() + _meta->orig_pc_offset()); |
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49455
diff
changeset
|
76 |
} |
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49455
diff
changeset
|
77 |
|
42650 | 78 |
oop AOTCompiledMethod::oop_at(int index) const { |
79 |
if (index == 0) { // 0 is reserved |
|
80 |
return NULL; |
|
81 |
} |
|
82 |
Metadata** entry = _metadata_got + (index - 1); |
|
83 |
intptr_t meta = (intptr_t)*entry; |
|
84 |
if ((meta & 1) == 1) { |
|
85 |
// already resolved |
|
86 |
Klass* k = (Klass*)(meta & ~1); |
|
87 |
return k->java_mirror(); |
|
88 |
} |
|
89 |
// The entry is string which we need to resolve. |
|
90 |
const char* meta_name = _heap->get_name_at((int)meta); |
|
53147
db1d11c253d8
8216010: Change callers of build_u2_from() to call Bytes::get_Java_u2() instead
hseigel
parents:
52882
diff
changeset
|
91 |
int klass_len = Bytes::get_Java_u2((address)meta_name); |
42650 | 92 |
const char* klass_name = meta_name + 2; |
93 |
// Quick check the current method's holder. |
|
94 |
Klass* k = _method->method_holder(); |
|
95 |
||
96 |
ResourceMark rm; // for signature_name() |
|
97 |
if (strncmp(k->signature_name(), klass_name, klass_len) != 0) { // Does not match? |
|
98 |
// Search klass in got cells in DSO which have this compiled method. |
|
99 |
k = _heap->get_klass_from_got(klass_name, klass_len, _method); |
|
100 |
} |
|
53147
db1d11c253d8
8216010: Change callers of build_u2_from() to call Bytes::get_Java_u2() instead
hseigel
parents:
52882
diff
changeset
|
101 |
int method_name_len = Bytes::get_Java_u2((address)klass_name + klass_len); |
42650 | 102 |
guarantee(method_name_len == 0, "only klass is expected here"); |
103 |
meta = ((intptr_t)k) | 1; |
|
104 |
*entry = (Metadata*)meta; // Should be atomic on x64 |
|
105 |
return k->java_mirror(); |
|
106 |
} |
|
107 |
||
108 |
Metadata* AOTCompiledMethod::metadata_at(int index) const { |
|
109 |
if (index == 0) { // 0 is reserved |
|
110 |
return NULL; |
|
111 |
} |
|
112 |
assert(index - 1 < _metadata_size, ""); |
|
113 |
{ |
|
114 |
Metadata** entry = _metadata_got + (index - 1); |
|
115 |
intptr_t meta = (intptr_t)*entry; |
|
116 |
if ((meta & 1) == 1) { |
|
117 |
// already resolved |
|
118 |
Metadata *m = (Metadata*)(meta & ~1); |
|
119 |
return m; |
|
120 |
} |
|
121 |
// The entry is string which we need to resolve. |
|
122 |
const char* meta_name = _heap->get_name_at((int)meta); |
|
53147
db1d11c253d8
8216010: Change callers of build_u2_from() to call Bytes::get_Java_u2() instead
hseigel
parents:
52882
diff
changeset
|
123 |
int klass_len = Bytes::get_Java_u2((address)meta_name); |
42650 | 124 |
const char* klass_name = meta_name + 2; |
125 |
// Quick check the current method's holder. |
|
126 |
Klass* k = _method->method_holder(); |
|
127 |
bool klass_matched = true; |
|
128 |
||
129 |
ResourceMark rm; // for signature_name() and find_method() |
|
130 |
if (strncmp(k->signature_name(), klass_name, klass_len) != 0) { // Does not match? |
|
131 |
// Search klass in got cells in DSO which have this compiled method. |
|
132 |
k = _heap->get_klass_from_got(klass_name, klass_len, _method); |
|
133 |
klass_matched = false; |
|
134 |
} |
|
53147
db1d11c253d8
8216010: Change callers of build_u2_from() to call Bytes::get_Java_u2() instead
hseigel
parents:
52882
diff
changeset
|
135 |
int method_name_len = Bytes::get_Java_u2((address)klass_name + klass_len); |
42650 | 136 |
if (method_name_len == 0) { // Array or Klass name only? |
137 |
meta = ((intptr_t)k) | 1; |
|
138 |
*entry = (Metadata*)meta; // Should be atomic on x64 |
|
139 |
return (Metadata*)k; |
|
140 |
} else { // Method |
|
141 |
// Quick check the current method's name. |
|
142 |
Method* m = _method; |
|
53147
db1d11c253d8
8216010: Change callers of build_u2_from() to call Bytes::get_Java_u2() instead
hseigel
parents:
52882
diff
changeset
|
143 |
int signature_len = Bytes::get_Java_u2((address)klass_name + klass_len + 2 + method_name_len); |
42650 | 144 |
int full_len = 2 + klass_len + 2 + method_name_len + 2 + signature_len; |
145 |
if (!klass_matched || memcmp(_name, meta_name, full_len) != 0) { // Does not match? |
|
146 |
Thread* thread = Thread::current(); |
|
147 |
const char* method_name = klass_name + klass_len; |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46327
diff
changeset
|
148 |
m = AOTCodeHeap::find_method(k, thread, method_name); |
42650 | 149 |
} |
150 |
meta = ((intptr_t)m) | 1; |
|
151 |
*entry = (Metadata*)meta; // Should be atomic on x64 |
|
152 |
return (Metadata*)m; |
|
153 |
} |
|
154 |
} |
|
155 |
ShouldNotReachHere(); return NULL; |
|
156 |
} |
|
157 |
||
52882
8b8935b5cfd4
8214401: [AOT] crash in ClassLoaderData::is_alive() with AOTed jdk.base
eosterlund
parents:
52385
diff
changeset
|
158 |
void AOTCompiledMethod::do_unloading(bool unloading_occurred) { |
8b8935b5cfd4
8214401: [AOT] crash in ClassLoaderData::is_alive() with AOTed jdk.base
eosterlund
parents:
52385
diff
changeset
|
159 |
unload_nmethod_caches(unloading_occurred); |
8b8935b5cfd4
8214401: [AOT] crash in ClassLoaderData::is_alive() with AOTed jdk.base
eosterlund
parents:
52385
diff
changeset
|
160 |
} |
8b8935b5cfd4
8214401: [AOT] crash in ClassLoaderData::is_alive() with AOTed jdk.base
eosterlund
parents:
52385
diff
changeset
|
161 |
|
42650 | 162 |
bool AOTCompiledMethod::make_not_entrant_helper(int new_state) { |
163 |
// Make sure the method is not flushed in case of a safepoint in code below. |
|
164 |
methodHandle the_method(method()); |
|
165 |
NoSafepointVerifier nsv; |
|
166 |
||
167 |
{ |
|
168 |
// Enter critical section. Does not block for safepoint. |
|
58226 | 169 |
MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag); |
42650 | 170 |
|
171 |
if (*_state_adr == new_state) { |
|
172 |
// another thread already performed this transition so nothing |
|
173 |
// to do, but return false to indicate this. |
|
174 |
return false; |
|
175 |
} |
|
176 |
||
177 |
// Change state |
|
178 |
OrderAccess::storestore(); |
|
179 |
*_state_adr = new_state; |
|
180 |
||
181 |
// Log the transition once |
|
182 |
log_state_change(); |
|
183 |
||
184 |
#ifdef TIERED |
|
185 |
// Remain non-entrant forever |
|
186 |
if (new_state == not_entrant && method() != NULL) { |
|
187 |
method()->set_aot_code(NULL); |
|
188 |
} |
|
189 |
#endif |
|
190 |
||
191 |
// Remove AOTCompiledMethod from method. |
|
58226 | 192 |
if (method() != NULL) { |
193 |
method()->unlink_code(this); |
|
42650 | 194 |
} |
58226 | 195 |
} // leave critical region under CompiledMethod_lock |
42650 | 196 |
|
197 |
||
198 |
if (TraceCreateZombies) { |
|
199 |
ResourceMark m; |
|
200 |
const char *new_state_str = (new_state == not_entrant) ? "not entrant" : "not used"; |
|
201 |
tty->print_cr("aot method <" INTPTR_FORMAT "> %s code made %s", p2i(this), this->method() ? this->method()->name_and_sig_as_C_string() : "null", new_state_str); |
|
202 |
} |
|
203 |
||
204 |
return true; |
|
205 |
} |
|
206 |
||
51341 | 207 |
#ifdef TIERED |
42650 | 208 |
bool AOTCompiledMethod::make_entrant() { |
209 |
assert(!method()->is_old(), "reviving evolved method!"); |
|
210 |
||
211 |
// Make sure the method is not flushed in case of a safepoint in code below. |
|
212 |
methodHandle the_method(method()); |
|
213 |
NoSafepointVerifier nsv; |
|
214 |
||
215 |
{ |
|
216 |
// Enter critical section. Does not block for safepoint. |
|
58226 | 217 |
MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag); |
42650 | 218 |
|
58226 | 219 |
if (*_state_adr == in_use || *_state_adr == not_entrant) { |
42650 | 220 |
// another thread already performed this transition so nothing |
221 |
// to do, but return false to indicate this. |
|
222 |
return false; |
|
223 |
} |
|
224 |
||
225 |
// Change state |
|
226 |
OrderAccess::storestore(); |
|
227 |
*_state_adr = in_use; |
|
228 |
||
229 |
// Log the transition once |
|
230 |
log_state_change(); |
|
58226 | 231 |
} // leave critical region under CompiledMethod_lock |
42650 | 232 |
|
233 |
||
234 |
if (TraceCreateZombies) { |
|
235 |
ResourceMark m; |
|
236 |
tty->print_cr("aot method <" INTPTR_FORMAT "> %s code made entrant", p2i(this), this->method() ? this->method()->name_and_sig_as_C_string() : "null"); |
|
237 |
} |
|
238 |
||
239 |
return true; |
|
240 |
} |
|
51341 | 241 |
#endif // TIERED |
42650 | 242 |
|
243 |
// Iterate over metadata calling this function. Used by RedefineClasses |
|
244 |
// Copied from nmethod::metadata_do |
|
54150
5529640c5f67
8220512: Deoptimize redefinition functions that have dirty ICs
coleenp
parents:
53641
diff
changeset
|
245 |
void AOTCompiledMethod::metadata_do(MetadataClosure* f) { |
42650 | 246 |
address low_boundary = verified_entry_point(); |
247 |
{ |
|
248 |
// Visit all immediate references that are embedded in the instruction stream. |
|
249 |
RelocIterator iter(this, low_boundary); |
|
250 |
while (iter.next()) { |
|
251 |
if (iter.type() == relocInfo::metadata_type ) { |
|
252 |
metadata_Relocation* r = iter.metadata_reloc(); |
|
253 |
// In this metadata, we must only follow those metadatas directly embedded in |
|
254 |
// the code. Other metadatas (oop_index>0) are seen as part of |
|
255 |
// the metadata section below. |
|
256 |
assert(1 == (r->metadata_is_immediate()) + |
|
257 |
(r->metadata_addr() >= metadata_begin() && r->metadata_addr() < metadata_end()), |
|
258 |
"metadata must be found in exactly one place"); |
|
259 |
if (r->metadata_is_immediate() && r->metadata_value() != NULL) { |
|
260 |
Metadata* md = r->metadata_value(); |
|
54150
5529640c5f67
8220512: Deoptimize redefinition functions that have dirty ICs
coleenp
parents:
53641
diff
changeset
|
261 |
if (md != _method) f->do_metadata(md); |
42650 | 262 |
} |
263 |
} else if (iter.type() == relocInfo::virtual_call_type) { |
|
50995
3c59afe1afc9
8206394: missing ResourceMark in AOTCompiledMethod::metadata_do, AOTCompiledMethod::clear_inline_caches , CompiledMethod::clear_ic_stubs , CompiledMethod::cleanup_inline_caches_impl
mbaesken
parents:
50416
diff
changeset
|
264 |
ResourceMark rm; |
42650 | 265 |
// Check compiledIC holders associated with this nmethod |
266 |
CompiledIC *ic = CompiledIC_at(&iter); |
|
267 |
if (ic->is_icholder_call()) { |
|
268 |
CompiledICHolder* cichk = ic->cached_icholder(); |
|
54150
5529640c5f67
8220512: Deoptimize redefinition functions that have dirty ICs
coleenp
parents:
53641
diff
changeset
|
269 |
f->do_metadata(cichk->holder_metadata()); |
5529640c5f67
8220512: Deoptimize redefinition functions that have dirty ICs
coleenp
parents:
53641
diff
changeset
|
270 |
f->do_metadata(cichk->holder_klass()); |
42650 | 271 |
} else { |
43942
fff6b7b5611f
8173794: [REDO] [AOT] Missing GC scan of _metaspace_got array containing Klass*
kvn
parents:
43461
diff
changeset
|
272 |
// Get Klass* or NULL (if value is -1) from GOT cell of virtual call PLT stub. |
42650 | 273 |
Metadata* ic_oop = ic->cached_metadata(); |
274 |
if (ic_oop != NULL) { |
|
54150
5529640c5f67
8220512: Deoptimize redefinition functions that have dirty ICs
coleenp
parents:
53641
diff
changeset
|
275 |
f->do_metadata(ic_oop); |
42650 | 276 |
} |
277 |
} |
|
43942
fff6b7b5611f
8173794: [REDO] [AOT] Missing GC scan of _metaspace_got array containing Klass*
kvn
parents:
43461
diff
changeset
|
278 |
} else if (iter.type() == relocInfo::static_call_type || |
54839
e9db10a375d9
8222841: Incorrect static call stub interactions with class unloading
eosterlund
parents:
54669
diff
changeset
|
279 |
iter.type() == relocInfo::opt_virtual_call_type) { |
43942
fff6b7b5611f
8173794: [REDO] [AOT] Missing GC scan of _metaspace_got array containing Klass*
kvn
parents:
43461
diff
changeset
|
280 |
// Check Method* in AOT c2i stub for other calls. |
fff6b7b5611f
8173794: [REDO] [AOT] Missing GC scan of _metaspace_got array containing Klass*
kvn
parents:
43461
diff
changeset
|
281 |
Metadata* meta = (Metadata*)nativeLoadGot_at(nativePltCall_at(iter.addr())->plt_c2i_stub())->data(); |
fff6b7b5611f
8173794: [REDO] [AOT] Missing GC scan of _metaspace_got array containing Klass*
kvn
parents:
43461
diff
changeset
|
282 |
if (meta != NULL) { |
54150
5529640c5f67
8220512: Deoptimize redefinition functions that have dirty ICs
coleenp
parents:
53641
diff
changeset
|
283 |
f->do_metadata(meta); |
43942
fff6b7b5611f
8173794: [REDO] [AOT] Missing GC scan of _metaspace_got array containing Klass*
kvn
parents:
43461
diff
changeset
|
284 |
} |
42650 | 285 |
} |
286 |
} |
|
287 |
} |
|
288 |
||
289 |
// Visit the metadata section |
|
290 |
for (Metadata** p = metadata_begin(); p < metadata_end(); p++) { |
|
291 |
Metadata* m = *p; |
|
292 |
||
293 |
intptr_t meta = (intptr_t)m; |
|
294 |
if ((meta & 1) == 1) { |
|
295 |
// already resolved |
|
296 |
m = (Metadata*)(meta & ~1); |
|
297 |
} else { |
|
298 |
continue; |
|
299 |
} |
|
300 |
assert(Metaspace::contains(m), ""); |
|
54150
5529640c5f67
8220512: Deoptimize redefinition functions that have dirty ICs
coleenp
parents:
53641
diff
changeset
|
301 |
f->do_metadata(m); |
42650 | 302 |
} |
303 |
||
304 |
// Visit metadata not embedded in the other places. |
|
54150
5529640c5f67
8220512: Deoptimize redefinition functions that have dirty ICs
coleenp
parents:
53641
diff
changeset
|
305 |
if (_method != NULL) f->do_metadata(_method); |
42650 | 306 |
} |
307 |
||
308 |
void AOTCompiledMethod::print() const { |
|
309 |
print_on(tty, "AOTCompiledMethod"); |
|
310 |
} |
|
311 |
||
312 |
void AOTCompiledMethod::print_on(outputStream* st) const { |
|
313 |
print_on(st, "AOTCompiledMethod"); |
|
314 |
} |
|
315 |
||
316 |
// Print out more verbose output usually for a newly created aot method. |
|
317 |
void AOTCompiledMethod::print_on(outputStream* st, const char* msg) const { |
|
318 |
if (st != NULL) { |
|
319 |
ttyLocker ttyl; |
|
320 |
st->print("%7d ", (int) st->time_stamp().milliseconds()); |
|
321 |
st->print("%4d ", _aot_id); // print compilation number |
|
322 |
st->print(" aot[%2d]", _heap->dso_id()); |
|
323 |
// Stubs have _method == NULL |
|
43942
fff6b7b5611f
8173794: [REDO] [AOT] Missing GC scan of _metaspace_got array containing Klass*
kvn
parents:
43461
diff
changeset
|
324 |
if (_method == NULL) { |
fff6b7b5611f
8173794: [REDO] [AOT] Missing GC scan of _metaspace_got array containing Klass*
kvn
parents:
43461
diff
changeset
|
325 |
st->print(" %s", _name); |
fff6b7b5611f
8173794: [REDO] [AOT] Missing GC scan of _metaspace_got array containing Klass*
kvn
parents:
43461
diff
changeset
|
326 |
} else { |
fff6b7b5611f
8173794: [REDO] [AOT] Missing GC scan of _metaspace_got array containing Klass*
kvn
parents:
43461
diff
changeset
|
327 |
ResourceMark m; |
fff6b7b5611f
8173794: [REDO] [AOT] Missing GC scan of _metaspace_got array containing Klass*
kvn
parents:
43461
diff
changeset
|
328 |
st->print(" %s", _method->name_and_sig_as_C_string()); |
fff6b7b5611f
8173794: [REDO] [AOT] Missing GC scan of _metaspace_got array containing Klass*
kvn
parents:
43461
diff
changeset
|
329 |
} |
42650 | 330 |
if (Verbose) { |
331 |
st->print(" entry at " INTPTR_FORMAT, p2i(_code)); |
|
332 |
} |
|
333 |
if (msg != NULL) { |
|
334 |
st->print(" %s", msg); |
|
335 |
} |
|
336 |
st->cr(); |
|
337 |
} |
|
338 |
} |
|
339 |
||
340 |
void AOTCompiledMethod::print_value_on(outputStream* st) const { |
|
341 |
st->print("AOTCompiledMethod "); |
|
342 |
print_on(st, NULL); |
|
343 |
} |
|
344 |
||
345 |
// Print a short set of xml attributes to identify this aot method. The |
|
346 |
// output should be embedded in some other element. |
|
347 |
void AOTCompiledMethod::log_identity(xmlStream* log) const { |
|
348 |
log->print(" aot_id='%d'", _aot_id); |
|
349 |
log->print(" aot='%2d'", _heap->dso_id()); |
|
350 |
} |
|
351 |
||
52385
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51731
diff
changeset
|
352 |
void AOTCompiledMethod::log_state_change() const { |
42650 | 353 |
if (LogCompilation) { |
354 |
ResourceMark m; |
|
355 |
if (xtty != NULL) { |
|
356 |
ttyLocker ttyl; // keep the following output all in one block |
|
357 |
if (*_state_adr == not_entrant) { |
|
358 |
xtty->begin_elem("make_not_entrant thread='" UINTX_FORMAT "'", |
|
359 |
os::current_thread_id()); |
|
360 |
} else if (*_state_adr == not_used) { |
|
361 |
xtty->begin_elem("make_not_used thread='" UINTX_FORMAT "'", |
|
362 |
os::current_thread_id()); |
|
363 |
} else if (*_state_adr == in_use) { |
|
364 |
xtty->begin_elem("make_entrant thread='" UINTX_FORMAT "'", |
|
365 |
os::current_thread_id()); |
|
366 |
} |
|
367 |
log_identity(xtty); |
|
368 |
xtty->stamp(); |
|
369 |
xtty->end_elem(); |
|
370 |
} |
|
371 |
} |
|
372 |
if (PrintCompilation) { |
|
373 |
ResourceMark m; |
|
374 |
if (*_state_adr == not_entrant) { |
|
375 |
print_on(tty, "made not entrant"); |
|
376 |
} else if (*_state_adr == not_used) { |
|
377 |
print_on(tty, "made not used"); |
|
378 |
} else if (*_state_adr == in_use) { |
|
379 |
print_on(tty, "made entrant"); |
|
380 |
} |
|
381 |
} |
|
382 |
} |
|
383 |
||
384 |
||
385 |
NativeInstruction* PltNativeCallWrapper::get_load_instruction(virtual_call_Relocation* r) const { |
|
386 |
return nativeLoadGot_at(_call->plt_load_got()); |
|
387 |
} |
|
388 |
||
389 |
void PltNativeCallWrapper::verify_resolve_call(address dest) const { |
|
390 |
CodeBlob* db = CodeCache::find_blob_unsafe(dest); |
|
391 |
if (db == NULL) { |
|
392 |
assert(dest == _call->plt_resolve_call(), "sanity"); |
|
393 |
} |
|
394 |
} |
|
395 |
||
396 |
void PltNativeCallWrapper::set_to_interpreted(const methodHandle& method, CompiledICInfo& info) { |
|
397 |
assert(!info.to_aot(), "only for nmethod"); |
|
398 |
CompiledPltStaticCall* csc = CompiledPltStaticCall::at(instruction_address()); |
|
399 |
csc->set_to_interpreted(method, info.entry()); |
|
400 |
} |
|
401 |
||
402 |
NativeCallWrapper* AOTCompiledMethod::call_wrapper_at(address call) const { |
|
403 |
return new PltNativeCallWrapper((NativePltCall*) call); |
|
404 |
} |
|
405 |
||
406 |
NativeCallWrapper* AOTCompiledMethod::call_wrapper_before(address return_pc) const { |
|
407 |
return new PltNativeCallWrapper(nativePltCall_before(return_pc)); |
|
408 |
} |
|
409 |
||
410 |
CompiledStaticCall* AOTCompiledMethod::compiledStaticCall_at(Relocation* call_site) const { |
|
411 |
return CompiledPltStaticCall::at(call_site); |
|
412 |
} |
|
413 |
||
414 |
CompiledStaticCall* AOTCompiledMethod::compiledStaticCall_at(address call_site) const { |
|
415 |
return CompiledPltStaticCall::at(call_site); |
|
416 |
} |
|
417 |
||
418 |
CompiledStaticCall* AOTCompiledMethod::compiledStaticCall_before(address return_addr) const { |
|
419 |
return CompiledPltStaticCall::before(return_addr); |
|
420 |
} |
|
421 |
||
422 |
address AOTCompiledMethod::call_instruction_address(address pc) const { |
|
423 |
NativePltCall* pltcall = nativePltCall_before(pc); |
|
424 |
return pltcall->instruction_address(); |
|
425 |
} |
|
426 |
||
427 |
void AOTCompiledMethod::clear_inline_caches() { |
|
428 |
assert(SafepointSynchronize::is_at_safepoint(), "cleaning of IC's only allowed at safepoint"); |
|
429 |
if (is_zombie()) { |
|
430 |
return; |
|
431 |
} |
|
432 |
||
50995
3c59afe1afc9
8206394: missing ResourceMark in AOTCompiledMethod::metadata_do, AOTCompiledMethod::clear_inline_caches , CompiledMethod::clear_ic_stubs , CompiledMethod::cleanup_inline_caches_impl
mbaesken
parents:
50416
diff
changeset
|
433 |
ResourceMark rm; |
42650 | 434 |
RelocIterator iter(this); |
435 |
while (iter.next()) { |
|
436 |
iter.reloc()->clear_inline_cache(); |
|
437 |
if (iter.type() == relocInfo::opt_virtual_call_type) { |
|
438 |
CompiledIC* cic = CompiledIC_at(&iter); |
|
439 |
assert(cic->is_clean(), "!"); |
|
440 |
nativePltCall_at(iter.addr())->set_stub_to_clean(); |
|
441 |
} |
|
442 |
} |
|
443 |
} |