Mercurial > hg > truffle
annotate src/cpu/x86/vm/interpreter_x86_32.cpp @ 1917:f42a2f0c16bb
6996563: 6984311 changes forgot to update vmStructs.cpp for new field _operands
Summary: Add missing line to vmStructs. Also fix bug with class dumper.
Reviewed-by: twisti, kvn
author | jrose |
---|---|
date | Fri, 05 Nov 2010 12:18:30 -0700 |
parents | c18cbe5936b8 |
children | f95d63e2154a |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1506
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:
1506
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1506
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:
1506
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 #include "incls/_precompiled.incl" | |
26 #include "incls/_interpreter_x86_32.cpp.incl" | |
27 | |
28 #define __ _masm-> | |
29 | |
30 // Initialize the sentinel used to distinguish an interpreter return address. | |
31 const int Interpreter::return_sentinel = 0xfeedbeed; | |
32 | |
33 //------------------------------------------------------------------------------------------------------------------------ | |
34 | |
35 address AbstractInterpreterGenerator::generate_slow_signature_handler() { | |
36 address entry = __ pc(); | |
37 // rbx,: method | |
38 // rcx: temporary | |
39 // rdi: pointer to locals | |
40 // rsp: end of copied parameters area | |
304 | 41 __ mov(rcx, rsp); |
0 | 42 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::slow_signature_handler), rbx, rdi, rcx); |
43 __ ret(0); | |
44 return entry; | |
45 } | |
46 | |
47 | |
48 // | |
49 // Various method entries (that c++ and asm interpreter agree upon) | |
50 //------------------------------------------------------------------------------------------------------------------------ | |
51 // | |
52 // | |
53 | |
54 // Empty method, generate a very fast return. | |
55 | |
56 address InterpreterGenerator::generate_empty_entry(void) { | |
57 | |
58 // rbx,: methodOop | |
59 // rcx: receiver (unused) | |
60 // rsi: previous interpreter state (C++ interpreter) must preserve | |
61 // rsi: sender sp must set sp to this value on return | |
62 | |
63 if (!UseFastEmptyMethods) return NULL; | |
64 | |
65 address entry_point = __ pc(); | |
66 | |
67 // If we need a safepoint check, generate full interpreter entry. | |
68 Label slow_path; | |
69 ExternalAddress state(SafepointSynchronize::address_of_state()); | |
70 __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()), | |
71 SafepointSynchronize::_not_synchronized); | |
72 __ jcc(Assembler::notEqual, slow_path); | |
73 | |
74 // do nothing for empty methods (do not even increment invocation counter) | |
75 // Code: _return | |
76 // _return | |
77 // return w/o popping parameters | |
304 | 78 __ pop(rax); |
79 __ mov(rsp, rsi); | |
0 | 80 __ jmp(rax); |
81 | |
82 __ bind(slow_path); | |
83 (void) generate_normal_entry(false); | |
84 return entry_point; | |
85 } | |
86 | |
87 address InterpreterGenerator::generate_math_entry(AbstractInterpreter::MethodKind kind) { | |
88 | |
89 // rbx,: methodOop | |
90 // rcx: scratrch | |
91 // rsi: sender sp | |
92 | |
93 if (!InlineIntrinsics) return NULL; // Generate a vanilla entry | |
94 | |
95 address entry_point = __ pc(); | |
96 | |
97 // These don't need a safepoint check because they aren't virtually | |
98 // callable. We won't enter these intrinsics from compiled code. | |
99 // If in the future we added an intrinsic which was virtually callable | |
100 // we'd have to worry about how to safepoint so that this code is used. | |
101 | |
102 // mathematical functions inlined by compiler | |
103 // (interpreter must provide identical implementation | |
104 // in order to avoid monotonicity bugs when switching | |
105 // from interpreter to compiler in the middle of some | |
106 // computation) | |
107 // | |
108 // stack: [ ret adr ] <-- rsp | |
109 // [ lo(arg) ] | |
110 // [ hi(arg) ] | |
111 // | |
112 | |
113 // Note: For JDK 1.2 StrictMath doesn't exist and Math.sin/cos/sqrt are | |
114 // native methods. Interpreter::method_kind(...) does a check for | |
115 // native methods first before checking for intrinsic methods and | |
116 // thus will never select this entry point. Make sure it is not | |
117 // called accidentally since the SharedRuntime entry points will | |
118 // not work for JDK 1.2. | |
119 // | |
120 // We no longer need to check for JDK 1.2 since it's EOL'ed. | |
121 // The following check existed in pre 1.6 implementation, | |
122 // if (Universe::is_jdk12x_version()) { | |
123 // __ should_not_reach_here(); | |
124 // } | |
125 // Universe::is_jdk12x_version() always returns false since | |
126 // the JDK version is not yet determined when this method is called. | |
127 // This method is called during interpreter_init() whereas | |
128 // JDK version is only determined when universe2_init() is called. | |
129 | |
130 // Note: For JDK 1.3 StrictMath exists and Math.sin/cos/sqrt are | |
131 // java methods. Interpreter::method_kind(...) will select | |
132 // this entry point for the corresponding methods in JDK 1.3. | |
133 // get argument | |
1506 | 134 __ fld_d(Address(rsp, 1*wordSize)); |
0 | 135 switch (kind) { |
136 case Interpreter::java_lang_math_sin : | |
137 __ trigfunc('s'); | |
138 break; | |
139 case Interpreter::java_lang_math_cos : | |
140 __ trigfunc('c'); | |
141 break; | |
142 case Interpreter::java_lang_math_tan : | |
143 __ trigfunc('t'); | |
144 break; | |
145 case Interpreter::java_lang_math_sqrt: | |
146 __ fsqrt(); | |
147 break; | |
148 case Interpreter::java_lang_math_abs: | |
149 __ fabs(); | |
150 break; | |
151 case Interpreter::java_lang_math_log: | |
152 __ flog(); | |
153 // Store to stack to convert 80bit precision back to 64bits | |
154 __ push_fTOS(); | |
155 __ pop_fTOS(); | |
156 break; | |
157 case Interpreter::java_lang_math_log10: | |
158 __ flog10(); | |
159 // Store to stack to convert 80bit precision back to 64bits | |
160 __ push_fTOS(); | |
161 __ pop_fTOS(); | |
162 break; | |
163 default : | |
164 ShouldNotReachHere(); | |
165 } | |
166 | |
167 // return double result in xmm0 for interpreter and compilers. | |
168 if (UseSSE >= 2) { | |
304 | 169 __ subptr(rsp, 2*wordSize); |
0 | 170 __ fstp_d(Address(rsp, 0)); |
171 __ movdbl(xmm0, Address(rsp, 0)); | |
304 | 172 __ addptr(rsp, 2*wordSize); |
0 | 173 } |
174 | |
175 // done, result in FPU ST(0) or XMM0 | |
304 | 176 __ pop(rdi); // get return address |
177 __ mov(rsp, rsi); // set sp to sender sp | |
0 | 178 __ jmp(rdi); |
179 | |
180 return entry_point; | |
181 } | |
182 | |
183 | |
184 // Abstract method entry | |
185 // Attempt to execute abstract method. Throw exception | |
186 address InterpreterGenerator::generate_abstract_entry(void) { | |
187 | |
188 // rbx,: methodOop | |
189 // rcx: receiver (unused) | |
190 // rsi: previous interpreter state (C++ interpreter) must preserve | |
191 | |
192 // rsi: sender SP | |
193 | |
194 address entry_point = __ pc(); | |
195 | |
196 // abstract method entry | |
197 | |
710 | 198 // pop return address, reset last_sp to NULL |
199 __ empty_expression_stack(); | |
200 __ restore_bcp(); // rsi must be correct for exception handler (was destroyed) | |
201 __ restore_locals(); // make sure locals pointer is correct as well (was destroyed) | |
202 | |
0 | 203 // throw exception |
204 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_AbstractMethodError)); | |
205 // the call_VM checks for exception, so we should never return here. | |
206 __ should_not_reach_here(); | |
207 | |
208 return entry_point; | |
209 } | |
210 | |
710 | 211 |
212 // Method handle invoker | |
213 // Dispatch a method of the form java.dyn.MethodHandles::invoke(...) | |
214 address InterpreterGenerator::generate_method_handle_entry(void) { | |
215 if (!EnableMethodHandles) { | |
216 return generate_abstract_entry(); | |
217 } | |
218 | |
219 address entry_point = MethodHandles::generate_method_handle_interpreter_entry(_masm); | |
220 | |
221 return entry_point; | |
222 } | |
223 | |
224 | |
0 | 225 // This method tells the deoptimizer how big an interpreted frame must be: |
226 int AbstractInterpreter::size_activation(methodOop method, | |
227 int tempcount, | |
228 int popframe_extra_args, | |
229 int moncount, | |
230 int callee_param_count, | |
231 int callee_locals, | |
232 bool is_top_frame) { | |
233 return layout_activation(method, | |
234 tempcount, | |
235 popframe_extra_args, | |
236 moncount, | |
237 callee_param_count, | |
238 callee_locals, | |
239 (frame*) NULL, | |
240 (frame*) NULL, | |
241 is_top_frame); | |
242 } | |
243 | |
244 void Deoptimization::unwind_callee_save_values(frame* f, vframeArray* vframe_array) { | |
245 | |
246 // This code is sort of the equivalent of C2IAdapter::setup_stack_frame back in | |
247 // the days we had adapter frames. When we deoptimize a situation where a | |
248 // compiled caller calls a compiled caller will have registers it expects | |
249 // to survive the call to the callee. If we deoptimize the callee the only | |
250 // way we can restore these registers is to have the oldest interpreter | |
251 // frame that we create restore these values. That is what this routine | |
252 // will accomplish. | |
253 | |
254 // At the moment we have modified c2 to not have any callee save registers | |
255 // so this problem does not exist and this routine is just a place holder. | |
256 | |
257 assert(f->is_interpreted_frame(), "must be interpreted"); | |
258 } |