author | bobv |
Tue, 03 Aug 2010 08:13:38 -0400 | |
changeset 6176 | 4d9030fe341f |
parent 6065 | 26016b8ed869 |
child 6418 | 6671edbd230e |
permissions | -rw-r--r-- |
1 | 1 |
/* |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5050
diff
changeset
|
2 |
* Copyright (c) 1998, 2010, 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 |
||
25 |
// CodeBlob - superclass for all entries in the CodeCache. |
|
26 |
// |
|
27 |
// Suptypes are: |
|
28 |
// nmethod : Compiled Java methods (include method that calls to native code) |
|
29 |
// RuntimeStub : Call to VM runtime methods |
|
30 |
// DeoptimizationBlob : Used for deoptimizatation |
|
31 |
// ExceptionBlob : Used for stack unrolling |
|
32 |
// SafepointBlob : Used to handle illegal instruction exceptions |
|
33 |
// |
|
34 |
// |
|
35 |
// Layout: |
|
36 |
// - header |
|
37 |
// - relocation |
|
38 |
// - instruction space |
|
39 |
// - data space |
|
40 |
class DeoptimizationBlob; |
|
41 |
||
42 |
class CodeBlob VALUE_OBJ_CLASS_SPEC { |
|
43 |
||
44 |
friend class VMStructs; |
|
45 |
||
46 |
private: |
|
47 |
const char* _name; |
|
48 |
int _size; // total size of CodeBlob in bytes |
|
49 |
int _header_size; // size of header (depends on subclass) |
|
50 |
int _relocation_size; // size of relocation |
|
51 |
int _instructions_offset; // offset to where instructions region begins |
|
52 |
int _frame_complete_offset; // instruction offsets in [0.._frame_complete_offset) have |
|
53 |
// not finished setting up their frame. Beware of pc's in |
|
54 |
// that range. There is a similar range(s) on returns |
|
55 |
// which we don't detect. |
|
56 |
int _data_offset; // offset to where data region begins |
|
57 |
int _frame_size; // size of stack frame |
|
58 |
OopMapSet* _oop_maps; // OopMap for this CodeBlob |
|
59 |
CodeComments _comments; |
|
60 |
||
61 |
friend class OopRecorder; |
|
62 |
||
63 |
public: |
|
64 |
// Returns the space needed for CodeBlob |
|
65 |
static unsigned int allocation_size(CodeBuffer* cb, int header_size); |
|
66 |
||
67 |
// Creation |
|
68 |
// a) simple CodeBlob |
|
69 |
// frame_complete is the offset from the beginning of the instructions |
|
70 |
// to where the frame setup (from stackwalk viewpoint) is complete. |
|
71 |
CodeBlob(const char* name, int header_size, int size, int frame_complete, int locs_size); |
|
72 |
||
73 |
// b) full CodeBlob |
|
74 |
CodeBlob( |
|
75 |
const char* name, |
|
76 |
CodeBuffer* cb, |
|
77 |
int header_size, |
|
78 |
int size, |
|
79 |
int frame_complete, |
|
80 |
int frame_size, |
|
81 |
OopMapSet* oop_maps |
|
82 |
); |
|
83 |
||
84 |
// Deletion |
|
85 |
void flush(); |
|
86 |
||
87 |
// Typing |
|
5050
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
88 |
virtual bool is_buffer_blob() const { return false; } |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
89 |
virtual bool is_nmethod() const { return false; } |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
90 |
virtual bool is_runtime_stub() const { return false; } |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
91 |
virtual bool is_deoptimization_stub() const { return false; } |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
92 |
virtual bool is_uncommon_trap_stub() const { return false; } |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
93 |
virtual bool is_exception_stub() const { return false; } |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
94 |
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
|
95 |
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
|
96 |
virtual bool is_method_handles_adapter_blob() const { return false; } |
1 | 97 |
|
98 |
virtual bool is_compiled_by_c2() const { return false; } |
|
99 |
virtual bool is_compiled_by_c1() const { return false; } |
|
100 |
||
4564
55dfb20908d0
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
3908
diff
changeset
|
101 |
// Casting |
55dfb20908d0
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
3908
diff
changeset
|
102 |
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
|
103 |
|
1 | 104 |
// Boundaries |
105 |
address header_begin() const { return (address) this; } |
|
106 |
address header_end() const { return ((address) this) + _header_size; }; |
|
107 |
relocInfo* relocation_begin() const { return (relocInfo*) header_end(); }; |
|
108 |
relocInfo* relocation_end() const { return (relocInfo*)(header_end() + _relocation_size); } |
|
109 |
address instructions_begin() const { return (address) header_begin() + _instructions_offset; } |
|
110 |
address instructions_end() const { return (address) header_begin() + _data_offset; } |
|
111 |
address data_begin() const { return (address) header_begin() + _data_offset; } |
|
112 |
address data_end() const { return (address) header_begin() + _size; } |
|
113 |
||
114 |
// Offsets |
|
115 |
int relocation_offset() const { return _header_size; } |
|
116 |
int instructions_offset() const { return _instructions_offset; } |
|
117 |
int data_offset() const { return _data_offset; } |
|
118 |
||
119 |
// Sizes |
|
120 |
int size() const { return _size; } |
|
121 |
int header_size() const { return _header_size; } |
|
122 |
int relocation_size() const { return (address) relocation_end() - (address) relocation_begin(); } |
|
123 |
int instructions_size() const { return instructions_end() - instructions_begin(); } |
|
124 |
int data_size() const { return data_end() - data_begin(); } |
|
125 |
||
126 |
// Containment |
|
127 |
bool blob_contains(address addr) const { return header_begin() <= addr && addr < data_end(); } |
|
128 |
bool relocation_contains(relocInfo* addr) const{ return relocation_begin() <= addr && addr < relocation_end(); } |
|
129 |
bool instructions_contains(address addr) const { return instructions_begin() <= addr && addr < instructions_end(); } |
|
130 |
bool data_contains(address addr) const { return data_begin() <= addr && addr < data_end(); } |
|
131 |
bool contains(address addr) const { return instructions_contains(addr); } |
|
132 |
bool is_frame_complete_at(address addr) const { return instructions_contains(addr) && |
|
133 |
addr >= instructions_begin() + _frame_complete_offset; } |
|
134 |
||
135 |
// CodeCache support: really only used by the nmethods, but in order to get |
|
136 |
// asserts and certain bookkeeping to work in the CodeCache they are defined |
|
137 |
// virtual here. |
|
138 |
virtual bool is_zombie() const { return false; } |
|
139 |
virtual bool is_locked_by_vm() const { return false; } |
|
140 |
||
141 |
virtual bool is_unloaded() const { return false; } |
|
142 |
virtual bool is_not_entrant() const { return false; } |
|
143 |
||
144 |
// GC support |
|
145 |
virtual bool is_alive() const = 0; |
|
146 |
||
147 |
// OopMap for frame |
|
148 |
OopMapSet* oop_maps() const { return _oop_maps; } |
|
149 |
void set_oop_maps(OopMapSet* p); |
|
150 |
OopMap* oop_map_for_return_address(address return_address); |
|
151 |
virtual void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { ShouldNotReachHere(); } |
|
152 |
||
153 |
// Frame support |
|
154 |
int frame_size() const { return _frame_size; } |
|
155 |
void set_frame_size(int size) { _frame_size = size; } |
|
156 |
||
157 |
// Returns true, if the next frame is responsible for GC'ing oops passed as arguments |
|
158 |
virtual bool caller_must_gc_arguments(JavaThread* thread) const { return false; } |
|
159 |
||
160 |
// Naming |
|
161 |
const char* name() const { return _name; } |
|
162 |
void set_name(const char* name) { _name = name; } |
|
163 |
||
164 |
// Debugging |
|
165 |
virtual void verify(); |
|
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
6065
diff
changeset
|
166 |
void print() const { print_on(tty); } |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
6065
diff
changeset
|
167 |
virtual void print_on(outputStream* st) const; |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
6065
diff
changeset
|
168 |
virtual void print_value_on(outputStream* st) const; |
1 | 169 |
|
170 |
// Print the comment associated with offset on stream, if there is one |
|
4584
e2a449e8cc6f
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
4564
diff
changeset
|
171 |
virtual void print_block_comment(outputStream* stream, address block_begin) { |
e2a449e8cc6f
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
4564
diff
changeset
|
172 |
intptr_t offset = (intptr_t)(block_begin - instructions_begin()); |
1 | 173 |
_comments.print_block_comment(stream, offset); |
174 |
} |
|
175 |
||
176 |
// Transfer ownership of comments to this CodeBlob |
|
177 |
void set_comments(CodeComments& comments) { |
|
178 |
_comments.assign(comments); |
|
179 |
} |
|
180 |
}; |
|
181 |
||
182 |
||
183 |
//---------------------------------------------------------------------------------------------------- |
|
184 |
// BufferBlob: used to hold non-relocatable machine code such as the interpreter, stubroutines, etc. |
|
185 |
||
186 |
class BufferBlob: public CodeBlob { |
|
187 |
friend class VMStructs; |
|
5050
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
188 |
friend class AdapterBlob; |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
189 |
friend class MethodHandlesAdapterBlob; |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
190 |
|
1 | 191 |
private: |
192 |
// Creation support |
|
193 |
BufferBlob(const char* name, int size); |
|
194 |
BufferBlob(const char* name, int size, CodeBuffer* cb); |
|
195 |
||
196 |
void* operator new(size_t s, unsigned size); |
|
197 |
||
198 |
public: |
|
199 |
// Creation |
|
200 |
static BufferBlob* create(const char* name, int buffer_size); |
|
201 |
static BufferBlob* create(const char* name, CodeBuffer* cb); |
|
202 |
||
203 |
static void free(BufferBlob* buf); |
|
204 |
||
205 |
// Typing |
|
5050
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
206 |
virtual bool is_buffer_blob() const { return true; } |
1 | 207 |
|
208 |
// GC/Verification support |
|
209 |
void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { /* nothing to do */ } |
|
210 |
bool is_alive() const { return true; } |
|
211 |
||
212 |
void verify(); |
|
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
6065
diff
changeset
|
213 |
void print_on(outputStream* st) const; |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
6065
diff
changeset
|
214 |
void print_value_on(outputStream* st) const; |
1 | 215 |
}; |
216 |
||
217 |
||
218 |
//---------------------------------------------------------------------------------------------------- |
|
5050
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
219 |
// 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
|
220 |
|
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
221 |
class AdapterBlob: public BufferBlob { |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
222 |
private: |
6065 | 223 |
AdapterBlob(int size, CodeBuffer* cb); |
5050
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
224 |
|
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
225 |
public: |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
226 |
// Creation |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
227 |
static AdapterBlob* create(CodeBuffer* cb); |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
228 |
|
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
229 |
// Typing |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
230 |
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
|
231 |
}; |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
232 |
|
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
233 |
|
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
234 |
//---------------------------------------------------------------------------------------------------- |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
235 |
// MethodHandlesAdapterBlob: used to hold MethodHandles adapters |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
236 |
|
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
237 |
class MethodHandlesAdapterBlob: public BufferBlob { |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
238 |
private: |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
239 |
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
|
240 |
MethodHandlesAdapterBlob(int size, CodeBuffer* cb) : BufferBlob("MethodHandles adapters", size, cb) {} |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
241 |
|
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
242 |
public: |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
243 |
// Creation |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
244 |
static MethodHandlesAdapterBlob* create(int buffer_size); |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
245 |
|
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
246 |
// Typing |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
247 |
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
|
248 |
}; |
47ecd86932ce
6934494: JSR 292 MethodHandles adapters should be generated into their own CodeBlob
twisti
parents:
4584
diff
changeset
|
249 |
|
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 |
//---------------------------------------------------------------------------------------------------- |
1 | 252 |
// RuntimeStub: describes stubs used by compiled code to call a (static) C++ runtime routine |
253 |
||
254 |
class RuntimeStub: public CodeBlob { |
|
255 |
friend class VMStructs; |
|
256 |
private: |
|
257 |
bool _caller_must_gc_arguments; |
|
258 |
||
259 |
// Creation support |
|
260 |
RuntimeStub( |
|
261 |
const char* name, |
|
262 |
CodeBuffer* cb, |
|
263 |
int size, |
|
264 |
int frame_complete, |
|
265 |
int frame_size, |
|
266 |
OopMapSet* oop_maps, |
|
267 |
bool caller_must_gc_arguments |
|
268 |
); |
|
269 |
||
270 |
void* operator new(size_t s, unsigned size); |
|
271 |
||
272 |
public: |
|
273 |
// Creation |
|
274 |
static RuntimeStub* new_runtime_stub( |
|
275 |
const char* stub_name, |
|
276 |
CodeBuffer* cb, |
|
277 |
int frame_complete, |
|
278 |
int frame_size, |
|
279 |
OopMapSet* oop_maps, |
|
280 |
bool caller_must_gc_arguments |
|
281 |
); |
|
282 |
||
283 |
// Typing |
|
284 |
bool is_runtime_stub() const { return true; } |
|
285 |
||
286 |
// GC support |
|
287 |
bool caller_must_gc_arguments(JavaThread* thread) const { return _caller_must_gc_arguments; } |
|
288 |
||
289 |
address entry_point() { return instructions_begin(); } |
|
290 |
||
291 |
// GC/Verification support |
|
292 |
void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* nothing to do */ } |
|
293 |
bool is_alive() const { return true; } |
|
294 |
||
295 |
void verify(); |
|
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
6065
diff
changeset
|
296 |
void print_on(outputStream* st) const; |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
6065
diff
changeset
|
297 |
void print_value_on(outputStream* st) const; |
1 | 298 |
}; |
299 |
||
300 |
||
301 |
//---------------------------------------------------------------------------------------------------- |
|
302 |
// Super-class for all blobs that exist in only one instance. Implements default behaviour. |
|
303 |
||
304 |
class SingletonBlob: public CodeBlob { |
|
305 |
friend class VMStructs; |
|
306 |
public: |
|
307 |
SingletonBlob( |
|
308 |
const char* name, |
|
309 |
CodeBuffer* cb, |
|
310 |
int header_size, |
|
311 |
int size, |
|
312 |
int frame_size, |
|
313 |
OopMapSet* oop_maps |
|
314 |
) |
|
315 |
: CodeBlob(name, cb, header_size, size, CodeOffsets::frame_never_safe, frame_size, oop_maps) |
|
316 |
{}; |
|
317 |
||
318 |
bool is_alive() const { return true; } |
|
319 |
||
320 |
void verify(); // does nothing |
|
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
6065
diff
changeset
|
321 |
void print_on(outputStream* st) const; |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
6065
diff
changeset
|
322 |
void print_value_on(outputStream* st) const; |
1 | 323 |
}; |
324 |
||
325 |
||
326 |
//---------------------------------------------------------------------------------------------------- |
|
327 |
// DeoptimizationBlob |
|
328 |
||
329 |
class DeoptimizationBlob: public SingletonBlob { |
|
330 |
friend class VMStructs; |
|
331 |
private: |
|
332 |
int _unpack_offset; |
|
333 |
int _unpack_with_exception; |
|
334 |
int _unpack_with_reexecution; |
|
335 |
||
336 |
int _unpack_with_exception_in_tls; |
|
337 |
||
338 |
// Creation support |
|
339 |
DeoptimizationBlob( |
|
340 |
CodeBuffer* cb, |
|
341 |
int size, |
|
342 |
OopMapSet* oop_maps, |
|
343 |
int unpack_offset, |
|
344 |
int unpack_with_exception_offset, |
|
345 |
int unpack_with_reexecution_offset, |
|
346 |
int frame_size |
|
347 |
); |
|
348 |
||
349 |
void* operator new(size_t s, unsigned size); |
|
350 |
||
351 |
public: |
|
352 |
// Creation |
|
353 |
static DeoptimizationBlob* create( |
|
354 |
CodeBuffer* cb, |
|
355 |
OopMapSet* oop_maps, |
|
356 |
int unpack_offset, |
|
357 |
int unpack_with_exception_offset, |
|
358 |
int unpack_with_reexecution_offset, |
|
359 |
int frame_size |
|
360 |
); |
|
361 |
||
362 |
// Typing |
|
363 |
bool is_deoptimization_stub() const { return true; } |
|
364 |
const DeoptimizationBlob *as_deoptimization_stub() const { return this; } |
|
365 |
bool exception_address_is_unpack_entry(address pc) const { |
|
366 |
address unpack_pc = unpack(); |
|
367 |
return (pc == unpack_pc || (pc + frame::pc_return_offset) == unpack_pc); |
|
368 |
} |
|
369 |
||
370 |
||
371 |
||
372 |
||
373 |
// GC for args |
|
374 |
void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* Nothing to do */ } |
|
375 |
||
376 |
// Printing |
|
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
6065
diff
changeset
|
377 |
void print_value_on(outputStream* st) const; |
1 | 378 |
|
379 |
address unpack() const { return instructions_begin() + _unpack_offset; } |
|
380 |
address unpack_with_exception() const { return instructions_begin() + _unpack_with_exception; } |
|
381 |
address unpack_with_reexecution() const { return instructions_begin() + _unpack_with_reexecution; } |
|
382 |
||
383 |
// Alternate entry point for C1 where the exception and issuing pc |
|
384 |
// are in JavaThread::_exception_oop and JavaThread::_exception_pc |
|
385 |
// instead of being in registers. This is needed because C1 doesn't |
|
386 |
// model exception paths in a way that keeps these registers free so |
|
387 |
// there may be live values in those registers during deopt. |
|
388 |
void set_unpack_with_exception_in_tls_offset(int offset) { |
|
389 |
_unpack_with_exception_in_tls = offset; |
|
390 |
assert(contains(instructions_begin() + _unpack_with_exception_in_tls), "must be PC inside codeblob"); |
|
391 |
} |
|
392 |
address unpack_with_exception_in_tls() const { return instructions_begin() + _unpack_with_exception_in_tls; } |
|
393 |
}; |
|
394 |
||
395 |
||
396 |
//---------------------------------------------------------------------------------------------------- |
|
397 |
// UncommonTrapBlob (currently only used by Compiler 2) |
|
398 |
||
399 |
#ifdef COMPILER2 |
|
400 |
||
401 |
class UncommonTrapBlob: public SingletonBlob { |
|
402 |
friend class VMStructs; |
|
403 |
private: |
|
404 |
// Creation support |
|
405 |
UncommonTrapBlob( |
|
406 |
CodeBuffer* cb, |
|
407 |
int size, |
|
408 |
OopMapSet* oop_maps, |
|
409 |
int frame_size |
|
410 |
); |
|
411 |
||
412 |
void* operator new(size_t s, unsigned size); |
|
413 |
||
414 |
public: |
|
415 |
// Creation |
|
416 |
static UncommonTrapBlob* create( |
|
417 |
CodeBuffer* cb, |
|
418 |
OopMapSet* oop_maps, |
|
419 |
int frame_size |
|
420 |
); |
|
421 |
||
422 |
// GC for args |
|
423 |
void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* nothing to do */ } |
|
424 |
||
425 |
// Typing |
|
426 |
bool is_uncommon_trap_stub() const { return true; } |
|
427 |
}; |
|
428 |
||
429 |
||
430 |
//---------------------------------------------------------------------------------------------------- |
|
431 |
// ExceptionBlob: used for exception unwinding in compiled code (currently only used by Compiler 2) |
|
432 |
||
433 |
class ExceptionBlob: public SingletonBlob { |
|
434 |
friend class VMStructs; |
|
435 |
private: |
|
436 |
// Creation support |
|
437 |
ExceptionBlob( |
|
438 |
CodeBuffer* cb, |
|
439 |
int size, |
|
440 |
OopMapSet* oop_maps, |
|
441 |
int frame_size |
|
442 |
); |
|
443 |
||
444 |
void* operator new(size_t s, unsigned size); |
|
445 |
||
446 |
public: |
|
447 |
// Creation |
|
448 |
static ExceptionBlob* create( |
|
449 |
CodeBuffer* cb, |
|
450 |
OopMapSet* oop_maps, |
|
451 |
int frame_size |
|
452 |
); |
|
453 |
||
454 |
// GC for args |
|
455 |
void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { /* nothing to do */ } |
|
456 |
||
457 |
// Typing |
|
458 |
bool is_exception_stub() const { return true; } |
|
459 |
}; |
|
460 |
#endif // COMPILER2 |
|
461 |
||
462 |
||
463 |
//---------------------------------------------------------------------------------------------------- |
|
464 |
// SafepointBlob: handles illegal_instruction exceptions during a safepoint |
|
465 |
||
466 |
class SafepointBlob: public SingletonBlob { |
|
467 |
friend class VMStructs; |
|
468 |
private: |
|
469 |
// Creation support |
|
470 |
SafepointBlob( |
|
471 |
CodeBuffer* cb, |
|
472 |
int size, |
|
473 |
OopMapSet* oop_maps, |
|
474 |
int frame_size |
|
475 |
); |
|
476 |
||
477 |
void* operator new(size_t s, unsigned size); |
|
478 |
||
479 |
public: |
|
480 |
// Creation |
|
481 |
static SafepointBlob* create( |
|
482 |
CodeBuffer* cb, |
|
483 |
OopMapSet* oop_maps, |
|
484 |
int frame_size |
|
485 |
); |
|
486 |
||
487 |
// GC for args |
|
488 |
void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { /* nothing to do */ } |
|
489 |
||
490 |
// Typing |
|
491 |
bool is_safepoint_stub() const { return true; } |
|
492 |
}; |