author | duke |
Wed, 05 Jul 2017 20:10:48 +0200 | |
changeset 27963 | 88d7c7c376e9 |
parent 25950 | b5c40ed1d349 |
child 33089 | f4e956ed8b43 |
child 33148 | 68fa8b6c4340 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23203
diff
changeset
|
2 |
* Copyright (c) 2003, 2014, 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:
4478
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4478
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:
4478
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
14626
0cf4eccf130f
8003240: x86: move MacroAssembler into separate file
twisti
parents:
13728
diff
changeset
|
26 |
#include "asm/macroAssembler.hpp" |
7397 | 27 |
#include "interpreter/bytecodeHistogram.hpp" |
28 |
#include "interpreter/interpreter.hpp" |
|
29 |
#include "interpreter/interpreterGenerator.hpp" |
|
30 |
#include "interpreter/interpreterRuntime.hpp" |
|
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
24424
diff
changeset
|
31 |
#include "interpreter/interp_masm.hpp" |
7397 | 32 |
#include "interpreter/templateTable.hpp" |
33 |
#include "oops/arrayOop.hpp" |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
34 |
#include "oops/methodData.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
35 |
#include "oops/method.hpp" |
7397 | 36 |
#include "oops/oop.inline.hpp" |
37 |
#include "prims/jvmtiExport.hpp" |
|
38 |
#include "prims/jvmtiThreadState.hpp" |
|
39 |
#include "prims/methodHandles.hpp" |
|
40 |
#include "runtime/arguments.hpp" |
|
41 |
#include "runtime/deoptimization.hpp" |
|
42 |
#include "runtime/frame.inline.hpp" |
|
43 |
#include "runtime/sharedRuntime.hpp" |
|
44 |
#include "runtime/stubRoutines.hpp" |
|
45 |
#include "runtime/synchronizer.hpp" |
|
46 |
#include "runtime/timer.hpp" |
|
47 |
#include "runtime/vframeArray.hpp" |
|
48 |
#include "utilities/debug.hpp" |
|
49 |
#ifdef COMPILER1 |
|
50 |
#include "c1/c1_Runtime1.hpp" |
|
51 |
#endif |
|
1 | 52 |
|
53 |
#define __ _masm-> |
|
54 |
||
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23203
diff
changeset
|
55 |
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC |
1 | 56 |
|
57 |
#ifdef _WIN64 |
|
58 |
address AbstractInterpreterGenerator::generate_slow_signature_handler() { |
|
59 |
address entry = __ pc(); |
|
60 |
||
61 |
// rbx: method |
|
62 |
// r14: pointer to locals |
|
63 |
// c_rarg3: first stack arg - wordSize |
|
1066 | 64 |
__ mov(c_rarg3, rsp); |
1 | 65 |
// adjust rsp |
1066 | 66 |
__ subptr(rsp, 4 * wordSize); |
1 | 67 |
__ call_VM(noreg, |
68 |
CAST_FROM_FN_PTR(address, |
|
69 |
InterpreterRuntime::slow_signature_handler), |
|
70 |
rbx, r14, c_rarg3); |
|
71 |
||
72 |
// rax: result handler |
|
73 |
||
74 |
// Stack layout: |
|
75 |
// rsp: 3 integer or float args (if static first is unused) |
|
76 |
// 1 float/double identifiers |
|
77 |
// return address |
|
78 |
// stack args |
|
79 |
// garbage |
|
80 |
// expression stack bottom |
|
81 |
// bcp (NULL) |
|
82 |
// ... |
|
83 |
||
84 |
// Do FP first so we can use c_rarg3 as temp |
|
85 |
__ movl(c_rarg3, Address(rsp, 3 * wordSize)); // float/double identifiers |
|
86 |
||
87 |
for ( int i= 0; i < Argument::n_int_register_parameters_c-1; i++ ) { |
|
88 |
XMMRegister floatreg = as_XMMRegister(i+1); |
|
89 |
Label isfloatordouble, isdouble, next; |
|
90 |
||
91 |
__ testl(c_rarg3, 1 << (i*2)); // Float or Double? |
|
92 |
__ jcc(Assembler::notZero, isfloatordouble); |
|
93 |
||
94 |
// Do Int register here |
|
95 |
switch ( i ) { |
|
96 |
case 0: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
97 |
__ movl(rscratch1, Address(rbx, Method::access_flags_offset())); |
1 | 98 |
__ testl(rscratch1, JVM_ACC_STATIC); |
1066 | 99 |
__ cmovptr(Assembler::zero, c_rarg1, Address(rsp, 0)); |
1 | 100 |
break; |
101 |
case 1: |
|
1066 | 102 |
__ movptr(c_rarg2, Address(rsp, wordSize)); |
1 | 103 |
break; |
104 |
case 2: |
|
1066 | 105 |
__ movptr(c_rarg3, Address(rsp, 2 * wordSize)); |
1 | 106 |
break; |
107 |
default: |
|
108 |
break; |
|
109 |
} |
|
110 |
||
111 |
__ jmp (next); |
|
112 |
||
113 |
__ bind(isfloatordouble); |
|
114 |
__ testl(c_rarg3, 1 << ((i*2)+1)); // Double? |
|
115 |
__ jcc(Assembler::notZero, isdouble); |
|
116 |
||
117 |
// Do Float Here |
|
118 |
__ movflt(floatreg, Address(rsp, i * wordSize)); |
|
119 |
__ jmp(next); |
|
120 |
||
121 |
// Do Double here |
|
122 |
__ bind(isdouble); |
|
123 |
__ movdbl(floatreg, Address(rsp, i * wordSize)); |
|
124 |
||
125 |
__ bind(next); |
|
126 |
} |
|
127 |
||
128 |
||
129 |
// restore rsp |
|
1066 | 130 |
__ addptr(rsp, 4 * wordSize); |
1 | 131 |
|
132 |
__ ret(0); |
|
133 |
||
134 |
return entry; |
|
135 |
} |
|
136 |
#else |
|
137 |
address AbstractInterpreterGenerator::generate_slow_signature_handler() { |
|
138 |
address entry = __ pc(); |
|
139 |
||
140 |
// rbx: method |
|
141 |
// r14: pointer to locals |
|
142 |
// c_rarg3: first stack arg - wordSize |
|
1066 | 143 |
__ mov(c_rarg3, rsp); |
1 | 144 |
// adjust rsp |
1066 | 145 |
__ subptr(rsp, 14 * wordSize); |
1 | 146 |
__ call_VM(noreg, |
147 |
CAST_FROM_FN_PTR(address, |
|
148 |
InterpreterRuntime::slow_signature_handler), |
|
149 |
rbx, r14, c_rarg3); |
|
150 |
||
151 |
// rax: result handler |
|
152 |
||
153 |
// Stack layout: |
|
154 |
// rsp: 5 integer args (if static first is unused) |
|
155 |
// 1 float/double identifiers |
|
156 |
// 8 double args |
|
157 |
// return address |
|
158 |
// stack args |
|
159 |
// garbage |
|
160 |
// expression stack bottom |
|
161 |
// bcp (NULL) |
|
162 |
// ... |
|
163 |
||
164 |
// Do FP first so we can use c_rarg3 as temp |
|
165 |
__ movl(c_rarg3, Address(rsp, 5 * wordSize)); // float/double identifiers |
|
166 |
||
167 |
for (int i = 0; i < Argument::n_float_register_parameters_c; i++) { |
|
168 |
const XMMRegister r = as_XMMRegister(i); |
|
169 |
||
170 |
Label d, done; |
|
171 |
||
172 |
__ testl(c_rarg3, 1 << i); |
|
173 |
__ jcc(Assembler::notZero, d); |
|
174 |
__ movflt(r, Address(rsp, (6 + i) * wordSize)); |
|
175 |
__ jmp(done); |
|
176 |
__ bind(d); |
|
177 |
__ movdbl(r, Address(rsp, (6 + i) * wordSize)); |
|
178 |
__ bind(done); |
|
179 |
} |
|
180 |
||
181 |
// Now handle integrals. Only do c_rarg1 if not static. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
182 |
__ movl(c_rarg3, Address(rbx, Method::access_flags_offset())); |
1 | 183 |
__ testl(c_rarg3, JVM_ACC_STATIC); |
1066 | 184 |
__ cmovptr(Assembler::zero, c_rarg1, Address(rsp, 0)); |
1 | 185 |
|
1066 | 186 |
__ movptr(c_rarg2, Address(rsp, wordSize)); |
187 |
__ movptr(c_rarg3, Address(rsp, 2 * wordSize)); |
|
188 |
__ movptr(c_rarg4, Address(rsp, 3 * wordSize)); |
|
189 |
__ movptr(c_rarg5, Address(rsp, 4 * wordSize)); |
|
1 | 190 |
|
191 |
// restore rsp |
|
1066 | 192 |
__ addptr(rsp, 14 * wordSize); |
1 | 193 |
|
194 |
__ ret(0); |
|
195 |
||
196 |
return entry; |
|
197 |
} |
|
198 |
#endif |
|
199 |
||
200 |
||
201 |
// |
|
202 |
// Various method entries |
|
203 |
// |
|
204 |
||
1066 | 205 |
address InterpreterGenerator::generate_math_entry(AbstractInterpreter::MethodKind kind) { |
206 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
207 |
// rbx,: Method* |
1066 | 208 |
// rcx: scratrch |
209 |
// r13: sender sp |
|
1 | 210 |
|
211 |
if (!InlineIntrinsics) return NULL; // Generate a vanilla entry |
|
212 |
||
213 |
address entry_point = __ pc(); |
|
214 |
||
215 |
// These don't need a safepoint check because they aren't virtually |
|
216 |
// callable. We won't enter these intrinsics from compiled code. |
|
217 |
// If in the future we added an intrinsic which was virtually callable |
|
218 |
// we'd have to worry about how to safepoint so that this code is used. |
|
219 |
||
220 |
// mathematical functions inlined by compiler |
|
221 |
// (interpreter must provide identical implementation |
|
222 |
// in order to avoid monotonicity bugs when switching |
|
223 |
// from interpreter to compiler in the middle of some |
|
224 |
// computation) |
|
1066 | 225 |
// |
226 |
// stack: [ ret adr ] <-- rsp |
|
227 |
// [ lo(arg) ] |
|
228 |
// [ hi(arg) ] |
|
229 |
// |
|
1 | 230 |
|
231 |
// Note: For JDK 1.2 StrictMath doesn't exist and Math.sin/cos/sqrt are |
|
232 |
// native methods. Interpreter::method_kind(...) does a check for |
|
233 |
// native methods first before checking for intrinsic methods and |
|
234 |
// thus will never select this entry point. Make sure it is not |
|
235 |
// called accidentally since the SharedRuntime entry points will |
|
236 |
// not work for JDK 1.2. |
|
237 |
// |
|
238 |
// We no longer need to check for JDK 1.2 since it's EOL'ed. |
|
239 |
// The following check existed in pre 1.6 implementation, |
|
240 |
// if (Universe::is_jdk12x_version()) { |
|
241 |
// __ should_not_reach_here(); |
|
242 |
// } |
|
243 |
// Universe::is_jdk12x_version() always returns false since |
|
244 |
// the JDK version is not yet determined when this method is called. |
|
245 |
// This method is called during interpreter_init() whereas |
|
246 |
// JDK version is only determined when universe2_init() is called. |
|
247 |
||
248 |
// Note: For JDK 1.3 StrictMath exists and Math.sin/cos/sqrt are |
|
249 |
// java methods. Interpreter::method_kind(...) will select |
|
250 |
// this entry point for the corresponding methods in JDK 1.3. |
|
1066 | 251 |
// get argument |
1 | 252 |
|
1066 | 253 |
if (kind == Interpreter::java_lang_math_sqrt) { |
254 |
__ sqrtsd(xmm0, Address(rsp, wordSize)); |
|
255 |
} else { |
|
256 |
__ fld_d(Address(rsp, wordSize)); |
|
257 |
switch (kind) { |
|
258 |
case Interpreter::java_lang_math_sin : |
|
259 |
__ trigfunc('s'); |
|
260 |
break; |
|
261 |
case Interpreter::java_lang_math_cos : |
|
262 |
__ trigfunc('c'); |
|
263 |
break; |
|
264 |
case Interpreter::java_lang_math_tan : |
|
265 |
__ trigfunc('t'); |
|
266 |
break; |
|
267 |
case Interpreter::java_lang_math_abs: |
|
268 |
__ fabs(); |
|
269 |
break; |
|
270 |
case Interpreter::java_lang_math_log: |
|
271 |
__ flog(); |
|
272 |
break; |
|
273 |
case Interpreter::java_lang_math_log10: |
|
274 |
__ flog10(); |
|
275 |
break; |
|
12739
09f26b73ae66
7133857: exp() and pow() should use the x87 ISA on x86
roland
parents:
9636
diff
changeset
|
276 |
case Interpreter::java_lang_math_pow: |
09f26b73ae66
7133857: exp() and pow() should use the x87 ISA on x86
roland
parents:
9636
diff
changeset
|
277 |
__ fld_d(Address(rsp, 3*wordSize)); // second argument (one |
09f26b73ae66
7133857: exp() and pow() should use the x87 ISA on x86
roland
parents:
9636
diff
changeset
|
278 |
// empty stack slot) |
09f26b73ae66
7133857: exp() and pow() should use the x87 ISA on x86
roland
parents:
9636
diff
changeset
|
279 |
__ pow_with_fallback(0); |
09f26b73ae66
7133857: exp() and pow() should use the x87 ISA on x86
roland
parents:
9636
diff
changeset
|
280 |
break; |
09f26b73ae66
7133857: exp() and pow() should use the x87 ISA on x86
roland
parents:
9636
diff
changeset
|
281 |
case Interpreter::java_lang_math_exp: |
09f26b73ae66
7133857: exp() and pow() should use the x87 ISA on x86
roland
parents:
9636
diff
changeset
|
282 |
__ exp_with_fallback(0); |
09f26b73ae66
7133857: exp() and pow() should use the x87 ISA on x86
roland
parents:
9636
diff
changeset
|
283 |
break; |
1066 | 284 |
default : |
285 |
ShouldNotReachHere(); |
|
286 |
} |
|
287 |
||
288 |
// return double result in xmm0 for interpreter and compilers. |
|
289 |
__ subptr(rsp, 2*wordSize); |
|
290 |
// Round to 64bit precision |
|
291 |
__ fstp_d(Address(rsp, 0)); |
|
292 |
__ movdbl(xmm0, Address(rsp, 0)); |
|
293 |
__ addptr(rsp, 2*wordSize); |
|
294 |
} |
|
295 |
||
296 |
||
297 |
__ pop(rax); |
|
298 |
__ mov(rsp, r13); |
|
1 | 299 |
__ jmp(rax); |
300 |
||
301 |
return entry_point; |
|
302 |
} |
|
303 |
||
304 |
void Deoptimization::unwind_callee_save_values(frame* f, vframeArray* vframe_array) { |
|
305 |
||
306 |
// This code is sort of the equivalent of C2IAdapter::setup_stack_frame back in |
|
307 |
// the days we had adapter frames. When we deoptimize a situation where a |
|
308 |
// compiled caller calls a compiled caller will have registers it expects |
|
309 |
// to survive the call to the callee. If we deoptimize the callee the only |
|
310 |
// way we can restore these registers is to have the oldest interpreter |
|
311 |
// frame that we create restore these values. That is what this routine |
|
312 |
// will accomplish. |
|
313 |
||
314 |
// At the moment we have modified c2 to not have any callee save registers |
|
315 |
// so this problem does not exist and this routine is just a place holder. |
|
316 |
||
317 |
assert(f->is_interpreted_frame(), "must be interpreted"); |
|
318 |
} |