1 #ifdef USE_PRAGMA_IDENT_HDR
2 #pragma ident "@(#)frame_x86.inline.hpp 1.76 07/09/17 09:35:34 JVM"
3 #endif
4 /*
5 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 *
8 * This code is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 only, as
10 * published by the Free Software Foundation.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
24 * have any questions.
25 *
58 _sp = sp;
59 _unextended_sp = unextended_sp;
60 _fp = fp;
61 _pc = pc;
62 assert(pc != NULL, "no pc?");
63 _cb = CodeCache::find_blob(pc);
64 _deopt_state = not_deoptimized;
65 if (_cb != NULL && _cb->is_nmethod() && ((nmethod*)_cb)->is_deopt_pc(_pc)) {
66 _pc = (((nmethod*)_cb)->get_original_pc(this));
67 _deopt_state = is_deoptimized;
68 } else {
69 _deopt_state = not_deoptimized;
70 }
71 }
72
73 inline frame::frame(intptr_t* sp, intptr_t* fp) {
74 _sp = sp;
75 _unextended_sp = sp;
76 _fp = fp;
77 _pc = (address)(sp[-1]);
78 assert(_pc != NULL, "no pc?");
79 _cb = CodeCache::find_blob(_pc);
80 // In case of native stubs, the pc retreived here might be
81 // wrong. (the _last_native_pc will have the right value)
82 // So do not put add any asserts on the _pc here.
83
84 // QQQ The above comment is wrong and has been wrong for years. This constructor
85 // should (and MUST) not be called in that situation. In the native situation
86 // the pc should be supplied to the constructor.
87 _deopt_state = not_deoptimized;
88 if (_cb != NULL && _cb->is_nmethod() && ((nmethod*)_cb)->is_deopt_pc(_pc)) {
89 _pc = (((nmethod*)_cb)->get_original_pc(this));
90 _deopt_state = is_deoptimized;
91 } else {
92 _deopt_state = not_deoptimized;
93 }
94 }
95
96 // Accessors
97
98 inline bool frame::equal(frame other) const {
99 bool ret = sp() == other.sp()
100 && unextended_sp() == other.unextended_sp()
101 && fp() == other.fp()
102 && pc() == other.pc();
103 assert(!ret || ret && cb() == other.cb() && _deopt_state == other._deopt_state, "inconsistent construction");
104 return ret;
105 }
106
140 return ((interpreterState)addr_at( -sizeof(BytecodeInterpreter)/wordSize ));
141 }
142
143 inline intptr_t* frame::sender_sp() const {
144 // Hmm this seems awfully expensive QQQ, is this really called with interpreted frames?
145 if (is_interpreted_frame()) {
146 assert(false, "should never happen");
147 return get_interpreterState()->sender_sp();
148 } else {
149 return addr_at(sender_sp_offset);
150 }
151 }
152
153 inline intptr_t** frame::interpreter_frame_locals_addr() const {
154 assert(is_interpreted_frame(), "must be interpreted");
155 return &(get_interpreterState()->_locals);
156 }
157
158 inline intptr_t* frame::interpreter_frame_bcx_addr() const {
159 assert(is_interpreted_frame(), "must be interpreted");
160 return (jint*) &(get_interpreterState()->_bcp);
161 }
162
163
164 // Constant pool cache
165
166 inline constantPoolCacheOop* frame::interpreter_frame_cache_addr() const {
167 assert(is_interpreted_frame(), "must be interpreted");
168 return &(get_interpreterState()->_constants);
169 }
170
171 // Method
172
173 inline methodOop* frame::interpreter_frame_method_addr() const {
174 assert(is_interpreted_frame(), "must be interpreted");
175 return &(get_interpreterState()->_method);
176 }
177
178 inline intptr_t* frame::interpreter_frame_mdx_addr() const {
179 assert(is_interpreted_frame(), "must be interpreted");
180 return (jint*) &(get_interpreterState()->_mdx);
181 }
182
183 // top of expression stack
184 inline intptr_t* frame::interpreter_frame_tos_address() const {
185 assert(is_interpreted_frame(), "wrong frame type");
186 return get_interpreterState()->_stack + 1;
187 }
188
189 #else /* asm interpreter */
190 inline intptr_t* frame::sender_sp() const { return addr_at( sender_sp_offset); }
191
192 inline intptr_t** frame::interpreter_frame_locals_addr() const {
193 return (intptr_t**)addr_at(interpreter_frame_locals_offset);
194 }
195
196 inline intptr_t* frame::interpreter_frame_last_sp() const {
197 return *(intptr_t**)addr_at(interpreter_frame_last_sp_offset);
198 }
199
200 inline intptr_t* frame::interpreter_frame_bcx_addr() const {
272 return local_offset_for_compiler(local_index, nof_args, max_nof_locals, max_nof_monitors);
273 }
274
275 inline int frame::min_local_offset_for_compiler(int nof_args, int max_nof_locals, int max_nof_monitors) {
276 return (nof_args - (max_nof_locals + max_nof_monitors*2) - 1);
277 }
278
279 inline bool frame::volatile_across_calls(Register reg) {
280 return true;
281 }
282
283
284
285 inline oop frame::saved_oop_result(RegisterMap* map) const {
286 return *((oop*) map->location(rax->as_VMReg()));
287 }
288
289 inline void frame::set_saved_oop_result(RegisterMap* map, oop obj) {
290 *((oop*) map->location(rax->as_VMReg())) = obj;
291 }
292
|
1 /*
2 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
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 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
55 _sp = sp;
56 _unextended_sp = unextended_sp;
57 _fp = fp;
58 _pc = pc;
59 assert(pc != NULL, "no pc?");
60 _cb = CodeCache::find_blob(pc);
61 _deopt_state = not_deoptimized;
62 if (_cb != NULL && _cb->is_nmethod() && ((nmethod*)_cb)->is_deopt_pc(_pc)) {
63 _pc = (((nmethod*)_cb)->get_original_pc(this));
64 _deopt_state = is_deoptimized;
65 } else {
66 _deopt_state = not_deoptimized;
67 }
68 }
69
70 inline frame::frame(intptr_t* sp, intptr_t* fp) {
71 _sp = sp;
72 _unextended_sp = sp;
73 _fp = fp;
74 _pc = (address)(sp[-1]);
75
76 // Here's a sticky one. This constructor can be called via AsyncGetCallTrace
77 // when last_Java_sp is non-null but the pc fetched is junk. If we are truly
78 // unlucky the junk value could be to a zombied method and we'll die on the
79 // find_blob call. This is also why we can have no asserts on the validity
80 // of the pc we find here. AsyncGetCallTrace -> pd_get_top_frame_for_signal_handler
81 // -> pd_last_frame should use a specialized version of pd_last_frame which could
82 // call a specilaized frame constructor instead of this one.
83 // Then we could use the assert below. However this assert is of somewhat dubious
84 // value.
85 // assert(_pc != NULL, "no pc?");
86
87 _cb = CodeCache::find_blob(_pc);
88
89 _deopt_state = not_deoptimized;
90 if (_cb != NULL && _cb->is_nmethod() && ((nmethod*)_cb)->is_deopt_pc(_pc)) {
91 _pc = (((nmethod*)_cb)->get_original_pc(this));
92 _deopt_state = is_deoptimized;
93 } else {
94 _deopt_state = not_deoptimized;
95 }
96 }
97
98 // Accessors
99
100 inline bool frame::equal(frame other) const {
101 bool ret = sp() == other.sp()
102 && unextended_sp() == other.unextended_sp()
103 && fp() == other.fp()
104 && pc() == other.pc();
105 assert(!ret || ret && cb() == other.cb() && _deopt_state == other._deopt_state, "inconsistent construction");
106 return ret;
107 }
108
142 return ((interpreterState)addr_at( -sizeof(BytecodeInterpreter)/wordSize ));
143 }
144
145 inline intptr_t* frame::sender_sp() const {
146 // Hmm this seems awfully expensive QQQ, is this really called with interpreted frames?
147 if (is_interpreted_frame()) {
148 assert(false, "should never happen");
149 return get_interpreterState()->sender_sp();
150 } else {
151 return addr_at(sender_sp_offset);
152 }
153 }
154
155 inline intptr_t** frame::interpreter_frame_locals_addr() const {
156 assert(is_interpreted_frame(), "must be interpreted");
157 return &(get_interpreterState()->_locals);
158 }
159
160 inline intptr_t* frame::interpreter_frame_bcx_addr() const {
161 assert(is_interpreted_frame(), "must be interpreted");
162 return (intptr_t*) &(get_interpreterState()->_bcp);
163 }
164
165
166 // Constant pool cache
167
168 inline constantPoolCacheOop* frame::interpreter_frame_cache_addr() const {
169 assert(is_interpreted_frame(), "must be interpreted");
170 return &(get_interpreterState()->_constants);
171 }
172
173 // Method
174
175 inline methodOop* frame::interpreter_frame_method_addr() const {
176 assert(is_interpreted_frame(), "must be interpreted");
177 return &(get_interpreterState()->_method);
178 }
179
180 inline intptr_t* frame::interpreter_frame_mdx_addr() const {
181 assert(is_interpreted_frame(), "must be interpreted");
182 return (intptr_t*) &(get_interpreterState()->_mdx);
183 }
184
185 // top of expression stack
186 inline intptr_t* frame::interpreter_frame_tos_address() const {
187 assert(is_interpreted_frame(), "wrong frame type");
188 return get_interpreterState()->_stack + 1;
189 }
190
191 #else /* asm interpreter */
192 inline intptr_t* frame::sender_sp() const { return addr_at( sender_sp_offset); }
193
194 inline intptr_t** frame::interpreter_frame_locals_addr() const {
195 return (intptr_t**)addr_at(interpreter_frame_locals_offset);
196 }
197
198 inline intptr_t* frame::interpreter_frame_last_sp() const {
199 return *(intptr_t**)addr_at(interpreter_frame_last_sp_offset);
200 }
201
202 inline intptr_t* frame::interpreter_frame_bcx_addr() const {
274 return local_offset_for_compiler(local_index, nof_args, max_nof_locals, max_nof_monitors);
275 }
276
277 inline int frame::min_local_offset_for_compiler(int nof_args, int max_nof_locals, int max_nof_monitors) {
278 return (nof_args - (max_nof_locals + max_nof_monitors*2) - 1);
279 }
280
281 inline bool frame::volatile_across_calls(Register reg) {
282 return true;
283 }
284
285
286
287 inline oop frame::saved_oop_result(RegisterMap* map) const {
288 return *((oop*) map->location(rax->as_VMReg()));
289 }
290
291 inline void frame::set_saved_oop_result(RegisterMap* map, oop obj) {
292 *((oop*) map->location(rax->as_VMReg())) = obj;
293 }
|