author | twisti |
Thu, 15 May 2014 11:35:26 -0700 | |
changeset 24446 | dca843327b90 |
parent 24018 | 77b156916bab |
child 28039 | bf5a8340bf8a |
permissions | -rw-r--r-- |
1 | 1 |
/* |
22234
da823d78ad65
8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents:
15943
diff
changeset
|
2 |
* Copyright (c) 1997, 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:
3795
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3795
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:
3795
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef SHARE_VM_RUNTIME_VFRAMEARRAY_HPP |
26 |
#define SHARE_VM_RUNTIME_VFRAMEARRAY_HPP |
|
27 |
||
28 |
#include "oops/arrayOop.hpp" |
|
29 |
#include "runtime/deoptimization.hpp" |
|
30 |
#include "runtime/frame.inline.hpp" |
|
31 |
#include "runtime/monitorChunk.hpp" |
|
32 |
#include "utilities/growableArray.hpp" |
|
33 |
||
1 | 34 |
// A vframeArray is an array used for momentarily storing off stack Java method activations |
35 |
// during deoptimization. Essentially it is an array of vframes where each vframe |
|
36 |
// data is stored off stack. This structure will never exist across a safepoint so |
|
37 |
// there is no need to gc any oops that are stored in the structure. |
|
38 |
||
39 |
||
40 |
class LocalsClosure; |
|
41 |
class ExpressionStackClosure; |
|
42 |
class MonitorStackClosure; |
|
43 |
class MonitorArrayElement; |
|
44 |
class StackValueCollection; |
|
45 |
||
46 |
// A vframeArrayElement is an element of a vframeArray. Each element |
|
47 |
// represent an interpreter frame which will eventually be created. |
|
48 |
||
49 |
class vframeArrayElement : public _ValueObj { |
|
10547 | 50 |
friend class VMStructs; |
51 |
||
1 | 52 |
private: |
53 |
||
54 |
frame _frame; // the interpreter frame we will unpack into |
|
3600
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
1
diff
changeset
|
55 |
int _bci; // raw bci for this vframe |
22551 | 56 |
bool _reexecute; // whether we should reexecute this bytecode |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
57 |
Method* _method; // the method for this vframe |
1 | 58 |
MonitorChunk* _monitors; // active monitors for this vframe |
59 |
StackValueCollection* _locals; |
|
60 |
StackValueCollection* _expressions; |
|
61 |
||
62 |
public: |
|
63 |
||
64 |
frame* iframe(void) { return &_frame; } |
|
65 |
||
66 |
int bci(void) const; |
|
67 |
||
68 |
int raw_bci(void) const { return _bci; } |
|
3600
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
1
diff
changeset
|
69 |
bool should_reexecute(void) const { return _reexecute; } |
1 | 70 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
71 |
Method* method(void) const { return _method; } |
1 | 72 |
|
73 |
MonitorChunk* monitors(void) const { return _monitors; } |
|
74 |
||
75 |
void free_monitors(JavaThread* jt); |
|
76 |
||
77 |
StackValueCollection* locals(void) const { return _locals; } |
|
78 |
||
79 |
StackValueCollection* expressions(void) const { return _expressions; } |
|
80 |
||
81 |
void fill_in(compiledVFrame* vf); |
|
82 |
||
83 |
// Formerly part of deoptimizedVFrame |
|
84 |
||
85 |
||
86 |
// Returns the on stack word size for this frame |
|
87 |
// callee_parameters is the number of callee locals residing inside this frame |
|
24018
77b156916bab
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
22551
diff
changeset
|
88 |
int on_stack_size(int callee_parameters, |
1 | 89 |
int callee_locals, |
90 |
bool is_top_frame, |
|
91 |
int popframe_extra_stack_expression_els) const; |
|
92 |
||
93 |
// Unpacks the element to skeletal interpreter frame |
|
9636
363ca5579aff
7043461: VM crashes in void LinkResolver::runtime_resolve_virtual_method
never
parents:
7397
diff
changeset
|
94 |
void unpack_on_stack(int caller_actual_parameters, |
363ca5579aff
7043461: VM crashes in void LinkResolver::runtime_resolve_virtual_method
never
parents:
7397
diff
changeset
|
95 |
int callee_parameters, |
1 | 96 |
int callee_locals, |
97 |
frame* caller, |
|
98 |
bool is_top_frame, |
|
15943
d830a939d985
8009761: Deoptimization on sparc doesn't set Llast_SP correctly in the interpreter frames it creates
roland
parents:
13728
diff
changeset
|
99 |
bool is_bottom_frame, |
1 | 100 |
int exec_mode); |
101 |
||
102 |
#ifndef PRODUCT |
|
103 |
void print(outputStream* st); |
|
104 |
#endif /* PRODUCT */ |
|
105 |
}; |
|
106 |
||
107 |
// this can be a ResourceObj if we don't save the last one... |
|
108 |
// but it does make debugging easier even if we can't look |
|
109 |
// at the data in each vframeElement |
|
110 |
||
13195 | 111 |
class vframeArray: public CHeapObj<mtCompiler> { |
10547 | 112 |
friend class VMStructs; |
113 |
||
1 | 114 |
private: |
115 |
||
116 |
||
117 |
// Here is what a vframeArray looks like in memory |
|
118 |
||
119 |
/* |
|
120 |
fixed part |
|
121 |
description of the original frame |
|
122 |
_frames - number of vframes in this array |
|
123 |
adapter info |
|
124 |
callee register save area |
|
125 |
variable part |
|
126 |
vframeArrayElement [ 0 ] |
|
127 |
... |
|
128 |
vframeArrayElement [_frames - 1] |
|
129 |
||
130 |
*/ |
|
131 |
||
132 |
JavaThread* _owner_thread; |
|
133 |
vframeArray* _next; |
|
134 |
frame _original; // the original frame of the deoptee |
|
135 |
frame _caller; // caller of root frame in vframeArray |
|
136 |
frame _sender; |
|
137 |
||
138 |
Deoptimization::UnrollBlock* _unroll_block; |
|
139 |
int _frame_size; |
|
140 |
||
141 |
int _frames; // number of javavframes in the array (does not count any adapter) |
|
142 |
||
143 |
intptr_t _callee_registers[RegisterMap::reg_count]; |
|
144 |
unsigned char _valid[RegisterMap::reg_count]; |
|
145 |
||
146 |
vframeArrayElement _elements[1]; // First variable section. |
|
147 |
||
148 |
void fill_in_element(int index, compiledVFrame* vf); |
|
149 |
||
150 |
bool is_location_valid(int i) const { return _valid[i] != 0; } |
|
151 |
void set_location_valid(int i, bool valid) { _valid[i] = valid; } |
|
152 |
||
153 |
public: |
|
154 |
||
155 |
||
156 |
// Tells whether index is within bounds. |
|
157 |
bool is_within_bounds(int index) const { return 0 <= index && index < frames(); } |
|
158 |
||
22551 | 159 |
// Accessories for instance variable |
1 | 160 |
int frames() const { return _frames; } |
161 |
||
162 |
static vframeArray* allocate(JavaThread* thread, int frame_size, GrowableArray<compiledVFrame*>* chunk, |
|
163 |
RegisterMap* reg_map, frame sender, frame caller, frame self); |
|
164 |
||
165 |
||
166 |
vframeArrayElement* element(int index) { assert(is_within_bounds(index), "Bad index"); return &_elements[index]; } |
|
167 |
||
168 |
// Allocates a new vframe in the array and fills the array with vframe information in chunk |
|
169 |
void fill_in(JavaThread* thread, int frame_size, GrowableArray<compiledVFrame*>* chunk, const RegisterMap *reg_map); |
|
170 |
||
171 |
// Returns the owner of this vframeArray |
|
172 |
JavaThread* owner_thread() const { return _owner_thread; } |
|
173 |
||
174 |
// Accessors for next |
|
175 |
vframeArray* next() const { return _next; } |
|
176 |
void set_next(vframeArray* value) { _next = value; } |
|
177 |
||
178 |
// Accessors for sp |
|
179 |
intptr_t* sp() const { return _original.sp(); } |
|
180 |
||
181 |
intptr_t* unextended_sp() const { return _original.unextended_sp(); } |
|
182 |
||
183 |
address original_pc() const { return _original.pc(); } |
|
184 |
||
185 |
frame original() const { return _original; } |
|
186 |
||
187 |
frame caller() const { return _caller; } |
|
188 |
||
189 |
frame sender() const { return _sender; } |
|
190 |
||
191 |
// Accessors for unroll block |
|
192 |
Deoptimization::UnrollBlock* unroll_block() const { return _unroll_block; } |
|
193 |
void set_unroll_block(Deoptimization::UnrollBlock* block) { _unroll_block = block; } |
|
194 |
||
195 |
// Returns the size of the frame that got deoptimized |
|
196 |
int frame_size() const { return _frame_size; } |
|
197 |
||
198 |
// Unpack the array on the stack passed in stack interval |
|
9636
363ca5579aff
7043461: VM crashes in void LinkResolver::runtime_resolve_virtual_method
never
parents:
7397
diff
changeset
|
199 |
void unpack_to_stack(frame &unpack_frame, int exec_mode, int caller_actual_parameters); |
1 | 200 |
|
201 |
// Deallocates monitor chunks allocated during deoptimization. |
|
202 |
// This should be called when the array is not used anymore. |
|
203 |
void deallocate_monitor_chunks(); |
|
204 |
||
205 |
||
206 |
||
207 |
// Accessor for register map |
|
208 |
address register_location(int i) const; |
|
209 |
||
210 |
void print_on_2(outputStream* st) PRODUCT_RETURN; |
|
211 |
void print_value_on(outputStream* st) const PRODUCT_RETURN; |
|
212 |
||
213 |
#ifndef PRODUCT |
|
214 |
// Comparing |
|
215 |
bool structural_compare(JavaThread* thread, GrowableArray<compiledVFrame*>* chunk); |
|
216 |
#endif |
|
217 |
||
218 |
}; |
|
7397 | 219 |
|
220 |
#endif // SHARE_VM_RUNTIME_VFRAMEARRAY_HPP |