author | eosterlund |
Thu, 20 Dec 2018 10:41:45 +0100 | |
changeset 53084 | 293cec2f7670 |
parent 52882 | 8b8935b5cfd4 |
child 53149 | 259c36ef27df |
child 53651 | 0331b08811ad |
permissions | -rw-r--r-- |
38133 | 1 |
/* |
49340
4e82736053ae
8191102: Incorrect include file use in classLoader.hpp
hseigel
parents:
48007
diff
changeset
|
2 |
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
38133 | 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 |
||
25 |
#ifndef SHARE_VM_CODE_COMPILEDMETHOD_HPP |
|
26 |
#define SHARE_VM_CODE_COMPILEDMETHOD_HPP |
|
27 |
||
28 |
#include "code/codeBlob.hpp" |
|
29 |
#include "code/pcDesc.hpp" |
|
30 |
#include "oops/metadata.hpp" |
|
31 |
||
32 |
class Dependencies; |
|
33 |
class ExceptionHandlerTable; |
|
34 |
class ImplicitExceptionTable; |
|
35 |
class AbstractCompiler; |
|
36 |
class xmlStream; |
|
37 |
class CompiledStaticCall; |
|
42650 | 38 |
class NativeCallWrapper; |
38133 | 39 |
|
40 |
// This class is used internally by nmethods, to cache |
|
41 |
// exception/pc/handler information. |
|
42 |
||
43 |
class ExceptionCache : public CHeapObj<mtCode> { |
|
44 |
friend class VMStructs; |
|
45 |
private: |
|
46 |
enum { cache_size = 16 }; |
|
47 |
Klass* _exception_type; |
|
48 |
address _pc[cache_size]; |
|
49 |
address _handler[cache_size]; |
|
50 |
volatile int _count; |
|
52405
c0c6cdea32f1
8212989: Allow CompiledMethod ExceptionCache have unloaded klasses
eosterlund
parents:
52385
diff
changeset
|
51 |
ExceptionCache* volatile _next; |
c0c6cdea32f1
8212989: Allow CompiledMethod ExceptionCache have unloaded klasses
eosterlund
parents:
52385
diff
changeset
|
52 |
ExceptionCache* _purge_list_next; |
38133 | 53 |
|
49480
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49373
diff
changeset
|
54 |
inline address pc_at(int index); |
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49373
diff
changeset
|
55 |
void set_pc_at(int index, address a) { assert(index >= 0 && index < cache_size,""); _pc[index] = a; } |
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49373
diff
changeset
|
56 |
|
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49373
diff
changeset
|
57 |
inline address handler_at(int index); |
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49373
diff
changeset
|
58 |
void set_handler_at(int index, address a) { assert(index >= 0 && index < cache_size,""); _handler[index] = a; } |
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49373
diff
changeset
|
59 |
|
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49373
diff
changeset
|
60 |
inline int count(); |
38133 | 61 |
// increment_count is only called under lock, but there may be concurrent readers. |
49480
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49373
diff
changeset
|
62 |
void increment_count(); |
38133 | 63 |
|
64 |
public: |
|
65 |
||
66 |
ExceptionCache(Handle exception, address pc, address handler); |
|
67 |
||
68 |
Klass* exception_type() { return _exception_type; } |
|
52405
c0c6cdea32f1
8212989: Allow CompiledMethod ExceptionCache have unloaded klasses
eosterlund
parents:
52385
diff
changeset
|
69 |
ExceptionCache* next(); |
c0c6cdea32f1
8212989: Allow CompiledMethod ExceptionCache have unloaded klasses
eosterlund
parents:
52385
diff
changeset
|
70 |
void set_next(ExceptionCache *ec); |
c0c6cdea32f1
8212989: Allow CompiledMethod ExceptionCache have unloaded klasses
eosterlund
parents:
52385
diff
changeset
|
71 |
ExceptionCache* purge_list_next() { return _purge_list_next; } |
c0c6cdea32f1
8212989: Allow CompiledMethod ExceptionCache have unloaded klasses
eosterlund
parents:
52385
diff
changeset
|
72 |
void set_purge_list_next(ExceptionCache *ec) { _purge_list_next = ec; } |
38133 | 73 |
|
74 |
address match(Handle exception, address pc); |
|
75 |
bool match_exception_with_space(Handle exception) ; |
|
76 |
address test_address(address addr); |
|
77 |
bool add_address_and_handler(address addr, address handler) ; |
|
78 |
}; |
|
79 |
||
80 |
class nmethod; |
|
81 |
||
82 |
// cache pc descs found in earlier inquiries |
|
49373
47b5652f2928
8199283: Remove ValueObj class for allocation subclassing for compiler code
coleenp
parents:
49340
diff
changeset
|
83 |
class PcDescCache { |
38133 | 84 |
friend class VMStructs; |
85 |
private: |
|
86 |
enum { cache_size = 4 }; |
|
87 |
// The array elements MUST be volatile! Several threads may modify |
|
88 |
// and read from the cache concurrently. find_pc_desc_internal has |
|
89 |
// returned wrong results. C++ compiler (namely xlC12) may duplicate |
|
90 |
// C++ field accesses if the elements are not volatile. |
|
91 |
typedef PcDesc* PcDescPtr; |
|
92 |
volatile PcDescPtr _pc_descs[cache_size]; // last cache_size pc_descs found |
|
93 |
public: |
|
94 |
PcDescCache() { debug_only(_pc_descs[0] = NULL); } |
|
95 |
void reset_to(PcDesc* initial_pc_desc); |
|
96 |
PcDesc* find_pc_desc(int pc_offset, bool approximate); |
|
97 |
void add_pc_desc(PcDesc* pc_desc); |
|
98 |
PcDesc* last_pc_desc() { return _pc_descs[0]; } |
|
99 |
}; |
|
100 |
||
101 |
class PcDescSearch { |
|
102 |
private: |
|
103 |
address _code_begin; |
|
104 |
PcDesc* _lower; |
|
105 |
PcDesc* _upper; |
|
106 |
public: |
|
107 |
PcDescSearch(address code, PcDesc* lower, PcDesc* upper) : |
|
108 |
_code_begin(code), _lower(lower), _upper(upper) |
|
109 |
{ |
|
110 |
} |
|
111 |
||
112 |
address code_begin() const { return _code_begin; } |
|
113 |
PcDesc* scopes_pcs_begin() const { return _lower; } |
|
114 |
PcDesc* scopes_pcs_end() const { return _upper; } |
|
115 |
}; |
|
116 |
||
49373
47b5652f2928
8199283: Remove ValueObj class for allocation subclassing for compiler code
coleenp
parents:
49340
diff
changeset
|
117 |
class PcDescContainer { |
38133 | 118 |
private: |
119 |
PcDescCache _pc_desc_cache; |
|
120 |
public: |
|
121 |
PcDescContainer() {} |
|
122 |
||
123 |
PcDesc* find_pc_desc_internal(address pc, bool approximate, const PcDescSearch& search); |
|
124 |
void reset_to(PcDesc* initial_pc_desc) { _pc_desc_cache.reset_to(initial_pc_desc); } |
|
125 |
||
126 |
PcDesc* find_pc_desc(address pc, bool approximate, const PcDescSearch& search) { |
|
127 |
address base_address = search.code_begin(); |
|
128 |
PcDesc* desc = _pc_desc_cache.last_pc_desc(); |
|
129 |
if (desc != NULL && desc->pc_offset() == pc - base_address) { |
|
130 |
return desc; |
|
131 |
} |
|
132 |
return find_pc_desc_internal(pc, approximate, search); |
|
133 |
} |
|
134 |
}; |
|
135 |
||
136 |
||
137 |
class CompiledMethod : public CodeBlob { |
|
138 |
friend class VMStructs; |
|
139 |
friend class NMethodSweeper; |
|
140 |
||
141 |
void init_defaults(); |
|
142 |
protected: |
|
143 |
enum MarkForDeoptimizationStatus { |
|
144 |
not_marked, |
|
145 |
deoptimize, |
|
146 |
deoptimize_noupdate |
|
147 |
}; |
|
148 |
||
149 |
MarkForDeoptimizationStatus _mark_for_deoptimization_status; // Used for stack deoptimization |
|
150 |
||
151 |
bool _is_far_code; // Code is far from CodeCache. |
|
152 |
// Have to use far call instructions to call it from code in CodeCache. |
|
52385
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51591
diff
changeset
|
153 |
|
38133 | 154 |
// set during construction |
155 |
unsigned int _has_unsafe_access:1; // May fault due to unsafe access. |
|
156 |
unsigned int _has_method_handle_invokes:1; // Has this method MethodHandle invokes? |
|
157 |
unsigned int _lazy_critical_native:1; // Lazy JNI critical native |
|
158 |
unsigned int _has_wide_vectors:1; // Preserve wide vectors at safepoints |
|
159 |
||
160 |
Method* _method; |
|
161 |
address _scopes_data_begin; |
|
162 |
// All deoptee's will resume execution at this location described by |
|
163 |
// this address. |
|
164 |
address _deopt_handler_begin; |
|
165 |
// All deoptee's at a MethodHandle call site will resume execution |
|
166 |
// at this location described by this offset. |
|
167 |
address _deopt_mh_handler_begin; |
|
168 |
||
169 |
PcDescContainer _pc_desc_container; |
|
170 |
ExceptionCache * volatile _exception_cache; |
|
171 |
||
52660
9cb53c505acd
8214056: Allow the GC to attach context information to CompiledMethod
eosterlund
parents:
52659
diff
changeset
|
172 |
void* _gc_data; |
9cb53c505acd
8214056: Allow the GC to attach context information to CompiledMethod
eosterlund
parents:
52659
diff
changeset
|
173 |
|
38133 | 174 |
virtual void flush() = 0; |
175 |
protected: |
|
42040
70ec5a09a0d5
8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
38133
diff
changeset
|
176 |
CompiledMethod(Method* method, const char* name, CompilerType type, const CodeBlobLayout& layout, int frame_complete_offset, int frame_size, ImmutableOopMapSet* oop_maps, bool caller_must_gc_arguments); |
70ec5a09a0d5
8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
38133
diff
changeset
|
177 |
CompiledMethod(Method* method, const char* name, CompilerType type, int size, int header_size, CodeBuffer* cb, int frame_complete_offset, int frame_size, OopMapSet* oop_maps, bool caller_must_gc_arguments); |
38133 | 178 |
|
179 |
public: |
|
52781
436097b038a1
8213565: Crash in DependencyContext::remove_dependent_nmethod
eosterlund
parents:
52660
diff
changeset
|
180 |
// Only used by unit test. |
436097b038a1
8213565: Crash in DependencyContext::remove_dependent_nmethod
eosterlund
parents:
52660
diff
changeset
|
181 |
CompiledMethod() {} |
436097b038a1
8213565: Crash in DependencyContext::remove_dependent_nmethod
eosterlund
parents:
52660
diff
changeset
|
182 |
|
38133 | 183 |
virtual bool is_compiled() const { return true; } |
184 |
||
52660
9cb53c505acd
8214056: Allow the GC to attach context information to CompiledMethod
eosterlund
parents:
52659
diff
changeset
|
185 |
template<typename T> |
9cb53c505acd
8214056: Allow the GC to attach context information to CompiledMethod
eosterlund
parents:
52659
diff
changeset
|
186 |
T* gc_data() const { return reinterpret_cast<T*>(_gc_data); } |
9cb53c505acd
8214056: Allow the GC to attach context information to CompiledMethod
eosterlund
parents:
52659
diff
changeset
|
187 |
template<typename T> |
9cb53c505acd
8214056: Allow the GC to attach context information to CompiledMethod
eosterlund
parents:
52659
diff
changeset
|
188 |
void set_gc_data(T* gc_data) { _gc_data = reinterpret_cast<void*>(gc_data); } |
9cb53c505acd
8214056: Allow the GC to attach context information to CompiledMethod
eosterlund
parents:
52659
diff
changeset
|
189 |
|
38133 | 190 |
bool has_unsafe_access() const { return _has_unsafe_access; } |
191 |
void set_has_unsafe_access(bool z) { _has_unsafe_access = z; } |
|
192 |
||
193 |
bool has_method_handle_invokes() const { return _has_method_handle_invokes; } |
|
194 |
void set_has_method_handle_invokes(bool z) { _has_method_handle_invokes = z; } |
|
195 |
||
196 |
bool is_lazy_critical_native() const { return _lazy_critical_native; } |
|
197 |
void set_lazy_critical_native(bool z) { _lazy_critical_native = z; } |
|
198 |
||
199 |
bool has_wide_vectors() const { return _has_wide_vectors; } |
|
200 |
void set_has_wide_vectors(bool z) { _has_wide_vectors = z; } |
|
201 |
||
48007
ab3959df2115
8043070: nmethod::verify_interrupt_point() shouldn't enter safepoint
iveresov
parents:
47634
diff
changeset
|
202 |
enum { not_installed = -1, // in construction, only the owner doing the construction is |
ab3959df2115
8043070: nmethod::verify_interrupt_point() shouldn't enter safepoint
iveresov
parents:
47634
diff
changeset
|
203 |
// allowed to advance state |
ab3959df2115
8043070: nmethod::verify_interrupt_point() shouldn't enter safepoint
iveresov
parents:
47634
diff
changeset
|
204 |
in_use = 0, // executable nmethod |
ab3959df2115
8043070: nmethod::verify_interrupt_point() shouldn't enter safepoint
iveresov
parents:
47634
diff
changeset
|
205 |
not_used = 1, // not entrant, but revivable |
ab3959df2115
8043070: nmethod::verify_interrupt_point() shouldn't enter safepoint
iveresov
parents:
47634
diff
changeset
|
206 |
not_entrant = 2, // marked for deoptimization but activations may still exist, |
38133 | 207 |
// will be transformed to zombie when all activations are gone |
48007
ab3959df2115
8043070: nmethod::verify_interrupt_point() shouldn't enter safepoint
iveresov
parents:
47634
diff
changeset
|
208 |
zombie = 3, // no activations exist, nmethod is ready for purge |
ab3959df2115
8043070: nmethod::verify_interrupt_point() shouldn't enter safepoint
iveresov
parents:
47634
diff
changeset
|
209 |
unloaded = 4 // there should be no activations, should not be called, |
38133 | 210 |
// will be transformed to zombie immediately |
211 |
}; |
|
212 |
||
213 |
virtual bool is_in_use() const = 0; |
|
214 |
virtual int comp_level() const = 0; |
|
215 |
virtual int compile_id() const = 0; |
|
216 |
||
217 |
virtual address verified_entry_point() const = 0; |
|
218 |
virtual void log_identity(xmlStream* log) const = 0; |
|
52385
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51591
diff
changeset
|
219 |
virtual void log_state_change() const = 0; |
38133 | 220 |
virtual bool make_not_used() = 0; |
221 |
virtual bool make_not_entrant() = 0; |
|
222 |
virtual bool make_entrant() = 0; |
|
223 |
virtual address entry_point() const = 0; |
|
224 |
virtual bool make_zombie() = 0; |
|
225 |
virtual bool is_osr_method() const = 0; |
|
226 |
virtual int osr_entry_bci() const = 0; |
|
227 |
Method* method() const { return _method; } |
|
228 |
virtual void print_pcs() = 0; |
|
229 |
bool is_native_method() const { return _method != NULL && _method->is_native(); } |
|
230 |
bool is_java_method() const { return _method != NULL && !_method->is_native(); } |
|
231 |
||
232 |
// ScopeDesc retrieval operation |
|
233 |
PcDesc* pc_desc_at(address pc) { return find_pc_desc(pc, false); } |
|
46796 | 234 |
// pc_desc_near returns the first PcDesc at or after the given pc. |
38133 | 235 |
PcDesc* pc_desc_near(address pc) { return find_pc_desc(pc, true); } |
236 |
||
237 |
// ScopeDesc for an instruction |
|
238 |
ScopeDesc* scope_desc_at(address pc); |
|
46796 | 239 |
ScopeDesc* scope_desc_near(address pc); |
38133 | 240 |
|
241 |
bool is_at_poll_return(address pc); |
|
242 |
bool is_at_poll_or_poll_return(address pc); |
|
243 |
||
244 |
bool is_marked_for_deoptimization() const { return _mark_for_deoptimization_status != not_marked; } |
|
245 |
void mark_for_deoptimization(bool inc_recompile_counts = true) { |
|
246 |
_mark_for_deoptimization_status = (inc_recompile_counts ? deoptimize : deoptimize_noupdate); |
|
247 |
} |
|
248 |
bool update_recompile_counts() const { |
|
249 |
// Update recompile counts when either the update is explicitly requested (deoptimize) |
|
250 |
// or the nmethod is not marked for deoptimization at all (not_marked). |
|
251 |
// The latter happens during uncommon traps when deoptimized nmethod is made not entrant. |
|
252 |
return _mark_for_deoptimization_status != deoptimize_noupdate; |
|
253 |
} |
|
254 |
||
51591 | 255 |
static bool nmethod_access_is_safe(nmethod* nm); |
256 |
||
38133 | 257 |
// tells whether frames described by this nmethod can be deoptimized |
258 |
// note: native wrappers cannot be deoptimized. |
|
259 |
bool can_be_deoptimized() const { return is_java_method(); } |
|
260 |
||
261 |
virtual oop oop_at(int index) const = 0; |
|
262 |
virtual Metadata* metadata_at(int index) const = 0; |
|
263 |
||
264 |
address scopes_data_begin() const { return _scopes_data_begin; } |
|
265 |
virtual address scopes_data_end() const = 0; |
|
266 |
int scopes_data_size() const { return scopes_data_end() - scopes_data_begin(); } |
|
267 |
||
268 |
virtual PcDesc* scopes_pcs_begin() const = 0; |
|
269 |
virtual PcDesc* scopes_pcs_end() const = 0; |
|
270 |
int scopes_pcs_size() const { return (intptr_t) scopes_pcs_end() - (intptr_t) scopes_pcs_begin(); } |
|
271 |
||
272 |
address insts_begin() const { return code_begin(); } |
|
273 |
address insts_end() const { return stub_begin(); } |
|
43474
8fbf946045f6
8172844: Assert fails in deoptimization due to original PC at the end of code section
zmajo
parents:
42650
diff
changeset
|
274 |
// Returns true if a given address is in the 'insts' section. The method |
8fbf946045f6
8172844: Assert fails in deoptimization due to original PC at the end of code section
zmajo
parents:
42650
diff
changeset
|
275 |
// insts_contains_inclusive() is end-inclusive. |
38133 | 276 |
bool insts_contains(address addr) const { return insts_begin() <= addr && addr < insts_end(); } |
43474
8fbf946045f6
8172844: Assert fails in deoptimization due to original PC at the end of code section
zmajo
parents:
42650
diff
changeset
|
277 |
bool insts_contains_inclusive(address addr) const { return insts_begin() <= addr && addr <= insts_end(); } |
8fbf946045f6
8172844: Assert fails in deoptimization due to original PC at the end of code section
zmajo
parents:
42650
diff
changeset
|
278 |
|
38133 | 279 |
int insts_size() const { return insts_end() - insts_begin(); } |
280 |
||
281 |
virtual address consts_begin() const = 0; |
|
282 |
virtual address consts_end() const = 0; |
|
283 |
bool consts_contains(address addr) const { return consts_begin() <= addr && addr < consts_end(); } |
|
284 |
int consts_size() const { return consts_end() - consts_begin(); } |
|
285 |
||
286 |
virtual address stub_begin() const = 0; |
|
287 |
virtual address stub_end() const = 0; |
|
288 |
bool stub_contains(address addr) const { return stub_begin() <= addr && addr < stub_end(); } |
|
289 |
int stub_size() const { return stub_end() - stub_begin(); } |
|
290 |
||
291 |
virtual address handler_table_begin() const = 0; |
|
292 |
virtual address handler_table_end() const = 0; |
|
293 |
bool handler_table_contains(address addr) const { return handler_table_begin() <= addr && addr < handler_table_end(); } |
|
294 |
int handler_table_size() const { return handler_table_end() - handler_table_begin(); } |
|
295 |
||
46364
00a21c0ff97e
8173795: AOT support in raw_exception_handler_for_return_address is broken
dlong
parents:
43474
diff
changeset
|
296 |
virtual address exception_begin() const = 0; |
00a21c0ff97e
8173795: AOT support in raw_exception_handler_for_return_address is broken
dlong
parents:
43474
diff
changeset
|
297 |
|
38133 | 298 |
virtual address nul_chk_table_begin() const = 0; |
299 |
virtual address nul_chk_table_end() const = 0; |
|
300 |
bool nul_chk_table_contains(address addr) const { return nul_chk_table_begin() <= addr && addr < nul_chk_table_end(); } |
|
301 |
int nul_chk_table_size() const { return nul_chk_table_end() - nul_chk_table_begin(); } |
|
302 |
||
303 |
virtual oop* oop_addr_at(int index) const = 0; |
|
304 |
virtual Metadata** metadata_addr_at(int index) const = 0; |
|
305 |
virtual void set_original_pc(const frame* fr, address pc) = 0; |
|
306 |
||
52405
c0c6cdea32f1
8212989: Allow CompiledMethod ExceptionCache have unloaded klasses
eosterlund
parents:
52385
diff
changeset
|
307 |
protected: |
38133 | 308 |
// Exception cache support |
52405
c0c6cdea32f1
8212989: Allow CompiledMethod ExceptionCache have unloaded klasses
eosterlund
parents:
52385
diff
changeset
|
309 |
// Note: _exception_cache may be read and cleaned concurrently. |
38133 | 310 |
ExceptionCache* exception_cache() const { return _exception_cache; } |
52405
c0c6cdea32f1
8212989: Allow CompiledMethod ExceptionCache have unloaded klasses
eosterlund
parents:
52385
diff
changeset
|
311 |
ExceptionCache* exception_cache_acquire() const; |
38133 | 312 |
void set_exception_cache(ExceptionCache *ec) { _exception_cache = ec; } |
52405
c0c6cdea32f1
8212989: Allow CompiledMethod ExceptionCache have unloaded klasses
eosterlund
parents:
52385
diff
changeset
|
313 |
|
c0c6cdea32f1
8212989: Allow CompiledMethod ExceptionCache have unloaded klasses
eosterlund
parents:
52385
diff
changeset
|
314 |
public: |
38133 | 315 |
address handler_for_exception_and_pc(Handle exception, address pc); |
316 |
void add_handler_for_exception_and_pc(Handle exception, address pc, address handler); |
|
49821
02c08e20d66c
8201537: Remove is_alive closure from Klass::is_loader_alive()
coleenp
parents:
49480
diff
changeset
|
317 |
void clean_exception_cache(); |
38133 | 318 |
|
319 |
void add_exception_cache_entry(ExceptionCache* new_entry); |
|
320 |
ExceptionCache* exception_cache_entry_for_exception(Handle exception); |
|
321 |
||
322 |
// MethodHandle |
|
323 |
bool is_method_handle_return(address return_pc); |
|
324 |
address deopt_mh_handler_begin() const { return _deopt_mh_handler_begin; } |
|
325 |
||
326 |
address deopt_handler_begin() const { return _deopt_handler_begin; } |
|
327 |
virtual address get_original_pc(const frame* fr) = 0; |
|
328 |
// Deopt |
|
329 |
// Return true is the PC is one would expect if the frame is being deopted. |
|
49480
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49373
diff
changeset
|
330 |
inline bool is_deopt_pc(address pc); |
38133 | 331 |
bool is_deopt_mh_entry(address pc) { return pc == deopt_mh_handler_begin(); } |
49480
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
49373
diff
changeset
|
332 |
inline bool is_deopt_entry(address pc); |
38133 | 333 |
|
334 |
virtual bool can_convert_to_zombie() = 0; |
|
335 |
virtual const char* compile_kind() const = 0; |
|
336 |
virtual int get_state() const = 0; |
|
337 |
||
338 |
const char* state() const; |
|
339 |
||
340 |
bool is_far_code() const { return _is_far_code; } |
|
341 |
||
342 |
bool inlinecache_check_contains(address addr) const { |
|
343 |
return (addr >= code_begin() && addr < verified_entry_point()); |
|
344 |
} |
|
345 |
||
346 |
void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f); |
|
347 |
||
348 |
// implicit exceptions support |
|
349 |
virtual address continuation_for_implicit_exception(address pc) { return NULL; } |
|
350 |
||
351 |
static address get_deopt_original_pc(const frame* fr); |
|
352 |
||
50416
ef980b9ac191
8203837: Split nmethod unloading from inline cache cleaning
coleenp
parents:
49890
diff
changeset
|
353 |
// Inline cache support for class unloading and nmethod unloading |
ef980b9ac191
8203837: Split nmethod unloading from inline cache cleaning
coleenp
parents:
49890
diff
changeset
|
354 |
private: |
52857
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52781
diff
changeset
|
355 |
bool cleanup_inline_caches_impl(bool unloading_occurred, bool clean_all); |
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52781
diff
changeset
|
356 |
|
50416
ef980b9ac191
8203837: Split nmethod unloading from inline cache cleaning
coleenp
parents:
49890
diff
changeset
|
357 |
public: |
52857
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52781
diff
changeset
|
358 |
// Serial version used by sweeper and whitebox test |
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52781
diff
changeset
|
359 |
void cleanup_inline_caches(bool clean_all); |
50416
ef980b9ac191
8203837: Split nmethod unloading from inline cache cleaning
coleenp
parents:
49890
diff
changeset
|
360 |
|
38133 | 361 |
virtual void clear_inline_caches(); |
362 |
void clear_ic_stubs(); |
|
363 |
||
364 |
// Verify and count cached icholder relocations. |
|
365 |
int verify_icholder_relocations(); |
|
366 |
void verify_oop_relocations(); |
|
367 |
||
368 |
virtual bool is_evol_dependent_on(Klass* dependee) = 0; |
|
369 |
// Fast breakpoint support. Tells if this compiled method is |
|
370 |
// dependent on the given method. Returns true if this nmethod |
|
371 |
// corresponds to the given method as well. |
|
372 |
virtual bool is_dependent_on_method(Method* dependee) = 0; |
|
373 |
||
42650 | 374 |
virtual NativeCallWrapper* call_wrapper_at(address call) const = 0; |
375 |
virtual NativeCallWrapper* call_wrapper_before(address return_pc) const = 0; |
|
376 |
virtual address call_instruction_address(address pc) const = 0; |
|
377 |
||
378 |
virtual CompiledStaticCall* compiledStaticCall_at(Relocation* call_site) const = 0; |
|
379 |
virtual CompiledStaticCall* compiledStaticCall_at(address addr) const = 0; |
|
380 |
virtual CompiledStaticCall* compiledStaticCall_before(address addr) const = 0; |
|
381 |
||
38133 | 382 |
Method* attached_method(address call_pc); |
383 |
Method* attached_method_before_pc(address pc); |
|
384 |
||
385 |
virtual void metadata_do(void f(Metadata*)) = 0; |
|
386 |
||
387 |
// GC support |
|
50416
ef980b9ac191
8203837: Split nmethod unloading from inline cache cleaning
coleenp
parents:
49890
diff
changeset
|
388 |
protected: |
ef980b9ac191
8203837: Split nmethod unloading from inline cache cleaning
coleenp
parents:
49890
diff
changeset
|
389 |
address oops_reloc_begin() const; |
52385
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51591
diff
changeset
|
390 |
|
50416
ef980b9ac191
8203837: Split nmethod unloading from inline cache cleaning
coleenp
parents:
49890
diff
changeset
|
391 |
private: |
52857
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52781
diff
changeset
|
392 |
bool static clean_ic_if_metadata_is_dead(CompiledIC *ic); |
38133 | 393 |
|
50416
ef980b9ac191
8203837: Split nmethod unloading from inline cache cleaning
coleenp
parents:
49890
diff
changeset
|
394 |
void clean_ic_stubs(); |
38133 | 395 |
|
50416
ef980b9ac191
8203837: Split nmethod unloading from inline cache cleaning
coleenp
parents:
49890
diff
changeset
|
396 |
public: |
52385
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51591
diff
changeset
|
397 |
// GC unloading support |
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51591
diff
changeset
|
398 |
// Cleans unloaded klasses and unloaded nmethods in inline caches |
38133 | 399 |
|
52659
8b26bd8b1832
8213486: SIGSEGV in CompiledMethod::cleanup_inline_caches_impl with AOT
eosterlund
parents:
52405
diff
changeset
|
400 |
virtual bool is_unloading() = 0; |
38133 | 401 |
|
52857
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52781
diff
changeset
|
402 |
bool unload_nmethod_caches(bool class_unloading_occurred); |
52882
8b8935b5cfd4
8214401: [AOT] crash in ClassLoaderData::is_alive() with AOTed jdk.base
eosterlund
parents:
52857
diff
changeset
|
403 |
virtual void do_unloading(bool unloading_occurred) = 0; |
38133 | 404 |
|
405 |
private: |
|
406 |
PcDesc* find_pc_desc(address pc, bool approximate) { |
|
407 |
return _pc_desc_container.find_pc_desc(pc, approximate, PcDescSearch(code_begin(), scopes_pcs_begin(), scopes_pcs_end())); |
|
408 |
} |
|
409 |
||
410 |
protected: |
|
52385
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51591
diff
changeset
|
411 |
// Used by some GCs to chain nmethods. |
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51591
diff
changeset
|
412 |
nmethod* _scavenge_root_link; // from CodeCache::scavenge_root_nmethods |
38133 | 413 |
}; |
414 |
||
415 |
#endif //SHARE_VM_CODE_COMPILEDMETHOD_HPP |