author | iignatyev |
Mon, 10 Nov 2014 19:04:38 +0300 | |
changeset 27642 | 8c9eff693145 |
parent 27420 | 04e6f914cce1 |
child 30590 | 14f7f48c1377 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
19696
bd5a0131bde1
8021954: VM SIGSEGV during classloading on MacOS; hs_err_pid file produced
coleenp
parents:
16368
diff
changeset
|
2 |
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5050
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5050
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5050
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef SHARE_VM_CODE_CODEBLOB_HPP |
26 |
#define SHARE_VM_CODE_CODEBLOB_HPP |
|
27 |
||
28 |
#include "asm/codeBuffer.hpp" |
|
29 |
#include "compiler/oopMap.hpp" |
|
30 |
#include "runtime/frame.hpp" |
|
31 |
#include "runtime/handles.hpp" |
|
32 |
||
26796 | 33 |
// CodeBlob Types |
34 |
// Used in the CodeCache to assign CodeBlobs to different CodeHeaps |
|
35 |
struct CodeBlobType { |
|
36 |
enum { |
|
37 |
MethodNonProfiled = 0, // Execution level 1 and 4 (non-profiled) nmethods (including native nmethods) |
|
38 |
MethodProfiled = 1, // Execution level 2 and 3 (profiled) nmethods |
|
26919
361b4b4c92c0
8059468: Fix PrintCodeCache output changed by JDK-8059137
thartmann
parents:
26796
diff
changeset
|
39 |
NonNMethod = 2, // Non-nmethods like Buffers, Adapters and Runtime Stubs |
26796 | 40 |
All = 3, // All types (No code cache segmentation) |
41 |
NumTypes = 4 // Number of CodeBlobTypes |
|
42 |
}; |
|
43 |
}; |
|
44 |
||
1 | 45 |
// CodeBlob - superclass for all entries in the CodeCache. |
46 |
// |
|
47 |
// Suptypes are: |
|
48 |
// nmethod : Compiled Java methods (include method that calls to native code) |
|
49 |
// RuntimeStub : Call to VM runtime methods |
|
50 |
// DeoptimizationBlob : Used for deoptimizatation |
|
51 |
// ExceptionBlob : Used for stack unrolling |
|
52 |
// SafepointBlob : Used to handle illegal instruction exceptions |
|
53 |
// |
|
54 |
// |
|
55 |
// Layout: |
|
56 |
// - header |
|
57 |
// - relocation |
|
6418 | 58 |
// - content space |
59 |
// - instruction space |
|
1 | 60 |
// - data space |
61 |
class DeoptimizationBlob; |
|
62 |
||
63 |
class CodeBlob VALUE_OBJ_CLASS_SPEC { |
|
64 |
||
65 |
friend class VMStructs; |
|
66 |
||
67 |
private: |
|
68 |
const char* _name; |
|
69 |
int _size; // total size of CodeBlob in bytes |
|
70 |
int _header_size; // size of header (depends on subclass) |
|
71 |
int _relocation_size; // size of relocation |
|
6418 | 72 |
int _content_offset; // offset to where content region begins (this includes consts, insts, stubs) |
73 |
int _code_offset; // offset to where instructions region begins (this includes insts, stubs) |
|
1 | 74 |
int _frame_complete_offset; // instruction offsets in [0.._frame_complete_offset) have |
75 |
// not finished setting up their frame. Beware of pc's in |
|
76 |
// that range. There is a similar range(s) on returns |
|
77 |
// which we don't detect. |
|
78 |
int _data_offset; // offset to where data region begins |
|
79 |
int _frame_size; // size of stack frame |
|
80 |
OopMapSet* _oop_maps; // OopMap for this CodeBlob |
|
16368
713209c45a82
8008555: Debugging code in compiled method sometimes leaks memory
roland
parents:
13887
diff
changeset
|
81 |
CodeStrings _strings; |
1 | 82 |
|
83 |
public: |
|
84 |
// Returns the space needed for CodeBlob |
|
85 |
static unsigned int allocation_size(CodeBuffer* cb, int header_size); |
|
27642
8c9eff693145
8059624: Test task: WhiteBox API for testing segmented codecache feature
iignatyev
parents:
27420
diff
changeset
|
86 |
static unsigned int align_code_offset(int offset); |
1 | 87 |
|
88 |
// Creation |
|
89 |
// a) simple CodeBlob |
|
90 |
// frame_complete is the offset from the beginning of the instructions |
|
91 |
// to where the frame setup (from stackwalk viewpoint) is complete. |
|
92 |
CodeBlob(const char* name, int header_size, int size, int frame_complete, int locs_size); |
|
93 |
||
94 |
// b) full CodeBlob |
|
95 |
CodeBlob( |
|
96 |
const char* name, |
|
97 |
CodeBuffer* cb, |
|
98 |
int header_size, |
|
99 |
int size, |
|
100 |
int frame_complete, |
|
101 |
int frame_size, |
|
102 |
OopMapSet* oop_maps |
|
103 |
); |
|
104 |
||
105 |
// Deletion |
|
106 |
void flush(); |
|
107 |
||
108 |
// Typing |
|
9630
d6419e4395e3
6939861: JVM should handle more conversion operations
never
parents:
7397
diff
changeset
|
109 |
virtual bool is_buffer_blob() const { return false; } |
d6419e4395e3
6939861: JVM should handle more conversion operations
never
parents:
7397
diff
changeset
|
110 |
virtual bool is_nmethod() const { return false; } |
d6419e4395e3
6939861: JVM should handle more conversion operations
never
parents:
7397
diff
changeset
|
111 |
virtual bool is_runtime_stub() const { return false; } |
d6419e4395e3
6939861: JVM should handle more conversion operations
never
parents:
7397
diff
changeset
|
112 |
virtual bool is_deoptimization_stub() const { return false; } |
d6419e4395e3
6939861: JVM should handle more conversion operations
never
parents:
7397
diff
changeset
|
113 |
virtual bool is_uncommon_trap_stub() const { return false; } |
d6419e4395e3
6939861: JVM should handle more conversion operations
never
parents:
7397
diff
changeset
|
114 |
virtual bool is_exception_stub() const { return false; } |
5050
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
115 |
virtual bool is_safepoint_stub() const { return false; } |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
116 |
virtual bool is_adapter_blob() const { return false; } |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
117 |
virtual bool is_method_handles_adapter_blob() const { return false; } |
1 | 118 |
|
119 |
virtual bool is_compiled_by_c2() const { return false; } |
|
120 |
virtual bool is_compiled_by_c1() const { return false; } |
|
121 |
||
4564
55dfb20908d0
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
3908
diff
changeset
|
122 |
// Casting |
55dfb20908d0
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
3908
diff
changeset
|
123 |
nmethod* as_nmethod_or_null() { return is_nmethod() ? (nmethod*) this : NULL; } |
55dfb20908d0
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
3908
diff
changeset
|
124 |
|
1 | 125 |
// Boundaries |
126 |
address header_begin() const { return (address) this; } |
|
127 |
address header_end() const { return ((address) this) + _header_size; }; |
|
128 |
relocInfo* relocation_begin() const { return (relocInfo*) header_end(); }; |
|
129 |
relocInfo* relocation_end() const { return (relocInfo*)(header_end() + _relocation_size); } |
|
6418 | 130 |
address content_begin() const { return (address) header_begin() + _content_offset; } |
131 |
address content_end() const { return (address) header_begin() + _data_offset; } |
|
132 |
address code_begin() const { return (address) header_begin() + _code_offset; } |
|
133 |
address code_end() const { return (address) header_begin() + _data_offset; } |
|
1 | 134 |
address data_begin() const { return (address) header_begin() + _data_offset; } |
135 |
address data_end() const { return (address) header_begin() + _size; } |
|
136 |
||
137 |
// Offsets |
|
138 |
int relocation_offset() const { return _header_size; } |
|
6418 | 139 |
int content_offset() const { return _content_offset; } |
140 |
int code_offset() const { return _code_offset; } |
|
1 | 141 |
int data_offset() const { return _data_offset; } |
142 |
||
143 |
// Sizes |
|
144 |
int size() const { return _size; } |
|
145 |
int header_size() const { return _header_size; } |
|
146 |
int relocation_size() const { return (address) relocation_end() - (address) relocation_begin(); } |
|
6418 | 147 |
int content_size() const { return content_end() - content_begin(); } |
148 |
int code_size() const { return code_end() - code_begin(); } |
|
149 |
int data_size() const { return data_end() - data_begin(); } |
|
1 | 150 |
|
151 |
// Containment |
|
6418 | 152 |
bool blob_contains(address addr) const { return header_begin() <= addr && addr < data_end(); } |
1 | 153 |
bool relocation_contains(relocInfo* addr) const{ return relocation_begin() <= addr && addr < relocation_end(); } |
6418 | 154 |
bool content_contains(address addr) const { return content_begin() <= addr && addr < content_end(); } |
155 |
bool code_contains(address addr) const { return code_begin() <= addr && addr < code_end(); } |
|
156 |
bool data_contains(address addr) const { return data_begin() <= addr && addr < data_end(); } |
|
157 |
bool contains(address addr) const { return content_contains(addr); } |
|
158 |
bool is_frame_complete_at(address addr) const { return code_contains(addr) && |
|
159 |
addr >= code_begin() + _frame_complete_offset; } |
|
1 | 160 |
|
161 |
// CodeCache support: really only used by the nmethods, but in order to get |
|
162 |
// asserts and certain bookkeeping to work in the CodeCache they are defined |
|
163 |
// virtual here. |
|
164 |
virtual bool is_zombie() const { return false; } |
|
165 |
virtual bool is_locked_by_vm() const { return false; } |
|
166 |
||
167 |
virtual bool is_unloaded() const { return false; } |
|
168 |
virtual bool is_not_entrant() const { return false; } |
|
169 |
||
170 |
// GC support |
|
171 |
virtual bool is_alive() const = 0; |
|
172 |
||
173 |
// OopMap for frame |
|
174 |
OopMapSet* oop_maps() const { return _oop_maps; } |
|
175 |
void set_oop_maps(OopMapSet* p); |
|
176 |
OopMap* oop_map_for_return_address(address return_address); |
|
177 |
virtual void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { ShouldNotReachHere(); } |
|
178 |
||
179 |
// Frame support |
|
180 |
int frame_size() const { return _frame_size; } |
|
181 |
void set_frame_size(int size) { _frame_size = size; } |
|
182 |
||
183 |
// Returns true, if the next frame is responsible for GC'ing oops passed as arguments |
|
184 |
virtual bool caller_must_gc_arguments(JavaThread* thread) const { return false; } |
|
185 |
||
186 |
// Naming |
|
187 |
const char* name() const { return _name; } |
|
188 |
void set_name(const char* name) { _name = name; } |
|
189 |
||
190 |
// Debugging |
|
191 |
virtual void verify(); |
|
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
6065
diff
changeset
|
192 |
void print() const { print_on(tty); } |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
6065
diff
changeset
|
193 |
virtual void print_on(outputStream* st) const; |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
6065
diff
changeset
|
194 |
virtual void print_value_on(outputStream* st) const; |
1 | 195 |
|
9630
d6419e4395e3
6939861: JVM should handle more conversion operations
never
parents:
7397
diff
changeset
|
196 |
// Deal with Disassembler, VTune, Forte, JvmtiExport, MemoryService. |
d6419e4395e3
6939861: JVM should handle more conversion operations
never
parents:
7397
diff
changeset
|
197 |
static void trace_new_stub(CodeBlob* blob, const char* name1, const char* name2 = ""); |
d6419e4395e3
6939861: JVM should handle more conversion operations
never
parents:
7397
diff
changeset
|
198 |
|
1 | 199 |
// Print the comment associated with offset on stream, if there is one |
13887
89b873bcc55b
7200163: add CodeComments functionality to assember stubs
kvn
parents:
13728
diff
changeset
|
200 |
virtual void print_block_comment(outputStream* stream, address block_begin) const { |
6418 | 201 |
intptr_t offset = (intptr_t)(block_begin - code_begin()); |
16368
713209c45a82
8008555: Debugging code in compiled method sometimes leaks memory
roland
parents:
13887
diff
changeset
|
202 |
_strings.print_block_comment(stream, offset); |
1 | 203 |
} |
204 |
||
205 |
// Transfer ownership of comments to this CodeBlob |
|
16368
713209c45a82
8008555: Debugging code in compiled method sometimes leaks memory
roland
parents:
13887
diff
changeset
|
206 |
void set_strings(CodeStrings& strings) { |
713209c45a82
8008555: Debugging code in compiled method sometimes leaks memory
roland
parents:
13887
diff
changeset
|
207 |
_strings.assign(strings); |
1 | 208 |
} |
209 |
}; |
|
210 |
||
27642
8c9eff693145
8059624: Test task: WhiteBox API for testing segmented codecache feature
iignatyev
parents:
27420
diff
changeset
|
211 |
class WhiteBox; |
1 | 212 |
//---------------------------------------------------------------------------------------------------- |
213 |
// BufferBlob: used to hold non-relocatable machine code such as the interpreter, stubroutines, etc. |
|
214 |
||
215 |
class BufferBlob: public CodeBlob { |
|
216 |
friend class VMStructs; |
|
5050
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
217 |
friend class AdapterBlob; |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
218 |
friend class MethodHandlesAdapterBlob; |
27642
8c9eff693145
8059624: Test task: WhiteBox API for testing segmented codecache feature
iignatyev
parents:
27420
diff
changeset
|
219 |
friend class WhiteBox; |
5050
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
220 |
|
1 | 221 |
private: |
222 |
// Creation support |
|
223 |
BufferBlob(const char* name, int size); |
|
224 |
BufferBlob(const char* name, int size, CodeBuffer* cb); |
|
225 |
||
27420
04e6f914cce1
8046809: vm/mlvm/meth/stress/compiler/deoptimize CodeCache is full.
anoll
parents:
26919
diff
changeset
|
226 |
void* operator new(size_t s, unsigned size) throw(); |
1 | 227 |
|
228 |
public: |
|
229 |
// Creation |
|
230 |
static BufferBlob* create(const char* name, int buffer_size); |
|
231 |
static BufferBlob* create(const char* name, CodeBuffer* cb); |
|
232 |
||
233 |
static void free(BufferBlob* buf); |
|
234 |
||
235 |
// Typing |
|
5050
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
236 |
virtual bool is_buffer_blob() const { return true; } |
1 | 237 |
|
238 |
// GC/Verification support |
|
239 |
void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { /* nothing to do */ } |
|
240 |
bool is_alive() const { return true; } |
|
241 |
||
242 |
void verify(); |
|
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
6065
diff
changeset
|
243 |
void print_on(outputStream* st) const; |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
6065
diff
changeset
|
244 |
void print_value_on(outputStream* st) const; |
1 | 245 |
}; |
246 |
||
247 |
||
248 |
//---------------------------------------------------------------------------------------------------- |
|
5050
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
249 |
// AdapterBlob: used to hold C2I/I2C adapters |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
250 |
|
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
251 |
class AdapterBlob: public BufferBlob { |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
252 |
private: |
6065 | 253 |
AdapterBlob(int size, CodeBuffer* cb); |
5050
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
254 |
|
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
255 |
public: |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
256 |
// Creation |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
257 |
static AdapterBlob* create(CodeBuffer* cb); |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
258 |
|
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
259 |
// Typing |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
260 |
virtual bool is_adapter_blob() const { return true; } |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
261 |
}; |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
262 |
|
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
263 |
|
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
264 |
//---------------------------------------------------------------------------------------------------- |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
265 |
// MethodHandlesAdapterBlob: used to hold MethodHandles adapters |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
266 |
|
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
267 |
class MethodHandlesAdapterBlob: public BufferBlob { |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
268 |
private: |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
269 |
MethodHandlesAdapterBlob(int size) : BufferBlob("MethodHandles adapters", size) {} |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
270 |
|
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
271 |
public: |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
272 |
// Creation |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
273 |
static MethodHandlesAdapterBlob* create(int buffer_size); |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
274 |
|
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
275 |
// Typing |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
276 |
virtual bool is_method_handles_adapter_blob() const { return true; } |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
277 |
}; |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
278 |
|
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
279 |
|
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
280 |
//---------------------------------------------------------------------------------------------------- |
1 | 281 |
// RuntimeStub: describes stubs used by compiled code to call a (static) C++ runtime routine |
282 |
||
283 |
class RuntimeStub: public CodeBlob { |
|
284 |
friend class VMStructs; |
|
285 |
private: |
|
286 |
bool _caller_must_gc_arguments; |
|
287 |
||
288 |
// Creation support |
|
289 |
RuntimeStub( |
|
290 |
const char* name, |
|
291 |
CodeBuffer* cb, |
|
292 |
int size, |
|
293 |
int frame_complete, |
|
294 |
int frame_size, |
|
295 |
OopMapSet* oop_maps, |
|
296 |
bool caller_must_gc_arguments |
|
297 |
); |
|
298 |
||
19696
bd5a0131bde1
8021954: VM SIGSEGV during classloading on MacOS; hs_err_pid file produced
coleenp
parents:
16368
diff
changeset
|
299 |
void* operator new(size_t s, unsigned size) throw(); |
1 | 300 |
|
301 |
public: |
|
302 |
// Creation |
|
303 |
static RuntimeStub* new_runtime_stub( |
|
304 |
const char* stub_name, |
|
305 |
CodeBuffer* cb, |
|
306 |
int frame_complete, |
|
307 |
int frame_size, |
|
308 |
OopMapSet* oop_maps, |
|
309 |
bool caller_must_gc_arguments |
|
310 |
); |
|
311 |
||
312 |
// Typing |
|
313 |
bool is_runtime_stub() const { return true; } |
|
314 |
||
315 |
// GC support |
|
316 |
bool caller_must_gc_arguments(JavaThread* thread) const { return _caller_must_gc_arguments; } |
|
317 |
||
6418 | 318 |
address entry_point() { return code_begin(); } |
1 | 319 |
|
320 |
// GC/Verification support |
|
321 |
void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* nothing to do */ } |
|
322 |
bool is_alive() const { return true; } |
|
323 |
||
324 |
void verify(); |
|
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
6065
diff
changeset
|
325 |
void print_on(outputStream* st) const; |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
6065
diff
changeset
|
326 |
void print_value_on(outputStream* st) const; |
1 | 327 |
}; |
328 |
||
329 |
||
330 |
//---------------------------------------------------------------------------------------------------- |
|
331 |
// Super-class for all blobs that exist in only one instance. Implements default behaviour. |
|
332 |
||
333 |
class SingletonBlob: public CodeBlob { |
|
334 |
friend class VMStructs; |
|
9630
d6419e4395e3
6939861: JVM should handle more conversion operations
never
parents:
7397
diff
changeset
|
335 |
|
d6419e4395e3
6939861: JVM should handle more conversion operations
never
parents:
7397
diff
changeset
|
336 |
protected: |
19696
bd5a0131bde1
8021954: VM SIGSEGV during classloading on MacOS; hs_err_pid file produced
coleenp
parents:
16368
diff
changeset
|
337 |
void* operator new(size_t s, unsigned size) throw(); |
9630
d6419e4395e3
6939861: JVM should handle more conversion operations
never
parents:
7397
diff
changeset
|
338 |
|
d6419e4395e3
6939861: JVM should handle more conversion operations
never
parents:
7397
diff
changeset
|
339 |
public: |
1 | 340 |
SingletonBlob( |
341 |
const char* name, |
|
342 |
CodeBuffer* cb, |
|
343 |
int header_size, |
|
344 |
int size, |
|
345 |
int frame_size, |
|
346 |
OopMapSet* oop_maps |
|
347 |
) |
|
348 |
: CodeBlob(name, cb, header_size, size, CodeOffsets::frame_never_safe, frame_size, oop_maps) |
|
6418 | 349 |
{}; |
1 | 350 |
|
6418 | 351 |
address entry_point() { return code_begin(); } |
1 | 352 |
|
6418 | 353 |
bool is_alive() const { return true; } |
354 |
||
355 |
void verify(); // does nothing |
|
356 |
void print_on(outputStream* st) const; |
|
357 |
void print_value_on(outputStream* st) const; |
|
1 | 358 |
}; |
359 |
||
360 |
||
361 |
//---------------------------------------------------------------------------------------------------- |
|
362 |
// DeoptimizationBlob |
|
363 |
||
364 |
class DeoptimizationBlob: public SingletonBlob { |
|
365 |
friend class VMStructs; |
|
366 |
private: |
|
367 |
int _unpack_offset; |
|
368 |
int _unpack_with_exception; |
|
369 |
int _unpack_with_reexecution; |
|
370 |
||
371 |
int _unpack_with_exception_in_tls; |
|
372 |
||
373 |
// Creation support |
|
374 |
DeoptimizationBlob( |
|
375 |
CodeBuffer* cb, |
|
376 |
int size, |
|
377 |
OopMapSet* oop_maps, |
|
378 |
int unpack_offset, |
|
379 |
int unpack_with_exception_offset, |
|
380 |
int unpack_with_reexecution_offset, |
|
381 |
int frame_size |
|
382 |
); |
|
383 |
||
384 |
public: |
|
385 |
// Creation |
|
386 |
static DeoptimizationBlob* create( |
|
387 |
CodeBuffer* cb, |
|
388 |
OopMapSet* oop_maps, |
|
389 |
int unpack_offset, |
|
390 |
int unpack_with_exception_offset, |
|
391 |
int unpack_with_reexecution_offset, |
|
392 |
int frame_size |
|
393 |
); |
|
394 |
||
395 |
// Typing |
|
396 |
bool is_deoptimization_stub() const { return true; } |
|
397 |
bool exception_address_is_unpack_entry(address pc) const { |
|
398 |
address unpack_pc = unpack(); |
|
399 |
return (pc == unpack_pc || (pc + frame::pc_return_offset) == unpack_pc); |
|
400 |
} |
|
401 |
||
402 |
// GC for args |
|
403 |
void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* Nothing to do */ } |
|
404 |
||
405 |
// Printing |
|
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
6065
diff
changeset
|
406 |
void print_value_on(outputStream* st) const; |
1 | 407 |
|
6418 | 408 |
address unpack() const { return code_begin() + _unpack_offset; } |
409 |
address unpack_with_exception() const { return code_begin() + _unpack_with_exception; } |
|
410 |
address unpack_with_reexecution() const { return code_begin() + _unpack_with_reexecution; } |
|
1 | 411 |
|
412 |
// Alternate entry point for C1 where the exception and issuing pc |
|
413 |
// are in JavaThread::_exception_oop and JavaThread::_exception_pc |
|
414 |
// instead of being in registers. This is needed because C1 doesn't |
|
415 |
// model exception paths in a way that keeps these registers free so |
|
416 |
// there may be live values in those registers during deopt. |
|
417 |
void set_unpack_with_exception_in_tls_offset(int offset) { |
|
418 |
_unpack_with_exception_in_tls = offset; |
|
6418 | 419 |
assert(code_contains(code_begin() + _unpack_with_exception_in_tls), "must be PC inside codeblob"); |
1 | 420 |
} |
6418 | 421 |
address unpack_with_exception_in_tls() const { return code_begin() + _unpack_with_exception_in_tls; } |
1 | 422 |
}; |
423 |
||
424 |
||
425 |
//---------------------------------------------------------------------------------------------------- |
|
426 |
// UncommonTrapBlob (currently only used by Compiler 2) |
|
427 |
||
428 |
#ifdef COMPILER2 |
|
429 |
||
430 |
class UncommonTrapBlob: public SingletonBlob { |
|
431 |
friend class VMStructs; |
|
432 |
private: |
|
433 |
// Creation support |
|
434 |
UncommonTrapBlob( |
|
435 |
CodeBuffer* cb, |
|
436 |
int size, |
|
437 |
OopMapSet* oop_maps, |
|
438 |
int frame_size |
|
439 |
); |
|
440 |
||
441 |
public: |
|
442 |
// Creation |
|
443 |
static UncommonTrapBlob* create( |
|
444 |
CodeBuffer* cb, |
|
445 |
OopMapSet* oop_maps, |
|
446 |
int frame_size |
|
447 |
); |
|
448 |
||
449 |
// GC for args |
|
450 |
void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* nothing to do */ } |
|
451 |
||
452 |
// Typing |
|
453 |
bool is_uncommon_trap_stub() const { return true; } |
|
454 |
}; |
|
455 |
||
456 |
||
457 |
//---------------------------------------------------------------------------------------------------- |
|
458 |
// ExceptionBlob: used for exception unwinding in compiled code (currently only used by Compiler 2) |
|
459 |
||
460 |
class ExceptionBlob: public SingletonBlob { |
|
461 |
friend class VMStructs; |
|
462 |
private: |
|
463 |
// Creation support |
|
464 |
ExceptionBlob( |
|
465 |
CodeBuffer* cb, |
|
466 |
int size, |
|
467 |
OopMapSet* oop_maps, |
|
468 |
int frame_size |
|
469 |
); |
|
470 |
||
471 |
public: |
|
472 |
// Creation |
|
473 |
static ExceptionBlob* create( |
|
474 |
CodeBuffer* cb, |
|
475 |
OopMapSet* oop_maps, |
|
476 |
int frame_size |
|
477 |
); |
|
478 |
||
479 |
// GC for args |
|
480 |
void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { /* nothing to do */ } |
|
481 |
||
482 |
// Typing |
|
483 |
bool is_exception_stub() const { return true; } |
|
484 |
}; |
|
485 |
#endif // COMPILER2 |
|
486 |
||
487 |
||
488 |
//---------------------------------------------------------------------------------------------------- |
|
489 |
// SafepointBlob: handles illegal_instruction exceptions during a safepoint |
|
490 |
||
491 |
class SafepointBlob: public SingletonBlob { |
|
492 |
friend class VMStructs; |
|
493 |
private: |
|
494 |
// Creation support |
|
495 |
SafepointBlob( |
|
496 |
CodeBuffer* cb, |
|
497 |
int size, |
|
498 |
OopMapSet* oop_maps, |
|
499 |
int frame_size |
|
500 |
); |
|
501 |
||
502 |
public: |
|
503 |
// Creation |
|
504 |
static SafepointBlob* create( |
|
505 |
CodeBuffer* cb, |
|
506 |
OopMapSet* oop_maps, |
|
507 |
int frame_size |
|
508 |
); |
|
509 |
||
510 |
// GC for args |
|
511 |
void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { /* nothing to do */ } |
|
512 |
||
513 |
// Typing |
|
514 |
bool is_safepoint_stub() const { return true; } |
|
515 |
}; |
|
7397 | 516 |
|
517 |
#endif // SHARE_VM_CODE_CODEBLOB_HPP |