Mercurial > hg > truffle
comparison src/cpu/x86/vm/jniFastGetField_x86_32.cpp @ 304:dc7f315e41f7
5108146: Merge i486 and amd64 cpu directories
6459804: Want client (c1) compiler for x86_64 (amd64) for faster start-up
Reviewed-by: kvn
author | never |
---|---|
date | Wed, 27 Aug 2008 00:21:55 -0700 |
parents | a61af66fc99e |
children | 9ee9cf798b59 |
comparison
equal
deleted
inserted
replaced
303:fa4d1d240383 | 304:dc7f315e41f7 |
---|---|
70 ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr()); | 70 ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr()); |
71 __ mov32 (rcx, counter); | 71 __ mov32 (rcx, counter); |
72 __ testb (rcx, 1); | 72 __ testb (rcx, 1); |
73 __ jcc (Assembler::notZero, slow); | 73 __ jcc (Assembler::notZero, slow); |
74 if (os::is_MP()) { | 74 if (os::is_MP()) { |
75 __ movl (rax, rcx); | 75 __ mov(rax, rcx); |
76 __ andl (rax, 1); // rax, must end up 0 | 76 __ andptr(rax, 1); // rax, must end up 0 |
77 __ movl (rdx, Address(rsp, rax, Address::times_1, 2*wordSize)); | 77 __ movptr(rdx, Address(rsp, rax, Address::times_1, 2*wordSize)); |
78 // obj, notice rax, is 0. | 78 // obj, notice rax, is 0. |
79 // rdx is data dependent on rcx. | 79 // rdx is data dependent on rcx. |
80 } else { | 80 } else { |
81 __ movl (rdx, Address(rsp, 2*wordSize)); // obj | 81 __ movptr (rdx, Address(rsp, 2*wordSize)); // obj |
82 } | 82 } |
83 __ movl (rax, Address(rsp, 3*wordSize)); // jfieldID | 83 __ movptr(rax, Address(rsp, 3*wordSize)); // jfieldID |
84 __ movl (rdx, Address(rdx, 0)); // *obj | 84 __ movptr(rdx, Address(rdx, 0)); // *obj |
85 __ shrl (rax, 2); // offset | 85 __ shrptr (rax, 2); // offset |
86 | 86 |
87 assert(count < LIST_CAPACITY, "LIST_CAPACITY too small"); | 87 assert(count < LIST_CAPACITY, "LIST_CAPACITY too small"); |
88 speculative_load_pclist[count] = __ pc(); | 88 speculative_load_pclist[count] = __ pc(); |
89 switch (type) { | 89 switch (type) { |
90 case T_BOOLEAN: __ movzxb (rax, Address(rdx, rax, Address::times_1)); break; | 90 case T_BOOLEAN: __ movzbl (rax, Address(rdx, rax, Address::times_1)); break; |
91 case T_BYTE: __ movsxb (rax, Address(rdx, rax, Address::times_1)); break; | 91 case T_BYTE: __ movsbl (rax, Address(rdx, rax, Address::times_1)); break; |
92 case T_CHAR: __ movzxw (rax, Address(rdx, rax, Address::times_1)); break; | 92 case T_CHAR: __ movzwl (rax, Address(rdx, rax, Address::times_1)); break; |
93 case T_SHORT: __ movsxw (rax, Address(rdx, rax, Address::times_1)); break; | 93 case T_SHORT: __ movswl (rax, Address(rdx, rax, Address::times_1)); break; |
94 case T_INT: __ movl (rax, Address(rdx, rax, Address::times_1)); break; | 94 case T_INT: __ movl (rax, Address(rdx, rax, Address::times_1)); break; |
95 default: ShouldNotReachHere(); | 95 default: ShouldNotReachHere(); |
96 } | 96 } |
97 | 97 |
98 Address ca1; | 98 Address ca1; |
99 if (os::is_MP()) { | 99 if (os::is_MP()) { |
100 __ lea(rdx, counter); | 100 __ lea(rdx, counter); |
101 __ xorl(rdx, rax); | 101 __ xorptr(rdx, rax); |
102 __ xorl(rdx, rax); | 102 __ xorptr(rdx, rax); |
103 __ cmp32(rcx, Address(rdx, 0)); | 103 __ cmp32(rcx, Address(rdx, 0)); |
104 // ca1 is the same as ca because | 104 // ca1 is the same as ca because |
105 // rax, ^ counter_addr ^ rax, = address | 105 // rax, ^ counter_addr ^ rax, = address |
106 // ca1 is data dependent on rax,. | 106 // ca1 is data dependent on rax,. |
107 } else { | 107 } else { |
182 // obj 3 | 182 // obj 3 |
183 // jfieldID 4 | 183 // jfieldID 4 |
184 | 184 |
185 ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr()); | 185 ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr()); |
186 | 186 |
187 __ pushl (rsi); | 187 __ push (rsi); |
188 __ mov32 (rcx, counter); | 188 __ mov32 (rcx, counter); |
189 __ testb (rcx, 1); | 189 __ testb (rcx, 1); |
190 __ jcc (Assembler::notZero, slow); | 190 __ jcc (Assembler::notZero, slow); |
191 if (os::is_MP()) { | 191 if (os::is_MP()) { |
192 __ movl (rax, rcx); | 192 __ mov(rax, rcx); |
193 __ andl (rax, 1); // rax, must end up 0 | 193 __ andptr(rax, 1); // rax, must end up 0 |
194 __ movl (rdx, Address(rsp, rax, Address::times_1, 3*wordSize)); | 194 __ movptr(rdx, Address(rsp, rax, Address::times_1, 3*wordSize)); |
195 // obj, notice rax, is 0. | 195 // obj, notice rax, is 0. |
196 // rdx is data dependent on rcx. | 196 // rdx is data dependent on rcx. |
197 } else { | 197 } else { |
198 __ movl (rdx, Address(rsp, 3*wordSize)); // obj | 198 __ movptr(rdx, Address(rsp, 3*wordSize)); // obj |
199 } | 199 } |
200 __ movl (rsi, Address(rsp, 4*wordSize)); // jfieldID | 200 __ movptr(rsi, Address(rsp, 4*wordSize)); // jfieldID |
201 __ movl (rdx, Address(rdx, 0)); // *obj | 201 __ movptr(rdx, Address(rdx, 0)); // *obj |
202 __ shrl (rsi, 2); // offset | 202 __ shrptr(rsi, 2); // offset |
203 | 203 |
204 assert(count < LIST_CAPACITY-1, "LIST_CAPACITY too small"); | 204 assert(count < LIST_CAPACITY-1, "LIST_CAPACITY too small"); |
205 speculative_load_pclist[count++] = __ pc(); | 205 speculative_load_pclist[count++] = __ pc(); |
206 __ movl (rax, Address(rdx, rsi, Address::times_1)); | 206 __ movptr(rax, Address(rdx, rsi, Address::times_1)); |
207 #ifndef _LP64 | |
207 speculative_load_pclist[count] = __ pc(); | 208 speculative_load_pclist[count] = __ pc(); |
208 __ movl (rdx, Address(rdx, rsi, Address::times_1, 4)); | 209 __ movl(rdx, Address(rdx, rsi, Address::times_1, 4)); |
209 | 210 #endif // _LP64 |
210 if (os::is_MP()) { | 211 |
211 __ lea (rsi, counter); | 212 if (os::is_MP()) { |
212 __ xorl (rsi, rdx); | 213 __ lea(rsi, counter); |
213 __ xorl (rsi, rax); | 214 __ xorptr(rsi, rdx); |
214 __ xorl (rsi, rdx); | 215 __ xorptr(rsi, rax); |
215 __ xorl (rsi, rax); | 216 __ xorptr(rsi, rdx); |
217 __ xorptr(rsi, rax); | |
216 __ cmp32(rcx, Address(rsi, 0)); | 218 __ cmp32(rcx, Address(rsi, 0)); |
217 // ca1 is the same as ca because | 219 // ca1 is the same as ca because |
218 // rax, ^ rdx ^ counter_addr ^ rax, ^ rdx = address | 220 // rax, ^ rdx ^ counter_addr ^ rax, ^ rdx = address |
219 // ca1 is data dependent on both rax, and rdx. | 221 // ca1 is data dependent on both rax, and rdx. |
220 } else { | 222 } else { |
221 __ cmp32(rcx, counter); | 223 __ cmp32(rcx, counter); |
222 } | 224 } |
223 __ jcc (Assembler::notEqual, slow); | 225 __ jcc (Assembler::notEqual, slow); |
224 | 226 |
225 __ popl (rsi); | 227 __ pop (rsi); |
226 | 228 |
227 #ifndef _WINDOWS | 229 #ifndef _WINDOWS |
228 __ ret (0); | 230 __ ret (0); |
229 #else | 231 #else |
230 // __stdcall calling convention | 232 // __stdcall calling convention |
232 #endif | 234 #endif |
233 | 235 |
234 slowcase_entry_pclist[count-1] = __ pc(); | 236 slowcase_entry_pclist[count-1] = __ pc(); |
235 slowcase_entry_pclist[count++] = __ pc(); | 237 slowcase_entry_pclist[count++] = __ pc(); |
236 __ bind (slow); | 238 __ bind (slow); |
237 __ popl (rsi); | 239 __ pop (rsi); |
238 address slow_case_addr = jni_GetLongField_addr();; | 240 address slow_case_addr = jni_GetLongField_addr();; |
239 // tail call | 241 // tail call |
240 __ jump (ExternalAddress(slow_case_addr)); | 242 __ jump (ExternalAddress(slow_case_addr)); |
241 | 243 |
242 __ flush (); | 244 __ flush (); |
274 | 276 |
275 __ mov32 (rcx, counter); | 277 __ mov32 (rcx, counter); |
276 __ testb (rcx, 1); | 278 __ testb (rcx, 1); |
277 __ jcc (Assembler::notZero, slow); | 279 __ jcc (Assembler::notZero, slow); |
278 if (os::is_MP()) { | 280 if (os::is_MP()) { |
279 __ movl (rax, rcx); | 281 __ mov(rax, rcx); |
280 __ andl (rax, 1); // rax, must end up 0 | 282 __ andptr(rax, 1); // rax, must end up 0 |
281 __ movl (rdx, Address(rsp, rax, Address::times_1, 2*wordSize)); | 283 __ movptr(rdx, Address(rsp, rax, Address::times_1, 2*wordSize)); |
282 // obj, notice rax, is 0. | 284 // obj, notice rax, is 0. |
283 // rdx is data dependent on rcx. | 285 // rdx is data dependent on rcx. |
284 } else { | 286 } else { |
285 __ movl (rdx, Address(rsp, 2*wordSize)); // obj | 287 __ movptr(rdx, Address(rsp, 2*wordSize)); // obj |
286 } | 288 } |
287 __ movl (rax, Address(rsp, 3*wordSize)); // jfieldID | 289 __ movptr(rax, Address(rsp, 3*wordSize)); // jfieldID |
288 __ movl (rdx, Address(rdx, 0)); // *obj | 290 __ movptr(rdx, Address(rdx, 0)); // *obj |
289 __ shrl (rax, 2); // offset | 291 __ shrptr(rax, 2); // offset |
290 | 292 |
291 assert(count < LIST_CAPACITY, "LIST_CAPACITY too small"); | 293 assert(count < LIST_CAPACITY, "LIST_CAPACITY too small"); |
292 speculative_load_pclist[count] = __ pc(); | 294 speculative_load_pclist[count] = __ pc(); |
293 switch (type) { | 295 switch (type) { |
296 #ifndef _LP64 | |
294 case T_FLOAT: __ fld_s (Address(rdx, rax, Address::times_1)); break; | 297 case T_FLOAT: __ fld_s (Address(rdx, rax, Address::times_1)); break; |
295 case T_DOUBLE: __ fld_d (Address(rdx, rax, Address::times_1)); break; | 298 case T_DOUBLE: __ fld_d (Address(rdx, rax, Address::times_1)); break; |
299 #else | |
300 case T_FLOAT: __ movflt (xmm0, Address(robj, roffset, Address::times_1)); break; | |
301 case T_DOUBLE: __ movdbl (xmm0, Address(robj, roffset, Address::times_1)); break; | |
302 #endif // _LP64 | |
296 default: ShouldNotReachHere(); | 303 default: ShouldNotReachHere(); |
297 } | 304 } |
298 | 305 |
299 Address ca1; | 306 Address ca1; |
300 if (os::is_MP()) { | 307 if (os::is_MP()) { |
301 __ fst_s (Address(rsp, -4)); | 308 __ fst_s (Address(rsp, -4)); |
302 __ lea(rdx, counter); | 309 __ lea(rdx, counter); |
303 __ movl (rax, Address(rsp, -4)); | 310 __ movl (rax, Address(rsp, -4)); |
304 __ xorl(rdx, rax); | 311 // garbage hi-order bits on 64bit are harmless. |
305 __ xorl(rdx, rax); | 312 __ xorptr(rdx, rax); |
313 __ xorptr(rdx, rax); | |
306 __ cmp32(rcx, Address(rdx, 0)); | 314 __ cmp32(rcx, Address(rdx, 0)); |
307 // rax, ^ counter_addr ^ rax, = address | 315 // rax, ^ counter_addr ^ rax, = address |
308 // ca1 is data dependent on the field | 316 // ca1 is data dependent on the field |
309 // access. | 317 // access. |
310 } else { | 318 } else { |