annotate src/cpu/x86/vm/interpreter_x86_64.cpp @ 14676:d3f14809b051

8036146: make CPP interpreter build again Summary: fix build of CPP interpreter on x86 and sparc Reviewed-by: kvn
author roland
date Wed, 05 Mar 2014 15:14:25 +0100
parents cd3d6a6b95d9
children 92aa6797d639
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1108
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1108
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: 1108
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #include "precompiled.hpp"
7199
cd3d6a6b95d9 8003240: x86: move MacroAssembler into separate file
twisti
parents: 6725
diff changeset
26 #include "asm/macroAssembler.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27 #include "interpreter/bytecodeHistogram.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "interpreter/interpreter.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "interpreter/interpreterGenerator.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "interpreter/interpreterRuntime.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 #include "interpreter/templateTable.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32 #include "oops/arrayOop.hpp"
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
33 #include "oops/methodData.hpp"
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
34 #include "oops/method.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
35 #include "oops/oop.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
36 #include "prims/jvmtiExport.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
37 #include "prims/jvmtiThreadState.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
38 #include "prims/methodHandles.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
39 #include "runtime/arguments.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
40 #include "runtime/deoptimization.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
41 #include "runtime/frame.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
42 #include "runtime/sharedRuntime.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
43 #include "runtime/stubRoutines.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
44 #include "runtime/synchronizer.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
45 #include "runtime/timer.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
46 #include "runtime/vframeArray.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
47 #include "utilities/debug.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
48 #ifdef COMPILER1
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
49 #include "c1/c1_Runtime1.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
50 #endif
0
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 #define __ _masm->
a61af66fc99e Initial load
duke
parents:
diff changeset
53
a61af66fc99e Initial load
duke
parents:
diff changeset
54
a61af66fc99e Initial load
duke
parents:
diff changeset
55 #ifdef _WIN64
a61af66fc99e Initial load
duke
parents:
diff changeset
56 address AbstractInterpreterGenerator::generate_slow_signature_handler() {
a61af66fc99e Initial load
duke
parents:
diff changeset
57 address entry = __ pc();
a61af66fc99e Initial load
duke
parents:
diff changeset
58
a61af66fc99e Initial load
duke
parents:
diff changeset
59 // rbx: method
a61af66fc99e Initial load
duke
parents:
diff changeset
60 // r14: pointer to locals
a61af66fc99e Initial load
duke
parents:
diff changeset
61 // c_rarg3: first stack arg - wordSize
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
62 __ mov(c_rarg3, rsp);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
63 // adjust rsp
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
64 __ subptr(rsp, 4 * wordSize);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
65 __ call_VM(noreg,
a61af66fc99e Initial load
duke
parents:
diff changeset
66 CAST_FROM_FN_PTR(address,
a61af66fc99e Initial load
duke
parents:
diff changeset
67 InterpreterRuntime::slow_signature_handler),
a61af66fc99e Initial load
duke
parents:
diff changeset
68 rbx, r14, c_rarg3);
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // rax: result handler
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 // Stack layout:
a61af66fc99e Initial load
duke
parents:
diff changeset
73 // rsp: 3 integer or float args (if static first is unused)
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // 1 float/double identifiers
a61af66fc99e Initial load
duke
parents:
diff changeset
75 // return address
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // stack args
a61af66fc99e Initial load
duke
parents:
diff changeset
77 // garbage
a61af66fc99e Initial load
duke
parents:
diff changeset
78 // expression stack bottom
a61af66fc99e Initial load
duke
parents:
diff changeset
79 // bcp (NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
80 // ...
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 // Do FP first so we can use c_rarg3 as temp
a61af66fc99e Initial load
duke
parents:
diff changeset
83 __ movl(c_rarg3, Address(rsp, 3 * wordSize)); // float/double identifiers
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 for ( int i= 0; i < Argument::n_int_register_parameters_c-1; i++ ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
86 XMMRegister floatreg = as_XMMRegister(i+1);
a61af66fc99e Initial load
duke
parents:
diff changeset
87 Label isfloatordouble, isdouble, next;
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 __ testl(c_rarg3, 1 << (i*2)); // Float or Double?
a61af66fc99e Initial load
duke
parents:
diff changeset
90 __ jcc(Assembler::notZero, isfloatordouble);
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 // Do Int register here
a61af66fc99e Initial load
duke
parents:
diff changeset
93 switch ( i ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
94 case 0:
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
95 __ movl(rscratch1, Address(rbx, Method::access_flags_offset()));
0
a61af66fc99e Initial load
duke
parents:
diff changeset
96 __ testl(rscratch1, JVM_ACC_STATIC);
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
97 __ cmovptr(Assembler::zero, c_rarg1, Address(rsp, 0));
0
a61af66fc99e Initial load
duke
parents:
diff changeset
98 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
99 case 1:
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
100 __ movptr(c_rarg2, Address(rsp, wordSize));
0
a61af66fc99e Initial load
duke
parents:
diff changeset
101 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
102 case 2:
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
103 __ movptr(c_rarg3, Address(rsp, 2 * wordSize));
0
a61af66fc99e Initial load
duke
parents:
diff changeset
104 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
105 default:
a61af66fc99e Initial load
duke
parents:
diff changeset
106 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
107 }
a61af66fc99e Initial load
duke
parents:
diff changeset
108
a61af66fc99e Initial load
duke
parents:
diff changeset
109 __ jmp (next);
a61af66fc99e Initial load
duke
parents:
diff changeset
110
a61af66fc99e Initial load
duke
parents:
diff changeset
111 __ bind(isfloatordouble);
a61af66fc99e Initial load
duke
parents:
diff changeset
112 __ testl(c_rarg3, 1 << ((i*2)+1)); // Double?
a61af66fc99e Initial load
duke
parents:
diff changeset
113 __ jcc(Assembler::notZero, isdouble);
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 // Do Float Here
a61af66fc99e Initial load
duke
parents:
diff changeset
116 __ movflt(floatreg, Address(rsp, i * wordSize));
a61af66fc99e Initial load
duke
parents:
diff changeset
117 __ jmp(next);
a61af66fc99e Initial load
duke
parents:
diff changeset
118
a61af66fc99e Initial load
duke
parents:
diff changeset
119 // Do Double here
a61af66fc99e Initial load
duke
parents:
diff changeset
120 __ bind(isdouble);
a61af66fc99e Initial load
duke
parents:
diff changeset
121 __ movdbl(floatreg, Address(rsp, i * wordSize));
a61af66fc99e Initial load
duke
parents:
diff changeset
122
a61af66fc99e Initial load
duke
parents:
diff changeset
123 __ bind(next);
a61af66fc99e Initial load
duke
parents:
diff changeset
124 }
a61af66fc99e Initial load
duke
parents:
diff changeset
125
a61af66fc99e Initial load
duke
parents:
diff changeset
126
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // restore rsp
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
128 __ addptr(rsp, 4 * wordSize);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
129
a61af66fc99e Initial load
duke
parents:
diff changeset
130 __ ret(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
131
a61af66fc99e Initial load
duke
parents:
diff changeset
132 return entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
133 }
a61af66fc99e Initial load
duke
parents:
diff changeset
134 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
135 address AbstractInterpreterGenerator::generate_slow_signature_handler() {
a61af66fc99e Initial load
duke
parents:
diff changeset
136 address entry = __ pc();
a61af66fc99e Initial load
duke
parents:
diff changeset
137
a61af66fc99e Initial load
duke
parents:
diff changeset
138 // rbx: method
a61af66fc99e Initial load
duke
parents:
diff changeset
139 // r14: pointer to locals
a61af66fc99e Initial load
duke
parents:
diff changeset
140 // c_rarg3: first stack arg - wordSize
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
141 __ mov(c_rarg3, rsp);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
142 // adjust rsp
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
143 __ subptr(rsp, 14 * wordSize);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
144 __ call_VM(noreg,
a61af66fc99e Initial load
duke
parents:
diff changeset
145 CAST_FROM_FN_PTR(address,
a61af66fc99e Initial load
duke
parents:
diff changeset
146 InterpreterRuntime::slow_signature_handler),
a61af66fc99e Initial load
duke
parents:
diff changeset
147 rbx, r14, c_rarg3);
a61af66fc99e Initial load
duke
parents:
diff changeset
148
a61af66fc99e Initial load
duke
parents:
diff changeset
149 // rax: result handler
a61af66fc99e Initial load
duke
parents:
diff changeset
150
a61af66fc99e Initial load
duke
parents:
diff changeset
151 // Stack layout:
a61af66fc99e Initial load
duke
parents:
diff changeset
152 // rsp: 5 integer args (if static first is unused)
a61af66fc99e Initial load
duke
parents:
diff changeset
153 // 1 float/double identifiers
a61af66fc99e Initial load
duke
parents:
diff changeset
154 // 8 double args
a61af66fc99e Initial load
duke
parents:
diff changeset
155 // return address
a61af66fc99e Initial load
duke
parents:
diff changeset
156 // stack args
a61af66fc99e Initial load
duke
parents:
diff changeset
157 // garbage
a61af66fc99e Initial load
duke
parents:
diff changeset
158 // expression stack bottom
a61af66fc99e Initial load
duke
parents:
diff changeset
159 // bcp (NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
160 // ...
a61af66fc99e Initial load
duke
parents:
diff changeset
161
a61af66fc99e Initial load
duke
parents:
diff changeset
162 // Do FP first so we can use c_rarg3 as temp
a61af66fc99e Initial load
duke
parents:
diff changeset
163 __ movl(c_rarg3, Address(rsp, 5 * wordSize)); // float/double identifiers
a61af66fc99e Initial load
duke
parents:
diff changeset
164
a61af66fc99e Initial load
duke
parents:
diff changeset
165 for (int i = 0; i < Argument::n_float_register_parameters_c; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
166 const XMMRegister r = as_XMMRegister(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
167
a61af66fc99e Initial load
duke
parents:
diff changeset
168 Label d, done;
a61af66fc99e Initial load
duke
parents:
diff changeset
169
a61af66fc99e Initial load
duke
parents:
diff changeset
170 __ testl(c_rarg3, 1 << i);
a61af66fc99e Initial load
duke
parents:
diff changeset
171 __ jcc(Assembler::notZero, d);
a61af66fc99e Initial load
duke
parents:
diff changeset
172 __ movflt(r, Address(rsp, (6 + i) * wordSize));
a61af66fc99e Initial load
duke
parents:
diff changeset
173 __ jmp(done);
a61af66fc99e Initial load
duke
parents:
diff changeset
174 __ bind(d);
a61af66fc99e Initial load
duke
parents:
diff changeset
175 __ movdbl(r, Address(rsp, (6 + i) * wordSize));
a61af66fc99e Initial load
duke
parents:
diff changeset
176 __ bind(done);
a61af66fc99e Initial load
duke
parents:
diff changeset
177 }
a61af66fc99e Initial load
duke
parents:
diff changeset
178
a61af66fc99e Initial load
duke
parents:
diff changeset
179 // Now handle integrals. Only do c_rarg1 if not static.
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
180 __ movl(c_rarg3, Address(rbx, Method::access_flags_offset()));
0
a61af66fc99e Initial load
duke
parents:
diff changeset
181 __ testl(c_rarg3, JVM_ACC_STATIC);
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
182 __ cmovptr(Assembler::zero, c_rarg1, Address(rsp, 0));
0
a61af66fc99e Initial load
duke
parents:
diff changeset
183
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
184 __ movptr(c_rarg2, Address(rsp, wordSize));
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
185 __ movptr(c_rarg3, Address(rsp, 2 * wordSize));
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
186 __ movptr(c_rarg4, Address(rsp, 3 * wordSize));
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
187 __ movptr(c_rarg5, Address(rsp, 4 * wordSize));
0
a61af66fc99e Initial load
duke
parents:
diff changeset
188
a61af66fc99e Initial load
duke
parents:
diff changeset
189 // restore rsp
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
190 __ addptr(rsp, 14 * wordSize);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
191
a61af66fc99e Initial load
duke
parents:
diff changeset
192 __ ret(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
193
a61af66fc99e Initial load
duke
parents:
diff changeset
194 return entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
195 }
a61af66fc99e Initial load
duke
parents:
diff changeset
196 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
197
a61af66fc99e Initial load
duke
parents:
diff changeset
198
a61af66fc99e Initial load
duke
parents:
diff changeset
199 //
a61af66fc99e Initial load
duke
parents:
diff changeset
200 // Various method entries
a61af66fc99e Initial load
duke
parents:
diff changeset
201 //
a61af66fc99e Initial load
duke
parents:
diff changeset
202
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
203 address InterpreterGenerator::generate_math_entry(AbstractInterpreter::MethodKind kind) {
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
204
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
205 // rbx,: Method*
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
206 // rcx: scratrch
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
207 // r13: sender sp
0
a61af66fc99e Initial load
duke
parents:
diff changeset
208
a61af66fc99e Initial load
duke
parents:
diff changeset
209 if (!InlineIntrinsics) return NULL; // Generate a vanilla entry
a61af66fc99e Initial load
duke
parents:
diff changeset
210
a61af66fc99e Initial load
duke
parents:
diff changeset
211 address entry_point = __ pc();
a61af66fc99e Initial load
duke
parents:
diff changeset
212
a61af66fc99e Initial load
duke
parents:
diff changeset
213 // These don't need a safepoint check because they aren't virtually
a61af66fc99e Initial load
duke
parents:
diff changeset
214 // callable. We won't enter these intrinsics from compiled code.
a61af66fc99e Initial load
duke
parents:
diff changeset
215 // If in the future we added an intrinsic which was virtually callable
a61af66fc99e Initial load
duke
parents:
diff changeset
216 // we'd have to worry about how to safepoint so that this code is used.
a61af66fc99e Initial load
duke
parents:
diff changeset
217
a61af66fc99e Initial load
duke
parents:
diff changeset
218 // mathematical functions inlined by compiler
a61af66fc99e Initial load
duke
parents:
diff changeset
219 // (interpreter must provide identical implementation
a61af66fc99e Initial load
duke
parents:
diff changeset
220 // in order to avoid monotonicity bugs when switching
a61af66fc99e Initial load
duke
parents:
diff changeset
221 // from interpreter to compiler in the middle of some
a61af66fc99e Initial load
duke
parents:
diff changeset
222 // computation)
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
223 //
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
224 // stack: [ ret adr ] <-- rsp
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
225 // [ lo(arg) ]
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
226 // [ hi(arg) ]
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
227 //
0
a61af66fc99e Initial load
duke
parents:
diff changeset
228
a61af66fc99e Initial load
duke
parents:
diff changeset
229 // Note: For JDK 1.2 StrictMath doesn't exist and Math.sin/cos/sqrt are
a61af66fc99e Initial load
duke
parents:
diff changeset
230 // native methods. Interpreter::method_kind(...) does a check for
a61af66fc99e Initial load
duke
parents:
diff changeset
231 // native methods first before checking for intrinsic methods and
a61af66fc99e Initial load
duke
parents:
diff changeset
232 // thus will never select this entry point. Make sure it is not
a61af66fc99e Initial load
duke
parents:
diff changeset
233 // called accidentally since the SharedRuntime entry points will
a61af66fc99e Initial load
duke
parents:
diff changeset
234 // not work for JDK 1.2.
a61af66fc99e Initial load
duke
parents:
diff changeset
235 //
a61af66fc99e Initial load
duke
parents:
diff changeset
236 // We no longer need to check for JDK 1.2 since it's EOL'ed.
a61af66fc99e Initial load
duke
parents:
diff changeset
237 // The following check existed in pre 1.6 implementation,
a61af66fc99e Initial load
duke
parents:
diff changeset
238 // if (Universe::is_jdk12x_version()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
239 // __ should_not_reach_here();
a61af66fc99e Initial load
duke
parents:
diff changeset
240 // }
a61af66fc99e Initial load
duke
parents:
diff changeset
241 // Universe::is_jdk12x_version() always returns false since
a61af66fc99e Initial load
duke
parents:
diff changeset
242 // the JDK version is not yet determined when this method is called.
a61af66fc99e Initial load
duke
parents:
diff changeset
243 // This method is called during interpreter_init() whereas
a61af66fc99e Initial load
duke
parents:
diff changeset
244 // JDK version is only determined when universe2_init() is called.
a61af66fc99e Initial load
duke
parents:
diff changeset
245
a61af66fc99e Initial load
duke
parents:
diff changeset
246 // Note: For JDK 1.3 StrictMath exists and Math.sin/cos/sqrt are
a61af66fc99e Initial load
duke
parents:
diff changeset
247 // java methods. Interpreter::method_kind(...) will select
a61af66fc99e Initial load
duke
parents:
diff changeset
248 // this entry point for the corresponding methods in JDK 1.3.
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
249 // get argument
0
a61af66fc99e Initial load
duke
parents:
diff changeset
250
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
251 if (kind == Interpreter::java_lang_math_sqrt) {
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
252 __ sqrtsd(xmm0, Address(rsp, wordSize));
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
253 } else {
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
254 __ fld_d(Address(rsp, wordSize));
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
255 switch (kind) {
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
256 case Interpreter::java_lang_math_sin :
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
257 __ trigfunc('s');
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
258 break;
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
259 case Interpreter::java_lang_math_cos :
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
260 __ trigfunc('c');
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
261 break;
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
262 case Interpreter::java_lang_math_tan :
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
263 __ trigfunc('t');
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
264 break;
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
265 case Interpreter::java_lang_math_abs:
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
266 __ fabs();
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
267 break;
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
268 case Interpreter::java_lang_math_log:
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
269 __ flog();
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
270 break;
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
271 case Interpreter::java_lang_math_log10:
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
272 __ flog10();
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
273 break;
6084
6759698e3140 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 3369
diff changeset
274 case Interpreter::java_lang_math_pow:
6759698e3140 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 3369
diff changeset
275 __ fld_d(Address(rsp, 3*wordSize)); // second argument (one
6759698e3140 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 3369
diff changeset
276 // empty stack slot)
6759698e3140 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 3369
diff changeset
277 __ pow_with_fallback(0);
6759698e3140 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 3369
diff changeset
278 break;
6759698e3140 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 3369
diff changeset
279 case Interpreter::java_lang_math_exp:
6759698e3140 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 3369
diff changeset
280 __ exp_with_fallback(0);
6759698e3140 7133857: exp() and pow() should use the x87 ISA on x86
roland
parents: 3369
diff changeset
281 break;
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
282 default :
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
283 ShouldNotReachHere();
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
284 }
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
285
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
286 // return double result in xmm0 for interpreter and compilers.
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
287 __ subptr(rsp, 2*wordSize);
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
288 // Round to 64bit precision
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
289 __ fstp_d(Address(rsp, 0));
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
290 __ movdbl(xmm0, Address(rsp, 0));
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
291 __ addptr(rsp, 2*wordSize);
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
292 }
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
293
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
294
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
295 __ pop(rax);
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
296 __ mov(rsp, r13);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
297 __ jmp(rax);
a61af66fc99e Initial load
duke
parents:
diff changeset
298
a61af66fc99e Initial load
duke
parents:
diff changeset
299 return entry_point;
a61af66fc99e Initial load
duke
parents:
diff changeset
300 }
a61af66fc99e Initial load
duke
parents:
diff changeset
301
a61af66fc99e Initial load
duke
parents:
diff changeset
302
a61af66fc99e Initial load
duke
parents:
diff changeset
303 // Abstract method entry
a61af66fc99e Initial load
duke
parents:
diff changeset
304 // Attempt to execute abstract method. Throw exception
a61af66fc99e Initial load
duke
parents:
diff changeset
305 address InterpreterGenerator::generate_abstract_entry(void) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
306 // rbx: Method*
0
a61af66fc99e Initial load
duke
parents:
diff changeset
307 // r13: sender SP
a61af66fc99e Initial load
duke
parents:
diff changeset
308
a61af66fc99e Initial load
duke
parents:
diff changeset
309 address entry_point = __ pc();
a61af66fc99e Initial load
duke
parents:
diff changeset
310
a61af66fc99e Initial load
duke
parents:
diff changeset
311 // abstract method entry
a61af66fc99e Initial load
duke
parents:
diff changeset
312
14676
d3f14809b051 8036146: make CPP interpreter build again
roland
parents: 7199
diff changeset
313 #ifndef CC_INTERP
1108
85f13cdfbc1d 6829192: JSR 292 needs to support 64-bit x86
twisti
parents: 710
diff changeset
314 // pop return address, reset last_sp to NULL
85f13cdfbc1d 6829192: JSR 292 needs to support 64-bit x86
twisti
parents: 710
diff changeset
315 __ empty_expression_stack();
85f13cdfbc1d 6829192: JSR 292 needs to support 64-bit x86
twisti
parents: 710
diff changeset
316 __ restore_bcp(); // rsi must be correct for exception handler (was destroyed)
85f13cdfbc1d 6829192: JSR 292 needs to support 64-bit x86
twisti
parents: 710
diff changeset
317 __ restore_locals(); // make sure locals pointer is correct as well (was destroyed)
14676
d3f14809b051 8036146: make CPP interpreter build again
roland
parents: 7199
diff changeset
318 #endif
0
a61af66fc99e Initial load
duke
parents:
diff changeset
319
a61af66fc99e Initial load
duke
parents:
diff changeset
320 // throw exception
a61af66fc99e Initial load
duke
parents:
diff changeset
321 __ call_VM(noreg, CAST_FROM_FN_PTR(address,
a61af66fc99e Initial load
duke
parents:
diff changeset
322 InterpreterRuntime::throw_AbstractMethodError));
a61af66fc99e Initial load
duke
parents:
diff changeset
323 // the call_VM checks for exception, so we should never return here.
a61af66fc99e Initial load
duke
parents:
diff changeset
324 __ should_not_reach_here();
a61af66fc99e Initial load
duke
parents:
diff changeset
325
a61af66fc99e Initial load
duke
parents:
diff changeset
326 return entry_point;
a61af66fc99e Initial load
duke
parents:
diff changeset
327 }
a61af66fc99e Initial load
duke
parents:
diff changeset
328
a61af66fc99e Initial load
duke
parents:
diff changeset
329
a61af66fc99e Initial load
duke
parents:
diff changeset
330 // Empty method, generate a very fast return.
a61af66fc99e Initial load
duke
parents:
diff changeset
331
a61af66fc99e Initial load
duke
parents:
diff changeset
332 address InterpreterGenerator::generate_empty_entry(void) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6266
diff changeset
333 // rbx: Method*
0
a61af66fc99e Initial load
duke
parents:
diff changeset
334 // r13: sender sp must set sp to this value on return
a61af66fc99e Initial load
duke
parents:
diff changeset
335
a61af66fc99e Initial load
duke
parents:
diff changeset
336 if (!UseFastEmptyMethods) {
a61af66fc99e Initial load
duke
parents:
diff changeset
337 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
338 }
a61af66fc99e Initial load
duke
parents:
diff changeset
339
a61af66fc99e Initial load
duke
parents:
diff changeset
340 address entry_point = __ pc();
a61af66fc99e Initial load
duke
parents:
diff changeset
341
a61af66fc99e Initial load
duke
parents:
diff changeset
342 // If we need a safepoint check, generate full interpreter entry.
a61af66fc99e Initial load
duke
parents:
diff changeset
343 Label slow_path;
a61af66fc99e Initial load
duke
parents:
diff changeset
344 __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
a61af66fc99e Initial load
duke
parents:
diff changeset
345 SafepointSynchronize::_not_synchronized);
a61af66fc99e Initial load
duke
parents:
diff changeset
346 __ jcc(Assembler::notEqual, slow_path);
a61af66fc99e Initial load
duke
parents:
diff changeset
347
a61af66fc99e Initial load
duke
parents:
diff changeset
348 // do nothing for empty methods (do not even increment invocation counter)
a61af66fc99e Initial load
duke
parents:
diff changeset
349 // Code: _return
a61af66fc99e Initial load
duke
parents:
diff changeset
350 // _return
a61af66fc99e Initial load
duke
parents:
diff changeset
351 // return w/o popping parameters
304
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
352 __ pop(rax);
dc7f315e41f7 5108146: Merge i486 and amd64 cpu directories
never
parents: 196
diff changeset
353 __ mov(rsp, r13);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
354 __ jmp(rax);
a61af66fc99e Initial load
duke
parents:
diff changeset
355
a61af66fc99e Initial load
duke
parents:
diff changeset
356 __ bind(slow_path);
a61af66fc99e Initial load
duke
parents:
diff changeset
357 (void) generate_normal_entry(false);
a61af66fc99e Initial load
duke
parents:
diff changeset
358 return entry_point;
a61af66fc99e Initial load
duke
parents:
diff changeset
359
a61af66fc99e Initial load
duke
parents:
diff changeset
360 }
a61af66fc99e Initial load
duke
parents:
diff changeset
361
a61af66fc99e Initial load
duke
parents:
diff changeset
362 void Deoptimization::unwind_callee_save_values(frame* f, vframeArray* vframe_array) {
a61af66fc99e Initial load
duke
parents:
diff changeset
363
a61af66fc99e Initial load
duke
parents:
diff changeset
364 // This code is sort of the equivalent of C2IAdapter::setup_stack_frame back in
a61af66fc99e Initial load
duke
parents:
diff changeset
365 // the days we had adapter frames. When we deoptimize a situation where a
a61af66fc99e Initial load
duke
parents:
diff changeset
366 // compiled caller calls a compiled caller will have registers it expects
a61af66fc99e Initial load
duke
parents:
diff changeset
367 // to survive the call to the callee. If we deoptimize the callee the only
a61af66fc99e Initial load
duke
parents:
diff changeset
368 // way we can restore these registers is to have the oldest interpreter
a61af66fc99e Initial load
duke
parents:
diff changeset
369 // frame that we create restore these values. That is what this routine
a61af66fc99e Initial load
duke
parents:
diff changeset
370 // will accomplish.
a61af66fc99e Initial load
duke
parents:
diff changeset
371
a61af66fc99e Initial load
duke
parents:
diff changeset
372 // At the moment we have modified c2 to not have any callee save registers
a61af66fc99e Initial load
duke
parents:
diff changeset
373 // so this problem does not exist and this routine is just a place holder.
a61af66fc99e Initial load
duke
parents:
diff changeset
374
a61af66fc99e Initial load
duke
parents:
diff changeset
375 assert(f->is_interpreted_frame(), "must be interpreted");
a61af66fc99e Initial load
duke
parents:
diff changeset
376 }