Mercurial > hg > truffle
annotate src/cpu/x86/vm/frame_x86.inline.hpp @ 4582:b24386206122
Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Made HotSpot build jobs use the number of CPUs on the host machine.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 13 Feb 2012 23:13:37 +0100 |
parents | 07c2e7ffd1fc |
children | 3dbcd1013cc8 da91efe96a93 |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1255
diff
changeset
|
2 * Copyright (c) 1997, 2010, 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:
1255
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1255
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:
1255
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef CPU_X86_VM_FRAME_X86_INLINE_HPP |
26 #define CPU_X86_VM_FRAME_X86_INLINE_HPP | |
27 | |
0 | 28 // Inline functions for Intel frames: |
29 | |
30 // Constructors: | |
31 | |
32 inline frame::frame() { | |
33 _pc = NULL; | |
34 _sp = NULL; | |
35 _unextended_sp = NULL; | |
36 _fp = NULL; | |
37 _cb = NULL; | |
38 _deopt_state = unknown; | |
39 } | |
40 | |
1204 | 41 inline frame::frame(intptr_t* sp, intptr_t* fp, address pc) { |
0 | 42 _sp = sp; |
43 _unextended_sp = sp; | |
44 _fp = fp; | |
45 _pc = pc; | |
46 assert(pc != NULL, "no pc?"); | |
47 _cb = CodeCache::find_blob(pc); | |
3446
07c2e7ffd1fc
7047697: MethodHandle.invokeExact call for wrong method causes VM failure if run with -Xcomp
jrose
parents:
3363
diff
changeset
|
48 adjust_unextended_sp(); |
1204 | 49 |
50 address original_pc = nmethod::get_deopt_original_pc(this); | |
51 if (original_pc != NULL) { | |
52 _pc = original_pc; | |
0 | 53 _deopt_state = is_deoptimized; |
54 } else { | |
55 _deopt_state = not_deoptimized; | |
56 } | |
57 } | |
58 | |
1204 | 59 inline frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc) { |
0 | 60 _sp = sp; |
61 _unextended_sp = unextended_sp; | |
62 _fp = fp; | |
63 _pc = pc; | |
64 assert(pc != NULL, "no pc?"); | |
65 _cb = CodeCache::find_blob(pc); | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
1972
diff
changeset
|
66 adjust_unextended_sp(); |
1204 | 67 |
68 address original_pc = nmethod::get_deopt_original_pc(this); | |
69 if (original_pc != NULL) { | |
70 _pc = original_pc; | |
1748 | 71 assert(((nmethod*)_cb)->insts_contains(_pc), "original PC must be in nmethod"); |
0 | 72 _deopt_state = is_deoptimized; |
73 } else { | |
74 _deopt_state = not_deoptimized; | |
75 } | |
76 } | |
77 | |
78 inline frame::frame(intptr_t* sp, intptr_t* fp) { | |
79 _sp = sp; | |
80 _unextended_sp = sp; | |
81 _fp = fp; | |
82 _pc = (address)(sp[-1]); | |
107
93b6525e3b82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
0
diff
changeset
|
83 |
93b6525e3b82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
0
diff
changeset
|
84 // Here's a sticky one. This constructor can be called via AsyncGetCallTrace |
93b6525e3b82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
0
diff
changeset
|
85 // when last_Java_sp is non-null but the pc fetched is junk. If we are truly |
93b6525e3b82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
0
diff
changeset
|
86 // unlucky the junk value could be to a zombied method and we'll die on the |
93b6525e3b82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
0
diff
changeset
|
87 // find_blob call. This is also why we can have no asserts on the validity |
93b6525e3b82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
0
diff
changeset
|
88 // of the pc we find here. AsyncGetCallTrace -> pd_get_top_frame_for_signal_handler |
93b6525e3b82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
0
diff
changeset
|
89 // -> pd_last_frame should use a specialized version of pd_last_frame which could |
93b6525e3b82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
0
diff
changeset
|
90 // call a specilaized frame constructor instead of this one. |
93b6525e3b82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
0
diff
changeset
|
91 // Then we could use the assert below. However this assert is of somewhat dubious |
93b6525e3b82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
0
diff
changeset
|
92 // value. |
93b6525e3b82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
0
diff
changeset
|
93 // assert(_pc != NULL, "no pc?"); |
93b6525e3b82
6603919: Stackwalking crash on x86 -server with Sun Studio's collect -j on
sgoldman
parents:
0
diff
changeset
|
94 |
0 | 95 _cb = CodeCache::find_blob(_pc); |
3446
07c2e7ffd1fc
7047697: MethodHandle.invokeExact call for wrong method causes VM failure if run with -Xcomp
jrose
parents:
3363
diff
changeset
|
96 adjust_unextended_sp(); |
0 | 97 |
1204 | 98 address original_pc = nmethod::get_deopt_original_pc(this); |
99 if (original_pc != NULL) { | |
100 _pc = original_pc; | |
0 | 101 _deopt_state = is_deoptimized; |
102 } else { | |
103 _deopt_state = not_deoptimized; | |
104 } | |
105 } | |
106 | |
107 // Accessors | |
108 | |
109 inline bool frame::equal(frame other) const { | |
110 bool ret = sp() == other.sp() | |
111 && unextended_sp() == other.unextended_sp() | |
112 && fp() == other.fp() | |
113 && pc() == other.pc(); | |
114 assert(!ret || ret && cb() == other.cb() && _deopt_state == other._deopt_state, "inconsistent construction"); | |
115 return ret; | |
116 } | |
117 | |
118 // Return unique id for this frame. The id must have a value where we can distinguish | |
119 // identity and younger/older relationship. NULL represents an invalid (incomparable) | |
120 // frame. | |
121 inline intptr_t* frame::id(void) const { return unextended_sp(); } | |
122 | |
123 // Relationals on frames based | |
124 // Return true if the frame is younger (more recent activation) than the frame represented by id | |
125 inline bool frame::is_younger(intptr_t* id) const { assert(this->id() != NULL && id != NULL, "NULL frame id"); | |
126 return this->id() < id ; } | |
127 | |
128 // Return true if the frame is older (less recent activation) than the frame represented by id | |
129 inline bool frame::is_older(intptr_t* id) const { assert(this->id() != NULL && id != NULL, "NULL frame id"); | |
130 return this->id() > id ; } | |
131 | |
132 | |
133 | |
134 inline intptr_t* frame::link() const { return (intptr_t*) *(intptr_t **)addr_at(link_offset); } | |
135 inline void frame::set_link(intptr_t* addr) { *(intptr_t **)addr_at(link_offset) = addr; } | |
136 | |
137 | |
138 inline intptr_t* frame::unextended_sp() const { return _unextended_sp; } | |
139 | |
140 // Return address: | |
141 | |
142 inline address* frame::sender_pc_addr() const { return (address*) addr_at( return_addr_offset); } | |
143 inline address frame::sender_pc() const { return *sender_pc_addr(); } | |
144 | |
145 // return address of param, zero origin index. | |
146 inline address* frame::native_param_addr(int idx) const { return (address*) addr_at( native_frame_initial_param_offset+idx); } | |
147 | |
148 #ifdef CC_INTERP | |
149 | |
150 inline interpreterState frame::get_interpreterState() const { | |
520
52a431267315
6791168: Fix invalid code in bytecodeInterpreter that can cause gcc ICE
coleenp
parents:
304
diff
changeset
|
151 return ((interpreterState)addr_at( -((int)sizeof(BytecodeInterpreter))/wordSize )); |
0 | 152 } |
153 | |
154 inline intptr_t* frame::sender_sp() const { | |
155 // Hmm this seems awfully expensive QQQ, is this really called with interpreted frames? | |
156 if (is_interpreted_frame()) { | |
157 assert(false, "should never happen"); | |
158 return get_interpreterState()->sender_sp(); | |
159 } else { | |
160 return addr_at(sender_sp_offset); | |
161 } | |
162 } | |
163 | |
164 inline intptr_t** frame::interpreter_frame_locals_addr() const { | |
165 assert(is_interpreted_frame(), "must be interpreted"); | |
166 return &(get_interpreterState()->_locals); | |
167 } | |
168 | |
169 inline intptr_t* frame::interpreter_frame_bcx_addr() const { | |
170 assert(is_interpreted_frame(), "must be interpreted"); | |
304 | 171 return (intptr_t*) &(get_interpreterState()->_bcp); |
0 | 172 } |
173 | |
174 | |
175 // Constant pool cache | |
176 | |
177 inline constantPoolCacheOop* frame::interpreter_frame_cache_addr() const { | |
178 assert(is_interpreted_frame(), "must be interpreted"); | |
179 return &(get_interpreterState()->_constants); | |
180 } | |
181 | |
182 // Method | |
183 | |
184 inline methodOop* frame::interpreter_frame_method_addr() const { | |
185 assert(is_interpreted_frame(), "must be interpreted"); | |
186 return &(get_interpreterState()->_method); | |
187 } | |
188 | |
189 inline intptr_t* frame::interpreter_frame_mdx_addr() const { | |
190 assert(is_interpreted_frame(), "must be interpreted"); | |
304 | 191 return (intptr_t*) &(get_interpreterState()->_mdx); |
0 | 192 } |
193 | |
194 // top of expression stack | |
195 inline intptr_t* frame::interpreter_frame_tos_address() const { | |
196 assert(is_interpreted_frame(), "wrong frame type"); | |
197 return get_interpreterState()->_stack + 1; | |
198 } | |
199 | |
200 #else /* asm interpreter */ | |
201 inline intptr_t* frame::sender_sp() const { return addr_at( sender_sp_offset); } | |
202 | |
203 inline intptr_t** frame::interpreter_frame_locals_addr() const { | |
204 return (intptr_t**)addr_at(interpreter_frame_locals_offset); | |
205 } | |
206 | |
207 inline intptr_t* frame::interpreter_frame_last_sp() const { | |
208 return *(intptr_t**)addr_at(interpreter_frame_last_sp_offset); | |
209 } | |
210 | |
211 inline intptr_t* frame::interpreter_frame_bcx_addr() const { | |
212 return (intptr_t*)addr_at(interpreter_frame_bcx_offset); | |
213 } | |
214 | |
215 | |
216 inline intptr_t* frame::interpreter_frame_mdx_addr() const { | |
217 return (intptr_t*)addr_at(interpreter_frame_mdx_offset); | |
218 } | |
219 | |
220 | |
221 | |
222 // Constant pool cache | |
223 | |
224 inline constantPoolCacheOop* frame::interpreter_frame_cache_addr() const { | |
225 return (constantPoolCacheOop*)addr_at(interpreter_frame_cache_offset); | |
226 } | |
227 | |
228 // Method | |
229 | |
230 inline methodOop* frame::interpreter_frame_method_addr() const { | |
231 return (methodOop*)addr_at(interpreter_frame_method_offset); | |
232 } | |
233 | |
234 // top of expression stack | |
235 inline intptr_t* frame::interpreter_frame_tos_address() const { | |
236 intptr_t* last_sp = interpreter_frame_last_sp(); | |
1137
97125851f396
6829187: compiler optimizations required for JSR 292
twisti
parents:
579
diff
changeset
|
237 if (last_sp == NULL) { |
0 | 238 return sp(); |
239 } else { | |
1137
97125851f396
6829187: compiler optimizations required for JSR 292
twisti
parents:
579
diff
changeset
|
240 // sp() may have been extended or shrunk by an adapter. At least |
97125851f396
6829187: compiler optimizations required for JSR 292
twisti
parents:
579
diff
changeset
|
241 // check that we don't fall behind the legal region. |
1255
e3a4305c6bc3
6925249: assert(last_sp < (intptr_t*) interpreter_frame_monitor_begin(),"bad tos")
kvn
parents:
1204
diff
changeset
|
242 // For top deoptimized frame last_sp == interpreter_frame_monitor_end. |
e3a4305c6bc3
6925249: assert(last_sp < (intptr_t*) interpreter_frame_monitor_begin(),"bad tos")
kvn
parents:
1204
diff
changeset
|
243 assert(last_sp <= (intptr_t*) interpreter_frame_monitor_end(), "bad tos"); |
0 | 244 return last_sp; |
245 } | |
246 } | |
247 | |
248 #endif /* CC_INTERP */ | |
249 | |
250 inline int frame::pd_oop_map_offset_adjustment() const { | |
251 return 0; | |
252 } | |
253 | |
254 inline int frame::interpreter_frame_monitor_size() { | |
255 return BasicObjectLock::size(); | |
256 } | |
257 | |
258 | |
259 // expression stack | |
260 // (the max_stack arguments are used by the GC; see class FrameClosure) | |
261 | |
262 inline intptr_t* frame::interpreter_frame_expression_stack() const { | |
263 intptr_t* monitor_end = (intptr_t*) interpreter_frame_monitor_end(); | |
264 return monitor_end-1; | |
265 } | |
266 | |
267 | |
268 inline jint frame::interpreter_frame_expression_stack_direction() { return -1; } | |
269 | |
270 | |
271 // Entry frames | |
272 | |
273 inline JavaCallWrapper* frame::entry_frame_call_wrapper() const { | |
274 return (JavaCallWrapper*)at(entry_frame_call_wrapper_offset); | |
275 } | |
276 | |
277 | |
278 // Compiled frames | |
279 | |
280 inline int frame::local_offset_for_compiler(int local_index, int nof_args, int max_nof_locals, int max_nof_monitors) { | |
281 return (nof_args - local_index + (local_index < nof_args ? 1: -1)); | |
282 } | |
283 | |
284 inline int frame::monitor_offset_for_compiler(int local_index, int nof_args, int max_nof_locals, int max_nof_monitors) { | |
285 return local_offset_for_compiler(local_index, nof_args, max_nof_locals, max_nof_monitors); | |
286 } | |
287 | |
288 inline int frame::min_local_offset_for_compiler(int nof_args, int max_nof_locals, int max_nof_monitors) { | |
289 return (nof_args - (max_nof_locals + max_nof_monitors*2) - 1); | |
290 } | |
291 | |
292 inline bool frame::volatile_across_calls(Register reg) { | |
293 return true; | |
294 } | |
295 | |
296 | |
297 | |
298 inline oop frame::saved_oop_result(RegisterMap* map) const { | |
299 return *((oop*) map->location(rax->as_VMReg())); | |
300 } | |
301 | |
302 inline void frame::set_saved_oop_result(RegisterMap* map, oop obj) { | |
303 *((oop*) map->location(rax->as_VMReg())) = obj; | |
304 } | |
1972 | 305 |
306 #endif // CPU_X86_VM_FRAME_X86_INLINE_HPP |