Mercurial > hg > truffle
annotate src/share/vm/runtime/vframeArray.hpp @ 21738:28943e5044b5
Merge
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Thu, 04 Jun 2015 19:49:45 -0700 |
parents | 7848fc12602b |
children |
rev | line source |
---|---|
0 | 1 /* |
14223
de6a9e811145
8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents:
8727
diff
changeset
|
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
948
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
948
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
948
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 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 | |
0 | 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 { | |
3939 | 50 friend class VMStructs; |
51 | |
0 | 52 private: |
53 | |
54 frame _frame; // the interpreter frame we will unpack into | |
900
9987d9d5eb0e
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
0
diff
changeset
|
55 int _bci; // raw bci for this vframe |
9987d9d5eb0e
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
0
diff
changeset
|
56 bool _reexecute; // whether sould we reexecute this bytecode |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
57 Method* _method; // the method for this vframe |
0 | 58 MonitorChunk* _monitors; // active monitors for this vframe |
59 StackValueCollection* _locals; | |
60 StackValueCollection* _expressions; | |
20705
d3f3f7677537
6898462: The escape analysis with G1 cause crash assertion src/share/vm/runtime/vframeArray.cpp:94
roland
parents:
17980
diff
changeset
|
61 #ifdef ASSERT |
d3f3f7677537
6898462: The escape analysis with G1 cause crash assertion src/share/vm/runtime/vframeArray.cpp:94
roland
parents:
17980
diff
changeset
|
62 bool _removed_monitors; |
d3f3f7677537
6898462: The escape analysis with G1 cause crash assertion src/share/vm/runtime/vframeArray.cpp:94
roland
parents:
17980
diff
changeset
|
63 #endif |
0 | 64 |
65 public: | |
66 | |
67 frame* iframe(void) { return &_frame; } | |
68 | |
69 int bci(void) const; | |
70 | |
71 int raw_bci(void) const { return _bci; } | |
900
9987d9d5eb0e
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
0
diff
changeset
|
72 bool should_reexecute(void) const { return _reexecute; } |
0 | 73 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
74 Method* method(void) const { return _method; } |
0 | 75 |
76 MonitorChunk* monitors(void) const { return _monitors; } | |
77 | |
78 void free_monitors(JavaThread* jt); | |
79 | |
80 StackValueCollection* locals(void) const { return _locals; } | |
81 | |
82 StackValueCollection* expressions(void) const { return _expressions; } | |
83 | |
20705
d3f3f7677537
6898462: The escape analysis with G1 cause crash assertion src/share/vm/runtime/vframeArray.cpp:94
roland
parents:
17980
diff
changeset
|
84 void fill_in(compiledVFrame* vf, bool realloc_failures); |
0 | 85 |
86 // Formerly part of deoptimizedVFrame | |
87 | |
88 | |
89 // Returns the on stack word size for this frame | |
90 // callee_parameters is the number of callee locals residing inside this frame | |
17980
0bf37f737702
8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
14223
diff
changeset
|
91 int on_stack_size(int callee_parameters, |
0 | 92 int callee_locals, |
93 bool is_top_frame, | |
94 int popframe_extra_stack_expression_els) const; | |
95 | |
96 // Unpacks the element to skeletal interpreter frame | |
3369
3d2ab563047a
7043461: VM crashes in void LinkResolver::runtime_resolve_virtual_method
never
parents:
1972
diff
changeset
|
97 void unpack_on_stack(int caller_actual_parameters, |
3d2ab563047a
7043461: VM crashes in void LinkResolver::runtime_resolve_virtual_method
never
parents:
1972
diff
changeset
|
98 int callee_parameters, |
0 | 99 int callee_locals, |
100 frame* caller, | |
101 bool is_top_frame, | |
8727
0094485b46c7
8009761: Deoptimization on sparc doesn't set Llast_SP correctly in the interpreter frames it creates
roland
parents:
6725
diff
changeset
|
102 bool is_bottom_frame, |
0 | 103 int exec_mode); |
104 | |
20705
d3f3f7677537
6898462: The escape analysis with G1 cause crash assertion src/share/vm/runtime/vframeArray.cpp:94
roland
parents:
17980
diff
changeset
|
105 #ifdef ASSERT |
d3f3f7677537
6898462: The escape analysis with G1 cause crash assertion src/share/vm/runtime/vframeArray.cpp:94
roland
parents:
17980
diff
changeset
|
106 void set_removed_monitors() { |
d3f3f7677537
6898462: The escape analysis with G1 cause crash assertion src/share/vm/runtime/vframeArray.cpp:94
roland
parents:
17980
diff
changeset
|
107 _removed_monitors = true; |
d3f3f7677537
6898462: The escape analysis with G1 cause crash assertion src/share/vm/runtime/vframeArray.cpp:94
roland
parents:
17980
diff
changeset
|
108 } |
d3f3f7677537
6898462: The escape analysis with G1 cause crash assertion src/share/vm/runtime/vframeArray.cpp:94
roland
parents:
17980
diff
changeset
|
109 #endif |
d3f3f7677537
6898462: The escape analysis with G1 cause crash assertion src/share/vm/runtime/vframeArray.cpp:94
roland
parents:
17980
diff
changeset
|
110 |
0 | 111 #ifndef PRODUCT |
112 void print(outputStream* st); | |
113 #endif /* PRODUCT */ | |
114 }; | |
115 | |
116 // this can be a ResourceObj if we don't save the last one... | |
117 // but it does make debugging easier even if we can't look | |
118 // at the data in each vframeElement | |
119 | |
6197 | 120 class vframeArray: public CHeapObj<mtCompiler> { |
3939 | 121 friend class VMStructs; |
122 | |
0 | 123 private: |
124 | |
125 | |
126 // Here is what a vframeArray looks like in memory | |
127 | |
128 /* | |
129 fixed part | |
130 description of the original frame | |
131 _frames - number of vframes in this array | |
132 adapter info | |
133 callee register save area | |
134 variable part | |
135 vframeArrayElement [ 0 ] | |
136 ... | |
137 vframeArrayElement [_frames - 1] | |
138 | |
139 */ | |
140 | |
141 JavaThread* _owner_thread; | |
142 vframeArray* _next; | |
143 frame _original; // the original frame of the deoptee | |
144 frame _caller; // caller of root frame in vframeArray | |
145 frame _sender; | |
146 | |
147 Deoptimization::UnrollBlock* _unroll_block; | |
148 int _frame_size; | |
149 | |
150 int _frames; // number of javavframes in the array (does not count any adapter) | |
151 | |
152 intptr_t _callee_registers[RegisterMap::reg_count]; | |
153 unsigned char _valid[RegisterMap::reg_count]; | |
154 | |
155 vframeArrayElement _elements[1]; // First variable section. | |
156 | |
157 void fill_in_element(int index, compiledVFrame* vf); | |
158 | |
159 bool is_location_valid(int i) const { return _valid[i] != 0; } | |
160 void set_location_valid(int i, bool valid) { _valid[i] = valid; } | |
161 | |
162 public: | |
163 | |
164 | |
165 // Tells whether index is within bounds. | |
166 bool is_within_bounds(int index) const { return 0 <= index && index < frames(); } | |
167 | |
168 // Accessores for instance variable | |
169 int frames() const { return _frames; } | |
170 | |
171 static vframeArray* allocate(JavaThread* thread, int frame_size, GrowableArray<compiledVFrame*>* chunk, | |
20705
d3f3f7677537
6898462: The escape analysis with G1 cause crash assertion src/share/vm/runtime/vframeArray.cpp:94
roland
parents:
17980
diff
changeset
|
172 RegisterMap* reg_map, frame sender, frame caller, frame self, |
d3f3f7677537
6898462: The escape analysis with G1 cause crash assertion src/share/vm/runtime/vframeArray.cpp:94
roland
parents:
17980
diff
changeset
|
173 bool realloc_failures); |
0 | 174 |
175 | |
176 vframeArrayElement* element(int index) { assert(is_within_bounds(index), "Bad index"); return &_elements[index]; } | |
177 | |
178 // Allocates a new vframe in the array and fills the array with vframe information in chunk | |
20705
d3f3f7677537
6898462: The escape analysis with G1 cause crash assertion src/share/vm/runtime/vframeArray.cpp:94
roland
parents:
17980
diff
changeset
|
179 void fill_in(JavaThread* thread, int frame_size, GrowableArray<compiledVFrame*>* chunk, const RegisterMap *reg_map, bool realloc_failures); |
0 | 180 |
181 // Returns the owner of this vframeArray | |
182 JavaThread* owner_thread() const { return _owner_thread; } | |
183 | |
184 // Accessors for next | |
185 vframeArray* next() const { return _next; } | |
186 void set_next(vframeArray* value) { _next = value; } | |
187 | |
188 // Accessors for sp | |
189 intptr_t* sp() const { return _original.sp(); } | |
190 | |
191 intptr_t* unextended_sp() const { return _original.unextended_sp(); } | |
192 | |
193 address original_pc() const { return _original.pc(); } | |
194 | |
195 frame original() const { return _original; } | |
196 | |
197 frame caller() const { return _caller; } | |
198 | |
199 frame sender() const { return _sender; } | |
200 | |
201 // Accessors for unroll block | |
202 Deoptimization::UnrollBlock* unroll_block() const { return _unroll_block; } | |
203 void set_unroll_block(Deoptimization::UnrollBlock* block) { _unroll_block = block; } | |
204 | |
205 // Returns the size of the frame that got deoptimized | |
206 int frame_size() const { return _frame_size; } | |
207 | |
208 // Unpack the array on the stack passed in stack interval | |
3369
3d2ab563047a
7043461: VM crashes in void LinkResolver::runtime_resolve_virtual_method
never
parents:
1972
diff
changeset
|
209 void unpack_to_stack(frame &unpack_frame, int exec_mode, int caller_actual_parameters); |
0 | 210 |
211 // Deallocates monitor chunks allocated during deoptimization. | |
212 // This should be called when the array is not used anymore. | |
213 void deallocate_monitor_chunks(); | |
214 | |
215 | |
216 | |
217 // Accessor for register map | |
218 address register_location(int i) const; | |
219 | |
220 void print_on_2(outputStream* st) PRODUCT_RETURN; | |
221 void print_value_on(outputStream* st) const PRODUCT_RETURN; | |
222 | |
223 #ifndef PRODUCT | |
224 // Comparing | |
225 bool structural_compare(JavaThread* thread, GrowableArray<compiledVFrame*>* chunk); | |
226 #endif | |
227 | |
228 }; | |
1972 | 229 |
230 #endif // SHARE_VM_RUNTIME_VFRAMEARRAY_HPP |