Mercurial > hg > graal-jvmci-8
annotate src/cpu/x86/vm/stubGenerator_x86_64.cpp @ 1449:8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Thu, 11 Nov 2010 14:09:37 +0100 |
parents | 6476042f815c |
children | 2338d41fbd81 |
rev | line source |
---|---|
0 | 1 /* |
1174
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2 * Copyright 2003-2010 Sun Microsystems, Inc. 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 * | |
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 * | |
23 */ | |
24 | |
25 #include "incls/_precompiled.incl" | |
26 #include "incls/_stubGenerator_x86_64.cpp.incl" | |
27 | |
28 // Declaration and definition of StubGenerator (no .hpp file). | |
29 // For a more detailed description of the stub routine structure | |
30 // see the comment in stubRoutines.hpp | |
31 | |
32 #define __ _masm-> | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
33 #define TIMES_OOP (UseCompressedOops ? Address::times_4 : Address::times_8) |
304 | 34 #define a__ ((Assembler*)_masm)-> |
0 | 35 |
36 #ifdef PRODUCT | |
37 #define BLOCK_COMMENT(str) /* nothing */ | |
38 #else | |
39 #define BLOCK_COMMENT(str) __ block_comment(str) | |
40 #endif | |
41 | |
42 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":") | |
43 const int MXCSR_MASK = 0xFFC0; // Mask out any pending exceptions | |
44 | |
45 // Stub Code definitions | |
46 | |
47 static address handle_unsafe_access() { | |
48 JavaThread* thread = JavaThread::current(); | |
49 address pc = thread->saved_exception_pc(); | |
50 // pc is the instruction which we must emulate | |
51 // doing a no-op is fine: return garbage from the load | |
52 // therefore, compute npc | |
53 address npc = Assembler::locate_next_instruction(pc); | |
54 | |
55 // request an async exception | |
56 thread->set_pending_unsafe_access_error(); | |
57 | |
58 // return address of next instruction to execute | |
59 return npc; | |
60 } | |
61 | |
62 class StubGenerator: public StubCodeGenerator { | |
63 private: | |
64 | |
65 #ifdef PRODUCT | |
66 #define inc_counter_np(counter) (0) | |
67 #else | |
68 void inc_counter_np_(int& counter) { | |
69 __ incrementl(ExternalAddress((address)&counter)); | |
70 } | |
71 #define inc_counter_np(counter) \ | |
72 BLOCK_COMMENT("inc_counter " #counter); \ | |
73 inc_counter_np_(counter); | |
74 #endif | |
75 | |
76 // Call stubs are used to call Java from C | |
77 // | |
78 // Linux Arguments: | |
79 // c_rarg0: call wrapper address address | |
80 // c_rarg1: result address | |
81 // c_rarg2: result type BasicType | |
82 // c_rarg3: method methodOop | |
83 // c_rarg4: (interpreter) entry point address | |
84 // c_rarg5: parameters intptr_t* | |
85 // 16(rbp): parameter size (in words) int | |
86 // 24(rbp): thread Thread* | |
87 // | |
88 // [ return_from_Java ] <--- rsp | |
89 // [ argument word n ] | |
90 // ... | |
91 // -12 [ argument word 1 ] | |
92 // -11 [ saved r15 ] <--- rsp_after_call | |
93 // -10 [ saved r14 ] | |
94 // -9 [ saved r13 ] | |
95 // -8 [ saved r12 ] | |
96 // -7 [ saved rbx ] | |
97 // -6 [ call wrapper ] | |
98 // -5 [ result ] | |
99 // -4 [ result type ] | |
100 // -3 [ method ] | |
101 // -2 [ entry point ] | |
102 // -1 [ parameters ] | |
103 // 0 [ saved rbp ] <--- rbp | |
104 // 1 [ return address ] | |
105 // 2 [ parameter size ] | |
106 // 3 [ thread ] | |
107 // | |
108 // Windows Arguments: | |
109 // c_rarg0: call wrapper address address | |
110 // c_rarg1: result address | |
111 // c_rarg2: result type BasicType | |
112 // c_rarg3: method methodOop | |
113 // 48(rbp): (interpreter) entry point address | |
114 // 56(rbp): parameters intptr_t* | |
115 // 64(rbp): parameter size (in words) int | |
116 // 72(rbp): thread Thread* | |
117 // | |
118 // [ return_from_Java ] <--- rsp | |
119 // [ argument word n ] | |
120 // ... | |
121 // -8 [ argument word 1 ] | |
122 // -7 [ saved r15 ] <--- rsp_after_call | |
123 // -6 [ saved r14 ] | |
124 // -5 [ saved r13 ] | |
125 // -4 [ saved r12 ] | |
126 // -3 [ saved rdi ] | |
127 // -2 [ saved rsi ] | |
128 // -1 [ saved rbx ] | |
129 // 0 [ saved rbp ] <--- rbp | |
130 // 1 [ return address ] | |
131 // 2 [ call wrapper ] | |
132 // 3 [ result ] | |
133 // 4 [ result type ] | |
134 // 5 [ method ] | |
135 // 6 [ entry point ] | |
136 // 7 [ parameters ] | |
137 // 8 [ parameter size ] | |
138 // 9 [ thread ] | |
139 // | |
140 // Windows reserves the callers stack space for arguments 1-4. | |
141 // We spill c_rarg0-c_rarg3 to this space. | |
142 | |
143 // Call stub stack layout word offsets from rbp | |
144 enum call_stub_layout { | |
145 #ifdef _WIN64 | |
146 rsp_after_call_off = -7, | |
147 r15_off = rsp_after_call_off, | |
148 r14_off = -6, | |
149 r13_off = -5, | |
150 r12_off = -4, | |
151 rdi_off = -3, | |
152 rsi_off = -2, | |
153 rbx_off = -1, | |
154 rbp_off = 0, | |
155 retaddr_off = 1, | |
156 call_wrapper_off = 2, | |
157 result_off = 3, | |
158 result_type_off = 4, | |
159 method_off = 5, | |
160 entry_point_off = 6, | |
161 parameters_off = 7, | |
162 parameter_size_off = 8, | |
163 thread_off = 9 | |
164 #else | |
165 rsp_after_call_off = -12, | |
166 mxcsr_off = rsp_after_call_off, | |
167 r15_off = -11, | |
168 r14_off = -10, | |
169 r13_off = -9, | |
170 r12_off = -8, | |
171 rbx_off = -7, | |
172 call_wrapper_off = -6, | |
173 result_off = -5, | |
174 result_type_off = -4, | |
175 method_off = -3, | |
176 entry_point_off = -2, | |
177 parameters_off = -1, | |
178 rbp_off = 0, | |
179 retaddr_off = 1, | |
180 parameter_size_off = 2, | |
181 thread_off = 3 | |
182 #endif | |
183 }; | |
184 | |
185 address generate_call_stub(address& return_address) { | |
186 assert((int)frame::entry_frame_after_call_words == -(int)rsp_after_call_off + 1 && | |
187 (int)frame::entry_frame_call_wrapper_offset == (int)call_wrapper_off, | |
188 "adjust this code"); | |
189 StubCodeMark mark(this, "StubRoutines", "call_stub"); | |
190 address start = __ pc(); | |
191 | |
192 // same as in generate_catch_exception()! | |
193 const Address rsp_after_call(rbp, rsp_after_call_off * wordSize); | |
194 | |
195 const Address call_wrapper (rbp, call_wrapper_off * wordSize); | |
196 const Address result (rbp, result_off * wordSize); | |
197 const Address result_type (rbp, result_type_off * wordSize); | |
198 const Address method (rbp, method_off * wordSize); | |
199 const Address entry_point (rbp, entry_point_off * wordSize); | |
200 const Address parameters (rbp, parameters_off * wordSize); | |
201 const Address parameter_size(rbp, parameter_size_off * wordSize); | |
202 | |
203 // same as in generate_catch_exception()! | |
204 const Address thread (rbp, thread_off * wordSize); | |
205 | |
206 const Address r15_save(rbp, r15_off * wordSize); | |
207 const Address r14_save(rbp, r14_off * wordSize); | |
208 const Address r13_save(rbp, r13_off * wordSize); | |
209 const Address r12_save(rbp, r12_off * wordSize); | |
210 const Address rbx_save(rbp, rbx_off * wordSize); | |
211 | |
212 // stub code | |
213 __ enter(); | |
304 | 214 __ subptr(rsp, -rsp_after_call_off * wordSize); |
0 | 215 |
216 // save register parameters | |
217 #ifndef _WIN64 | |
304 | 218 __ movptr(parameters, c_rarg5); // parameters |
219 __ movptr(entry_point, c_rarg4); // entry_point | |
0 | 220 #endif |
221 | |
304 | 222 __ movptr(method, c_rarg3); // method |
223 __ movl(result_type, c_rarg2); // result type | |
224 __ movptr(result, c_rarg1); // result | |
225 __ movptr(call_wrapper, c_rarg0); // call wrapper | |
0 | 226 |
227 // save regs belonging to calling function | |
304 | 228 __ movptr(rbx_save, rbx); |
229 __ movptr(r12_save, r12); | |
230 __ movptr(r13_save, r13); | |
231 __ movptr(r14_save, r14); | |
232 __ movptr(r15_save, r15); | |
0 | 233 |
234 #ifdef _WIN64 | |
235 const Address rdi_save(rbp, rdi_off * wordSize); | |
236 const Address rsi_save(rbp, rsi_off * wordSize); | |
237 | |
304 | 238 __ movptr(rsi_save, rsi); |
239 __ movptr(rdi_save, rdi); | |
0 | 240 #else |
241 const Address mxcsr_save(rbp, mxcsr_off * wordSize); | |
242 { | |
243 Label skip_ldmx; | |
244 __ stmxcsr(mxcsr_save); | |
245 __ movl(rax, mxcsr_save); | |
246 __ andl(rax, MXCSR_MASK); // Only check control and mask bits | |
304 | 247 ExternalAddress mxcsr_std(StubRoutines::x86::mxcsr_std()); |
0 | 248 __ cmp32(rax, mxcsr_std); |
249 __ jcc(Assembler::equal, skip_ldmx); | |
250 __ ldmxcsr(mxcsr_std); | |
251 __ bind(skip_ldmx); | |
252 } | |
253 #endif | |
254 | |
255 // Load up thread register | |
304 | 256 __ movptr(r15_thread, thread); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
257 __ reinit_heapbase(); |
0 | 258 |
259 #ifdef ASSERT | |
260 // make sure we have no pending exceptions | |
261 { | |
262 Label L; | |
304 | 263 __ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); |
0 | 264 __ jcc(Assembler::equal, L); |
265 __ stop("StubRoutines::call_stub: entered with pending exception"); | |
266 __ bind(L); | |
267 } | |
268 #endif | |
269 | |
270 // pass parameters if any | |
271 BLOCK_COMMENT("pass parameters if any"); | |
272 Label parameters_done; | |
273 __ movl(c_rarg3, parameter_size); | |
274 __ testl(c_rarg3, c_rarg3); | |
275 __ jcc(Assembler::zero, parameters_done); | |
276 | |
277 Label loop; | |
304 | 278 __ movptr(c_rarg2, parameters); // parameter pointer |
279 __ movl(c_rarg1, c_rarg3); // parameter counter is in c_rarg1 | |
0 | 280 __ BIND(loop); |
281 if (TaggedStackInterpreter) { | |
304 | 282 __ movl(rax, Address(c_rarg2, 0)); // get tag |
283 __ addptr(c_rarg2, wordSize); // advance to next tag | |
284 __ push(rax); // pass tag | |
0 | 285 } |
304 | 286 __ movptr(rax, Address(c_rarg2, 0));// get parameter |
287 __ addptr(c_rarg2, wordSize); // advance to next parameter | |
288 __ decrementl(c_rarg1); // decrement counter | |
289 __ push(rax); // pass parameter | |
0 | 290 __ jcc(Assembler::notZero, loop); |
291 | |
292 // call Java function | |
293 __ BIND(parameters_done); | |
304 | 294 __ movptr(rbx, method); // get methodOop |
295 __ movptr(c_rarg1, entry_point); // get entry_point | |
296 __ mov(r13, rsp); // set sender sp | |
0 | 297 BLOCK_COMMENT("call Java function"); |
298 __ call(c_rarg1); | |
299 | |
300 BLOCK_COMMENT("call_stub_return_address:"); | |
301 return_address = __ pc(); | |
302 | |
303 // store result depending on type (everything that is not | |
304 // T_OBJECT, T_LONG, T_FLOAT or T_DOUBLE is treated as T_INT) | |
304 | 305 __ movptr(c_rarg0, result); |
0 | 306 Label is_long, is_float, is_double, exit; |
307 __ movl(c_rarg1, result_type); | |
308 __ cmpl(c_rarg1, T_OBJECT); | |
309 __ jcc(Assembler::equal, is_long); | |
310 __ cmpl(c_rarg1, T_LONG); | |
311 __ jcc(Assembler::equal, is_long); | |
312 __ cmpl(c_rarg1, T_FLOAT); | |
313 __ jcc(Assembler::equal, is_float); | |
314 __ cmpl(c_rarg1, T_DOUBLE); | |
315 __ jcc(Assembler::equal, is_double); | |
316 | |
317 // handle T_INT case | |
318 __ movl(Address(c_rarg0, 0), rax); | |
319 | |
320 __ BIND(exit); | |
321 | |
322 // pop parameters | |
304 | 323 __ lea(rsp, rsp_after_call); |
0 | 324 |
325 #ifdef ASSERT | |
326 // verify that threads correspond | |
327 { | |
328 Label L, S; | |
304 | 329 __ cmpptr(r15_thread, thread); |
0 | 330 __ jcc(Assembler::notEqual, S); |
331 __ get_thread(rbx); | |
304 | 332 __ cmpptr(r15_thread, rbx); |
0 | 333 __ jcc(Assembler::equal, L); |
334 __ bind(S); | |
335 __ jcc(Assembler::equal, L); | |
336 __ stop("StubRoutines::call_stub: threads must correspond"); | |
337 __ bind(L); | |
338 } | |
339 #endif | |
340 | |
341 // restore regs belonging to calling function | |
304 | 342 __ movptr(r15, r15_save); |
343 __ movptr(r14, r14_save); | |
344 __ movptr(r13, r13_save); | |
345 __ movptr(r12, r12_save); | |
346 __ movptr(rbx, rbx_save); | |
0 | 347 |
348 #ifdef _WIN64 | |
304 | 349 __ movptr(rdi, rdi_save); |
350 __ movptr(rsi, rsi_save); | |
0 | 351 #else |
352 __ ldmxcsr(mxcsr_save); | |
353 #endif | |
354 | |
355 // restore rsp | |
304 | 356 __ addptr(rsp, -rsp_after_call_off * wordSize); |
0 | 357 |
358 // return | |
304 | 359 __ pop(rbp); |
0 | 360 __ ret(0); |
361 | |
362 // handle return types different from T_INT | |
363 __ BIND(is_long); | |
364 __ movq(Address(c_rarg0, 0), rax); | |
365 __ jmp(exit); | |
366 | |
367 __ BIND(is_float); | |
368 __ movflt(Address(c_rarg0, 0), xmm0); | |
369 __ jmp(exit); | |
370 | |
371 __ BIND(is_double); | |
372 __ movdbl(Address(c_rarg0, 0), xmm0); | |
373 __ jmp(exit); | |
374 | |
375 return start; | |
376 } | |
377 | |
378 // Return point for a Java call if there's an exception thrown in | |
379 // Java code. The exception is caught and transformed into a | |
380 // pending exception stored in JavaThread that can be tested from | |
381 // within the VM. | |
382 // | |
383 // Note: Usually the parameters are removed by the callee. In case | |
384 // of an exception crossing an activation frame boundary, that is | |
385 // not the case if the callee is compiled code => need to setup the | |
386 // rsp. | |
387 // | |
388 // rax: exception oop | |
389 | |
390 address generate_catch_exception() { | |
391 StubCodeMark mark(this, "StubRoutines", "catch_exception"); | |
392 address start = __ pc(); | |
393 | |
394 // same as in generate_call_stub(): | |
395 const Address rsp_after_call(rbp, rsp_after_call_off * wordSize); | |
396 const Address thread (rbp, thread_off * wordSize); | |
397 | |
398 #ifdef ASSERT | |
399 // verify that threads correspond | |
400 { | |
401 Label L, S; | |
304 | 402 __ cmpptr(r15_thread, thread); |
0 | 403 __ jcc(Assembler::notEqual, S); |
404 __ get_thread(rbx); | |
304 | 405 __ cmpptr(r15_thread, rbx); |
0 | 406 __ jcc(Assembler::equal, L); |
407 __ bind(S); | |
408 __ stop("StubRoutines::catch_exception: threads must correspond"); | |
409 __ bind(L); | |
410 } | |
411 #endif | |
412 | |
413 // set pending exception | |
414 __ verify_oop(rax); | |
415 | |
304 | 416 __ movptr(Address(r15_thread, Thread::pending_exception_offset()), rax); |
0 | 417 __ lea(rscratch1, ExternalAddress((address)__FILE__)); |
304 | 418 __ movptr(Address(r15_thread, Thread::exception_file_offset()), rscratch1); |
0 | 419 __ movl(Address(r15_thread, Thread::exception_line_offset()), (int) __LINE__); |
420 | |
421 // complete return to VM | |
422 assert(StubRoutines::_call_stub_return_address != NULL, | |
423 "_call_stub_return_address must have been generated before"); | |
424 __ jump(RuntimeAddress(StubRoutines::_call_stub_return_address)); | |
425 | |
426 return start; | |
427 } | |
428 | |
429 // Continuation point for runtime calls returning with a pending | |
430 // exception. The pending exception check happened in the runtime | |
431 // or native call stub. The pending exception in Thread is | |
432 // converted into a Java-level exception. | |
433 // | |
434 // Contract with Java-level exception handlers: | |
435 // rax: exception | |
436 // rdx: throwing pc | |
437 // | |
438 // NOTE: At entry of this stub, exception-pc must be on stack !! | |
439 | |
440 address generate_forward_exception() { | |
441 StubCodeMark mark(this, "StubRoutines", "forward exception"); | |
442 address start = __ pc(); | |
443 | |
444 // Upon entry, the sp points to the return address returning into | |
445 // Java (interpreted or compiled) code; i.e., the return address | |
446 // becomes the throwing pc. | |
447 // | |
448 // Arguments pushed before the runtime call are still on the stack | |
449 // but the exception handler will reset the stack pointer -> | |
450 // ignore them. A potential result in registers can be ignored as | |
451 // well. | |
452 | |
453 #ifdef ASSERT | |
454 // make sure this code is only executed if there is a pending exception | |
455 { | |
456 Label L; | |
304 | 457 __ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t) NULL); |
0 | 458 __ jcc(Assembler::notEqual, L); |
459 __ stop("StubRoutines::forward exception: no pending exception (1)"); | |
460 __ bind(L); | |
461 } | |
462 #endif | |
463 | |
464 // compute exception handler into rbx | |
304 | 465 __ movptr(c_rarg0, Address(rsp, 0)); |
0 | 466 BLOCK_COMMENT("call exception_handler_for_return_address"); |
467 __ call_VM_leaf(CAST_FROM_FN_PTR(address, | |
468 SharedRuntime::exception_handler_for_return_address), | |
1295 | 469 r15_thread, c_rarg0); |
304 | 470 __ mov(rbx, rax); |
0 | 471 |
472 // setup rax & rdx, remove return address & clear pending exception | |
304 | 473 __ pop(rdx); |
474 __ movptr(rax, Address(r15_thread, Thread::pending_exception_offset())); | |
512
db4caa99ef11
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
405
diff
changeset
|
475 __ movptr(Address(r15_thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); |
0 | 476 |
477 #ifdef ASSERT | |
478 // make sure exception is set | |
479 { | |
480 Label L; | |
304 | 481 __ testptr(rax, rax); |
0 | 482 __ jcc(Assembler::notEqual, L); |
483 __ stop("StubRoutines::forward exception: no pending exception (2)"); | |
484 __ bind(L); | |
485 } | |
486 #endif | |
487 | |
488 // continue at exception handler (return address removed) | |
489 // rax: exception | |
490 // rbx: exception handler | |
491 // rdx: throwing pc | |
492 __ verify_oop(rax); | |
493 __ jmp(rbx); | |
494 | |
495 return start; | |
496 } | |
497 | |
498 // Support for jint atomic::xchg(jint exchange_value, volatile jint* dest) | |
499 // | |
500 // Arguments : | |
501 // c_rarg0: exchange_value | |
502 // c_rarg0: dest | |
503 // | |
504 // Result: | |
505 // *dest <- ex, return (orig *dest) | |
506 address generate_atomic_xchg() { | |
507 StubCodeMark mark(this, "StubRoutines", "atomic_xchg"); | |
508 address start = __ pc(); | |
509 | |
510 __ movl(rax, c_rarg0); // Copy to eax we need a return value anyhow | |
511 __ xchgl(rax, Address(c_rarg1, 0)); // automatic LOCK | |
512 __ ret(0); | |
513 | |
514 return start; | |
515 } | |
516 | |
517 // Support for intptr_t atomic::xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) | |
518 // | |
519 // Arguments : | |
520 // c_rarg0: exchange_value | |
521 // c_rarg1: dest | |
522 // | |
523 // Result: | |
524 // *dest <- ex, return (orig *dest) | |
525 address generate_atomic_xchg_ptr() { | |
526 StubCodeMark mark(this, "StubRoutines", "atomic_xchg_ptr"); | |
527 address start = __ pc(); | |
528 | |
304 | 529 __ movptr(rax, c_rarg0); // Copy to eax we need a return value anyhow |
530 __ xchgptr(rax, Address(c_rarg1, 0)); // automatic LOCK | |
0 | 531 __ ret(0); |
532 | |
533 return start; | |
534 } | |
535 | |
536 // Support for jint atomic::atomic_cmpxchg(jint exchange_value, volatile jint* dest, | |
537 // jint compare_value) | |
538 // | |
539 // Arguments : | |
540 // c_rarg0: exchange_value | |
541 // c_rarg1: dest | |
542 // c_rarg2: compare_value | |
543 // | |
544 // Result: | |
545 // if ( compare_value == *dest ) { | |
546 // *dest = exchange_value | |
547 // return compare_value; | |
548 // else | |
549 // return *dest; | |
550 address generate_atomic_cmpxchg() { | |
551 StubCodeMark mark(this, "StubRoutines", "atomic_cmpxchg"); | |
552 address start = __ pc(); | |
553 | |
554 __ movl(rax, c_rarg2); | |
555 if ( os::is_MP() ) __ lock(); | |
556 __ cmpxchgl(c_rarg0, Address(c_rarg1, 0)); | |
557 __ ret(0); | |
558 | |
559 return start; | |
560 } | |
561 | |
562 // Support for jint atomic::atomic_cmpxchg_long(jlong exchange_value, | |
563 // volatile jlong* dest, | |
564 // jlong compare_value) | |
565 // Arguments : | |
566 // c_rarg0: exchange_value | |
567 // c_rarg1: dest | |
568 // c_rarg2: compare_value | |
569 // | |
570 // Result: | |
571 // if ( compare_value == *dest ) { | |
572 // *dest = exchange_value | |
573 // return compare_value; | |
574 // else | |
575 // return *dest; | |
576 address generate_atomic_cmpxchg_long() { | |
577 StubCodeMark mark(this, "StubRoutines", "atomic_cmpxchg_long"); | |
578 address start = __ pc(); | |
579 | |
580 __ movq(rax, c_rarg2); | |
581 if ( os::is_MP() ) __ lock(); | |
582 __ cmpxchgq(c_rarg0, Address(c_rarg1, 0)); | |
583 __ ret(0); | |
584 | |
585 return start; | |
586 } | |
587 | |
588 // Support for jint atomic::add(jint add_value, volatile jint* dest) | |
589 // | |
590 // Arguments : | |
591 // c_rarg0: add_value | |
592 // c_rarg1: dest | |
593 // | |
594 // Result: | |
595 // *dest += add_value | |
596 // return *dest; | |
597 address generate_atomic_add() { | |
598 StubCodeMark mark(this, "StubRoutines", "atomic_add"); | |
599 address start = __ pc(); | |
600 | |
601 __ movl(rax, c_rarg0); | |
602 if ( os::is_MP() ) __ lock(); | |
603 __ xaddl(Address(c_rarg1, 0), c_rarg0); | |
604 __ addl(rax, c_rarg0); | |
605 __ ret(0); | |
606 | |
607 return start; | |
608 } | |
609 | |
610 // Support for intptr_t atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) | |
611 // | |
612 // Arguments : | |
613 // c_rarg0: add_value | |
614 // c_rarg1: dest | |
615 // | |
616 // Result: | |
617 // *dest += add_value | |
618 // return *dest; | |
619 address generate_atomic_add_ptr() { | |
620 StubCodeMark mark(this, "StubRoutines", "atomic_add_ptr"); | |
621 address start = __ pc(); | |
622 | |
304 | 623 __ movptr(rax, c_rarg0); // Copy to eax we need a return value anyhow |
0 | 624 if ( os::is_MP() ) __ lock(); |
304 | 625 __ xaddptr(Address(c_rarg1, 0), c_rarg0); |
626 __ addptr(rax, c_rarg0); | |
0 | 627 __ ret(0); |
628 | |
629 return start; | |
630 } | |
631 | |
632 // Support for intptr_t OrderAccess::fence() | |
633 // | |
634 // Arguments : | |
635 // | |
636 // Result: | |
637 address generate_orderaccess_fence() { | |
638 StubCodeMark mark(this, "StubRoutines", "orderaccess_fence"); | |
639 address start = __ pc(); | |
671
d0994e5bebce
6822204: volatile fences should prefer lock:addl to actual mfence instructions
never
parents:
647
diff
changeset
|
640 __ membar(Assembler::StoreLoad); |
0 | 641 __ ret(0); |
642 | |
643 return start; | |
644 } | |
645 | |
646 // Support for intptr_t get_previous_fp() | |
647 // | |
648 // This routine is used to find the previous frame pointer for the | |
649 // caller (current_frame_guess). This is used as part of debugging | |
650 // ps() is seemingly lost trying to find frames. | |
651 // This code assumes that caller current_frame_guess) has a frame. | |
652 address generate_get_previous_fp() { | |
653 StubCodeMark mark(this, "StubRoutines", "get_previous_fp"); | |
654 const Address old_fp(rbp, 0); | |
655 const Address older_fp(rax, 0); | |
656 address start = __ pc(); | |
657 | |
658 __ enter(); | |
304 | 659 __ movptr(rax, old_fp); // callers fp |
660 __ movptr(rax, older_fp); // the frame for ps() | |
661 __ pop(rbp); | |
0 | 662 __ ret(0); |
663 | |
664 return start; | |
665 } | |
666 | |
667 //---------------------------------------------------------------------------------------------------- | |
668 // Support for void verify_mxcsr() | |
669 // | |
670 // This routine is used with -Xcheck:jni to verify that native | |
671 // JNI code does not return to Java code without restoring the | |
672 // MXCSR register to our expected state. | |
673 | |
674 address generate_verify_mxcsr() { | |
675 StubCodeMark mark(this, "StubRoutines", "verify_mxcsr"); | |
676 address start = __ pc(); | |
677 | |
678 const Address mxcsr_save(rsp, 0); | |
679 | |
680 if (CheckJNICalls) { | |
681 Label ok_ret; | |
304 | 682 __ push(rax); |
683 __ subptr(rsp, wordSize); // allocate a temp location | |
0 | 684 __ stmxcsr(mxcsr_save); |
685 __ movl(rax, mxcsr_save); | |
686 __ andl(rax, MXCSR_MASK); // Only check control and mask bits | |
304 | 687 __ cmpl(rax, *(int *)(StubRoutines::x86::mxcsr_std())); |
0 | 688 __ jcc(Assembler::equal, ok_ret); |
689 | |
690 __ warn("MXCSR changed by native JNI code, use -XX:+RestoreMXCSROnJNICall"); | |
691 | |
304 | 692 __ ldmxcsr(ExternalAddress(StubRoutines::x86::mxcsr_std())); |
0 | 693 |
694 __ bind(ok_ret); | |
304 | 695 __ addptr(rsp, wordSize); |
696 __ pop(rax); | |
0 | 697 } |
698 | |
699 __ ret(0); | |
700 | |
701 return start; | |
702 } | |
703 | |
704 address generate_f2i_fixup() { | |
705 StubCodeMark mark(this, "StubRoutines", "f2i_fixup"); | |
706 Address inout(rsp, 5 * wordSize); // return address + 4 saves | |
707 | |
708 address start = __ pc(); | |
709 | |
710 Label L; | |
711 | |
304 | 712 __ push(rax); |
713 __ push(c_rarg3); | |
714 __ push(c_rarg2); | |
715 __ push(c_rarg1); | |
0 | 716 |
717 __ movl(rax, 0x7f800000); | |
718 __ xorl(c_rarg3, c_rarg3); | |
719 __ movl(c_rarg2, inout); | |
720 __ movl(c_rarg1, c_rarg2); | |
721 __ andl(c_rarg1, 0x7fffffff); | |
722 __ cmpl(rax, c_rarg1); // NaN? -> 0 | |
723 __ jcc(Assembler::negative, L); | |
724 __ testl(c_rarg2, c_rarg2); // signed ? min_jint : max_jint | |
725 __ movl(c_rarg3, 0x80000000); | |
726 __ movl(rax, 0x7fffffff); | |
727 __ cmovl(Assembler::positive, c_rarg3, rax); | |
728 | |
729 __ bind(L); | |
304 | 730 __ movptr(inout, c_rarg3); |
731 | |
732 __ pop(c_rarg1); | |
733 __ pop(c_rarg2); | |
734 __ pop(c_rarg3); | |
735 __ pop(rax); | |
0 | 736 |
737 __ ret(0); | |
738 | |
739 return start; | |
740 } | |
741 | |
742 address generate_f2l_fixup() { | |
743 StubCodeMark mark(this, "StubRoutines", "f2l_fixup"); | |
744 Address inout(rsp, 5 * wordSize); // return address + 4 saves | |
745 address start = __ pc(); | |
746 | |
747 Label L; | |
748 | |
304 | 749 __ push(rax); |
750 __ push(c_rarg3); | |
751 __ push(c_rarg2); | |
752 __ push(c_rarg1); | |
0 | 753 |
754 __ movl(rax, 0x7f800000); | |
755 __ xorl(c_rarg3, c_rarg3); | |
756 __ movl(c_rarg2, inout); | |
757 __ movl(c_rarg1, c_rarg2); | |
758 __ andl(c_rarg1, 0x7fffffff); | |
759 __ cmpl(rax, c_rarg1); // NaN? -> 0 | |
760 __ jcc(Assembler::negative, L); | |
761 __ testl(c_rarg2, c_rarg2); // signed ? min_jlong : max_jlong | |
762 __ mov64(c_rarg3, 0x8000000000000000); | |
763 __ mov64(rax, 0x7fffffffffffffff); | |
304 | 764 __ cmov(Assembler::positive, c_rarg3, rax); |
0 | 765 |
766 __ bind(L); | |
304 | 767 __ movptr(inout, c_rarg3); |
768 | |
769 __ pop(c_rarg1); | |
770 __ pop(c_rarg2); | |
771 __ pop(c_rarg3); | |
772 __ pop(rax); | |
0 | 773 |
774 __ ret(0); | |
775 | |
776 return start; | |
777 } | |
778 | |
779 address generate_d2i_fixup() { | |
780 StubCodeMark mark(this, "StubRoutines", "d2i_fixup"); | |
781 Address inout(rsp, 6 * wordSize); // return address + 5 saves | |
782 | |
783 address start = __ pc(); | |
784 | |
785 Label L; | |
786 | |
304 | 787 __ push(rax); |
788 __ push(c_rarg3); | |
789 __ push(c_rarg2); | |
790 __ push(c_rarg1); | |
791 __ push(c_rarg0); | |
0 | 792 |
793 __ movl(rax, 0x7ff00000); | |
794 __ movq(c_rarg2, inout); | |
795 __ movl(c_rarg3, c_rarg2); | |
304 | 796 __ mov(c_rarg1, c_rarg2); |
797 __ mov(c_rarg0, c_rarg2); | |
0 | 798 __ negl(c_rarg3); |
304 | 799 __ shrptr(c_rarg1, 0x20); |
0 | 800 __ orl(c_rarg3, c_rarg2); |
801 __ andl(c_rarg1, 0x7fffffff); | |
802 __ xorl(c_rarg2, c_rarg2); | |
803 __ shrl(c_rarg3, 0x1f); | |
804 __ orl(c_rarg1, c_rarg3); | |
805 __ cmpl(rax, c_rarg1); | |
806 __ jcc(Assembler::negative, L); // NaN -> 0 | |
304 | 807 __ testptr(c_rarg0, c_rarg0); // signed ? min_jint : max_jint |
0 | 808 __ movl(c_rarg2, 0x80000000); |
809 __ movl(rax, 0x7fffffff); | |
304 | 810 __ cmov(Assembler::positive, c_rarg2, rax); |
0 | 811 |
812 __ bind(L); | |
304 | 813 __ movptr(inout, c_rarg2); |
814 | |
815 __ pop(c_rarg0); | |
816 __ pop(c_rarg1); | |
817 __ pop(c_rarg2); | |
818 __ pop(c_rarg3); | |
819 __ pop(rax); | |
0 | 820 |
821 __ ret(0); | |
822 | |
823 return start; | |
824 } | |
825 | |
826 address generate_d2l_fixup() { | |
827 StubCodeMark mark(this, "StubRoutines", "d2l_fixup"); | |
828 Address inout(rsp, 6 * wordSize); // return address + 5 saves | |
829 | |
830 address start = __ pc(); | |
831 | |
832 Label L; | |
833 | |
304 | 834 __ push(rax); |
835 __ push(c_rarg3); | |
836 __ push(c_rarg2); | |
837 __ push(c_rarg1); | |
838 __ push(c_rarg0); | |
0 | 839 |
840 __ movl(rax, 0x7ff00000); | |
841 __ movq(c_rarg2, inout); | |
842 __ movl(c_rarg3, c_rarg2); | |
304 | 843 __ mov(c_rarg1, c_rarg2); |
844 __ mov(c_rarg0, c_rarg2); | |
0 | 845 __ negl(c_rarg3); |
304 | 846 __ shrptr(c_rarg1, 0x20); |
0 | 847 __ orl(c_rarg3, c_rarg2); |
848 __ andl(c_rarg1, 0x7fffffff); | |
849 __ xorl(c_rarg2, c_rarg2); | |
850 __ shrl(c_rarg3, 0x1f); | |
851 __ orl(c_rarg1, c_rarg3); | |
852 __ cmpl(rax, c_rarg1); | |
853 __ jcc(Assembler::negative, L); // NaN -> 0 | |
854 __ testq(c_rarg0, c_rarg0); // signed ? min_jlong : max_jlong | |
855 __ mov64(c_rarg2, 0x8000000000000000); | |
856 __ mov64(rax, 0x7fffffffffffffff); | |
857 __ cmovq(Assembler::positive, c_rarg2, rax); | |
858 | |
859 __ bind(L); | |
860 __ movq(inout, c_rarg2); | |
861 | |
304 | 862 __ pop(c_rarg0); |
863 __ pop(c_rarg1); | |
864 __ pop(c_rarg2); | |
865 __ pop(c_rarg3); | |
866 __ pop(rax); | |
0 | 867 |
868 __ ret(0); | |
869 | |
870 return start; | |
871 } | |
872 | |
873 address generate_fp_mask(const char *stub_name, int64_t mask) { | |
1365 | 874 __ align(CodeEntryAlignment); |
0 | 875 StubCodeMark mark(this, "StubRoutines", stub_name); |
876 address start = __ pc(); | |
877 | |
878 __ emit_data64( mask, relocInfo::none ); | |
879 __ emit_data64( mask, relocInfo::none ); | |
880 | |
881 return start; | |
882 } | |
883 | |
884 // The following routine generates a subroutine to throw an | |
885 // asynchronous UnknownError when an unsafe access gets a fault that | |
886 // could not be reasonably prevented by the programmer. (Example: | |
887 // SIGBUS/OBJERR.) | |
888 address generate_handler_for_unsafe_access() { | |
889 StubCodeMark mark(this, "StubRoutines", "handler_for_unsafe_access"); | |
890 address start = __ pc(); | |
891 | |
304 | 892 __ push(0); // hole for return address-to-be |
893 __ pusha(); // push registers | |
0 | 894 Address next_pc(rsp, RegisterImpl::number_of_registers * BytesPerWord); |
895 | |
304 | 896 __ subptr(rsp, frame::arg_reg_save_area_bytes); |
0 | 897 BLOCK_COMMENT("call handle_unsafe_access"); |
898 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, handle_unsafe_access))); | |
304 | 899 __ addptr(rsp, frame::arg_reg_save_area_bytes); |
900 | |
901 __ movptr(next_pc, rax); // stuff next address | |
902 __ popa(); | |
0 | 903 __ ret(0); // jump to next address |
904 | |
905 return start; | |
906 } | |
907 | |
908 // Non-destructive plausibility checks for oops | |
909 // | |
910 // Arguments: | |
911 // all args on stack! | |
912 // | |
913 // Stack after saving c_rarg3: | |
914 // [tos + 0]: saved c_rarg3 | |
915 // [tos + 1]: saved c_rarg2 | |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
916 // [tos + 2]: saved r12 (several TemplateTable methods use it) |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
917 // [tos + 3]: saved flags |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
918 // [tos + 4]: return address |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
919 // * [tos + 5]: error message (char*) |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
920 // * [tos + 6]: object to verify (oop) |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
921 // * [tos + 7]: saved rax - saved by caller and bashed |
0 | 922 // * = popped on exit |
923 address generate_verify_oop() { | |
924 StubCodeMark mark(this, "StubRoutines", "verify_oop"); | |
925 address start = __ pc(); | |
926 | |
927 Label exit, error; | |
928 | |
304 | 929 __ pushf(); |
0 | 930 __ incrementl(ExternalAddress((address) StubRoutines::verify_oop_count_addr())); |
931 | |
304 | 932 __ push(r12); |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
933 |
0 | 934 // save c_rarg2 and c_rarg3 |
304 | 935 __ push(c_rarg2); |
936 __ push(c_rarg3); | |
0 | 937 |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
938 enum { |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
939 // After previous pushes. |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
940 oop_to_verify = 6 * wordSize, |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
941 saved_rax = 7 * wordSize, |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
942 |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
943 // Before the call to MacroAssembler::debug(), see below. |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
944 return_addr = 16 * wordSize, |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
945 error_msg = 17 * wordSize |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
946 }; |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
947 |
0 | 948 // get object |
304 | 949 __ movptr(rax, Address(rsp, oop_to_verify)); |
0 | 950 |
951 // make sure object is 'reasonable' | |
304 | 952 __ testptr(rax, rax); |
0 | 953 __ jcc(Assembler::zero, exit); // if obj is NULL it is OK |
954 // Check if the oop is in the right area of memory | |
304 | 955 __ movptr(c_rarg2, rax); |
512
db4caa99ef11
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
405
diff
changeset
|
956 __ movptr(c_rarg3, (intptr_t) Universe::verify_oop_mask()); |
304 | 957 __ andptr(c_rarg2, c_rarg3); |
512
db4caa99ef11
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
405
diff
changeset
|
958 __ movptr(c_rarg3, (intptr_t) Universe::verify_oop_bits()); |
304 | 959 __ cmpptr(c_rarg2, c_rarg3); |
0 | 960 __ jcc(Assembler::notZero, error); |
961 | |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
962 // set r12 to heapbase for load_klass() |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
963 __ reinit_heapbase(); |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
964 |
0 | 965 // make sure klass is 'reasonable' |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
966 __ load_klass(rax, rax); // get klass |
304 | 967 __ testptr(rax, rax); |
0 | 968 __ jcc(Assembler::zero, error); // if klass is NULL it is broken |
969 // Check if the klass is in the right area of memory | |
304 | 970 __ mov(c_rarg2, rax); |
512
db4caa99ef11
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
405
diff
changeset
|
971 __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_mask()); |
304 | 972 __ andptr(c_rarg2, c_rarg3); |
512
db4caa99ef11
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
405
diff
changeset
|
973 __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_bits()); |
304 | 974 __ cmpptr(c_rarg2, c_rarg3); |
0 | 975 __ jcc(Assembler::notZero, error); |
976 | |
977 // make sure klass' klass is 'reasonable' | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
978 __ load_klass(rax, rax); |
304 | 979 __ testptr(rax, rax); |
0 | 980 __ jcc(Assembler::zero, error); // if klass' klass is NULL it is broken |
981 // Check if the klass' klass is in the right area of memory | |
512
db4caa99ef11
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
405
diff
changeset
|
982 __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_mask()); |
304 | 983 __ andptr(rax, c_rarg3); |
512
db4caa99ef11
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
405
diff
changeset
|
984 __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_bits()); |
304 | 985 __ cmpptr(rax, c_rarg3); |
0 | 986 __ jcc(Assembler::notZero, error); |
987 | |
988 // return if everything seems ok | |
989 __ bind(exit); | |
304 | 990 __ movptr(rax, Address(rsp, saved_rax)); // get saved rax back |
991 __ pop(c_rarg3); // restore c_rarg3 | |
992 __ pop(c_rarg2); // restore c_rarg2 | |
993 __ pop(r12); // restore r12 | |
994 __ popf(); // restore flags | |
0 | 995 __ ret(3 * wordSize); // pop caller saved stuff |
996 | |
997 // handle errors | |
998 __ bind(error); | |
304 | 999 __ movptr(rax, Address(rsp, saved_rax)); // get saved rax back |
1000 __ pop(c_rarg3); // get saved c_rarg3 back | |
1001 __ pop(c_rarg2); // get saved c_rarg2 back | |
1002 __ pop(r12); // get saved r12 back | |
1003 __ popf(); // get saved flags off stack -- | |
0 | 1004 // will be ignored |
1005 | |
304 | 1006 __ pusha(); // push registers |
0 | 1007 // (rip is already |
1008 // already pushed) | |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1009 // debug(char* msg, int64_t pc, int64_t regs[]) |
0 | 1010 // We've popped the registers we'd saved (c_rarg3, c_rarg2 and flags), and |
1011 // pushed all the registers, so now the stack looks like: | |
1012 // [tos + 0] 16 saved registers | |
1013 // [tos + 16] return address | |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1014 // * [tos + 17] error message (char*) |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1015 // * [tos + 18] object to verify (oop) |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1016 // * [tos + 19] saved rax - saved by caller and bashed |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1017 // * = popped on exit |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1018 |
304 | 1019 __ movptr(c_rarg0, Address(rsp, error_msg)); // pass address of error message |
1020 __ movptr(c_rarg1, Address(rsp, return_addr)); // pass return address | |
1021 __ movq(c_rarg2, rsp); // pass address of regs on stack | |
1022 __ mov(r12, rsp); // remember rsp | |
1023 __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows | |
1024 __ andptr(rsp, -16); // align stack as required by ABI | |
0 | 1025 BLOCK_COMMENT("call MacroAssembler::debug"); |
304 | 1026 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, MacroAssembler::debug64))); |
1027 __ mov(rsp, r12); // restore rsp | |
1028 __ popa(); // pop registers (includes r12) | |
1029 __ ret(3 * wordSize); // pop caller saved stuff | |
0 | 1030 |
1031 return start; | |
1032 } | |
1033 | |
1034 static address disjoint_byte_copy_entry; | |
1035 static address disjoint_short_copy_entry; | |
1036 static address disjoint_int_copy_entry; | |
1037 static address disjoint_long_copy_entry; | |
1038 static address disjoint_oop_copy_entry; | |
1039 | |
1040 static address byte_copy_entry; | |
1041 static address short_copy_entry; | |
1042 static address int_copy_entry; | |
1043 static address long_copy_entry; | |
1044 static address oop_copy_entry; | |
1045 | |
1046 static address checkcast_copy_entry; | |
1047 | |
1048 // | |
1049 // Verify that a register contains clean 32-bits positive value | |
1050 // (high 32-bits are 0) so it could be used in 64-bits shifts. | |
1051 // | |
1052 // Input: | |
1053 // Rint - 32-bits value | |
1054 // Rtmp - scratch | |
1055 // | |
1056 void assert_clean_int(Register Rint, Register Rtmp) { | |
1057 #ifdef ASSERT | |
1058 Label L; | |
1059 assert_different_registers(Rtmp, Rint); | |
1060 __ movslq(Rtmp, Rint); | |
1061 __ cmpq(Rtmp, Rint); | |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
1062 __ jcc(Assembler::equal, L); |
0 | 1063 __ stop("high 32-bits of int value are not 0"); |
1064 __ bind(L); | |
1065 #endif | |
1066 } | |
1067 | |
1068 // Generate overlap test for array copy stubs | |
1069 // | |
1070 // Input: | |
1071 // c_rarg0 - from | |
1072 // c_rarg1 - to | |
1073 // c_rarg2 - element count | |
1074 // | |
1075 // Output: | |
1076 // rax - &from[element count - 1] | |
1077 // | |
1078 void array_overlap_test(address no_overlap_target, Address::ScaleFactor sf) { | |
1079 assert(no_overlap_target != NULL, "must be generated"); | |
1080 array_overlap_test(no_overlap_target, NULL, sf); | |
1081 } | |
1082 void array_overlap_test(Label& L_no_overlap, Address::ScaleFactor sf) { | |
1083 array_overlap_test(NULL, &L_no_overlap, sf); | |
1084 } | |
1085 void array_overlap_test(address no_overlap_target, Label* NOLp, Address::ScaleFactor sf) { | |
1086 const Register from = c_rarg0; | |
1087 const Register to = c_rarg1; | |
1088 const Register count = c_rarg2; | |
1089 const Register end_from = rax; | |
1090 | |
304 | 1091 __ cmpptr(to, from); |
1092 __ lea(end_from, Address(from, count, sf, 0)); | |
0 | 1093 if (NOLp == NULL) { |
1094 ExternalAddress no_overlap(no_overlap_target); | |
1095 __ jump_cc(Assembler::belowEqual, no_overlap); | |
304 | 1096 __ cmpptr(to, end_from); |
0 | 1097 __ jump_cc(Assembler::aboveEqual, no_overlap); |
1098 } else { | |
1099 __ jcc(Assembler::belowEqual, (*NOLp)); | |
304 | 1100 __ cmpptr(to, end_from); |
0 | 1101 __ jcc(Assembler::aboveEqual, (*NOLp)); |
1102 } | |
1103 } | |
1104 | |
1105 // Shuffle first three arg regs on Windows into Linux/Solaris locations. | |
1106 // | |
1107 // Outputs: | |
1108 // rdi - rcx | |
1109 // rsi - rdx | |
1110 // rdx - r8 | |
1111 // rcx - r9 | |
1112 // | |
1113 // Registers r9 and r10 are used to save rdi and rsi on Windows, which latter | |
1114 // are non-volatile. r9 and r10 should not be used by the caller. | |
1115 // | |
1116 void setup_arg_regs(int nargs = 3) { | |
1117 const Register saved_rdi = r9; | |
1118 const Register saved_rsi = r10; | |
1119 assert(nargs == 3 || nargs == 4, "else fix"); | |
1120 #ifdef _WIN64 | |
1121 assert(c_rarg0 == rcx && c_rarg1 == rdx && c_rarg2 == r8 && c_rarg3 == r9, | |
1122 "unexpected argument registers"); | |
1123 if (nargs >= 4) | |
304 | 1124 __ mov(rax, r9); // r9 is also saved_rdi |
1125 __ movptr(saved_rdi, rdi); | |
1126 __ movptr(saved_rsi, rsi); | |
1127 __ mov(rdi, rcx); // c_rarg0 | |
1128 __ mov(rsi, rdx); // c_rarg1 | |
1129 __ mov(rdx, r8); // c_rarg2 | |
0 | 1130 if (nargs >= 4) |
304 | 1131 __ mov(rcx, rax); // c_rarg3 (via rax) |
0 | 1132 #else |
1133 assert(c_rarg0 == rdi && c_rarg1 == rsi && c_rarg2 == rdx && c_rarg3 == rcx, | |
1134 "unexpected argument registers"); | |
1135 #endif | |
1136 } | |
1137 | |
1138 void restore_arg_regs() { | |
1139 const Register saved_rdi = r9; | |
1140 const Register saved_rsi = r10; | |
1141 #ifdef _WIN64 | |
304 | 1142 __ movptr(rdi, saved_rdi); |
1143 __ movptr(rsi, saved_rsi); | |
0 | 1144 #endif |
1145 } | |
1146 | |
1147 // Generate code for an array write pre barrier | |
1148 // | |
1149 // addr - starting address | |
1150 // count - element count | |
1151 // | |
1152 // Destroy no registers! | |
1153 // | |
1154 void gen_write_ref_array_pre_barrier(Register addr, Register count) { | |
1155 BarrierSet* bs = Universe::heap()->barrier_set(); | |
1156 switch (bs->kind()) { | |
1157 case BarrierSet::G1SATBCT: | |
1158 case BarrierSet::G1SATBCTLogging: | |
1159 { | |
304 | 1160 __ pusha(); // push registers |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
124
diff
changeset
|
1161 if (count == c_rarg0) { |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
124
diff
changeset
|
1162 if (addr == c_rarg1) { |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
124
diff
changeset
|
1163 // exactly backwards!! |
362 | 1164 __ xchgptr(c_rarg1, c_rarg0); |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
124
diff
changeset
|
1165 } else { |
362 | 1166 __ movptr(c_rarg1, count); |
1167 __ movptr(c_rarg0, addr); | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
124
diff
changeset
|
1168 } |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
124
diff
changeset
|
1169 |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
124
diff
changeset
|
1170 } else { |
362 | 1171 __ movptr(c_rarg0, addr); |
1172 __ movptr(c_rarg1, count); | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
124
diff
changeset
|
1173 } |
1192
776fb94f33cc
6918006: G1: spill space must be reserved on the stack for barrier calls on Windows x64
apetrusenko
parents:
1174
diff
changeset
|
1174 __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre), 2); |
304 | 1175 __ popa(); |
0 | 1176 } |
1177 break; | |
1178 case BarrierSet::CardTableModRef: | |
1179 case BarrierSet::CardTableExtension: | |
1180 case BarrierSet::ModRef: | |
1181 break; | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
124
diff
changeset
|
1182 default: |
0 | 1183 ShouldNotReachHere(); |
1184 | |
1185 } | |
1186 } | |
1187 | |
1188 // | |
1189 // Generate code for an array write post barrier | |
1190 // | |
1191 // Input: | |
1192 // start - register containing starting address of destination array | |
1193 // end - register containing ending address of destination array | |
1194 // scratch - scratch register | |
1195 // | |
1196 // The input registers are overwritten. | |
1197 // The ending address is inclusive. | |
1198 void gen_write_ref_array_post_barrier(Register start, Register end, Register scratch) { | |
1199 assert_different_registers(start, end, scratch); | |
1200 BarrierSet* bs = Universe::heap()->barrier_set(); | |
1201 switch (bs->kind()) { | |
1202 case BarrierSet::G1SATBCT: | |
1203 case BarrierSet::G1SATBCTLogging: | |
1204 | |
1205 { | |
304 | 1206 __ pusha(); // push registers (overkill) |
0 | 1207 // must compute element count unless barrier set interface is changed (other platforms supply count) |
1208 assert_different_registers(start, end, scratch); | |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
671
diff
changeset
|
1209 __ lea(scratch, Address(end, BytesPerHeapOop)); |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
671
diff
changeset
|
1210 __ subptr(scratch, start); // subtract start to get #bytes |
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
671
diff
changeset
|
1211 __ shrptr(scratch, LogBytesPerHeapOop); // convert to element count |
304 | 1212 __ mov(c_rarg0, start); |
1213 __ mov(c_rarg1, scratch); | |
1192
776fb94f33cc
6918006: G1: spill space must be reserved on the stack for barrier calls on Windows x64
apetrusenko
parents:
1174
diff
changeset
|
1214 __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post), 2); |
304 | 1215 __ popa(); |
0 | 1216 } |
1217 break; | |
1218 case BarrierSet::CardTableModRef: | |
1219 case BarrierSet::CardTableExtension: | |
1220 { | |
1221 CardTableModRefBS* ct = (CardTableModRefBS*)bs; | |
1222 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); | |
1223 | |
1224 Label L_loop; | |
1225 | |
304 | 1226 __ shrptr(start, CardTableModRefBS::card_shift); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
671
diff
changeset
|
1227 __ addptr(end, BytesPerHeapOop); |
304 | 1228 __ shrptr(end, CardTableModRefBS::card_shift); |
1229 __ subptr(end, start); // number of bytes to copy | |
0 | 1230 |
249
910a4cb98e9e
6717457: Internal Error (src/share/vm/code/relocInfo.hpp:1089)
never
parents:
196
diff
changeset
|
1231 intptr_t disp = (intptr_t) ct->byte_map_base; |
910a4cb98e9e
6717457: Internal Error (src/share/vm/code/relocInfo.hpp:1089)
never
parents:
196
diff
changeset
|
1232 if (__ is_simm32(disp)) { |
910a4cb98e9e
6717457: Internal Error (src/share/vm/code/relocInfo.hpp:1089)
never
parents:
196
diff
changeset
|
1233 Address cardtable(noreg, noreg, Address::no_scale, disp); |
910a4cb98e9e
6717457: Internal Error (src/share/vm/code/relocInfo.hpp:1089)
never
parents:
196
diff
changeset
|
1234 __ lea(scratch, cardtable); |
910a4cb98e9e
6717457: Internal Error (src/share/vm/code/relocInfo.hpp:1089)
never
parents:
196
diff
changeset
|
1235 } else { |
910a4cb98e9e
6717457: Internal Error (src/share/vm/code/relocInfo.hpp:1089)
never
parents:
196
diff
changeset
|
1236 ExternalAddress cardtable((address)disp); |
910a4cb98e9e
6717457: Internal Error (src/share/vm/code/relocInfo.hpp:1089)
never
parents:
196
diff
changeset
|
1237 __ lea(scratch, cardtable); |
910a4cb98e9e
6717457: Internal Error (src/share/vm/code/relocInfo.hpp:1089)
never
parents:
196
diff
changeset
|
1238 } |
910a4cb98e9e
6717457: Internal Error (src/share/vm/code/relocInfo.hpp:1089)
never
parents:
196
diff
changeset
|
1239 |
0 | 1240 const Register count = end; // 'end' register contains bytes count now |
304 | 1241 __ addptr(start, scratch); |
0 | 1242 __ BIND(L_loop); |
1243 __ movb(Address(start, count, Address::times_1), 0); | |
304 | 1244 __ decrement(count); |
0 | 1245 __ jcc(Assembler::greaterEqual, L_loop); |
1246 } | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
124
diff
changeset
|
1247 break; |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
124
diff
changeset
|
1248 default: |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
124
diff
changeset
|
1249 ShouldNotReachHere(); |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
124
diff
changeset
|
1250 |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
124
diff
changeset
|
1251 } |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
124
diff
changeset
|
1252 } |
0 | 1253 |
405 | 1254 |
0 | 1255 // Copy big chunks forward |
1256 // | |
1257 // Inputs: | |
1258 // end_from - source arrays end address | |
1259 // end_to - destination array end address | |
1260 // qword_count - 64-bits element count, negative | |
1261 // to - scratch | |
1262 // L_copy_32_bytes - entry label | |
1263 // L_copy_8_bytes - exit label | |
1264 // | |
1265 void copy_32_bytes_forward(Register end_from, Register end_to, | |
1266 Register qword_count, Register to, | |
1267 Label& L_copy_32_bytes, Label& L_copy_8_bytes) { | |
1268 DEBUG_ONLY(__ stop("enter at entry label, not here")); | |
1269 Label L_loop; | |
1365 | 1270 __ align(OptoLoopAlignment); |
0 | 1271 __ BIND(L_loop); |
405 | 1272 if(UseUnalignedLoadStores) { |
1273 __ movdqu(xmm0, Address(end_from, qword_count, Address::times_8, -24)); | |
1274 __ movdqu(Address(end_to, qword_count, Address::times_8, -24), xmm0); | |
1275 __ movdqu(xmm1, Address(end_from, qword_count, Address::times_8, - 8)); | |
1276 __ movdqu(Address(end_to, qword_count, Address::times_8, - 8), xmm1); | |
1277 | |
1278 } else { | |
1279 __ movq(to, Address(end_from, qword_count, Address::times_8, -24)); | |
1280 __ movq(Address(end_to, qword_count, Address::times_8, -24), to); | |
1281 __ movq(to, Address(end_from, qword_count, Address::times_8, -16)); | |
1282 __ movq(Address(end_to, qword_count, Address::times_8, -16), to); | |
1283 __ movq(to, Address(end_from, qword_count, Address::times_8, - 8)); | |
1284 __ movq(Address(end_to, qword_count, Address::times_8, - 8), to); | |
1285 __ movq(to, Address(end_from, qword_count, Address::times_8, - 0)); | |
1286 __ movq(Address(end_to, qword_count, Address::times_8, - 0), to); | |
1287 } | |
0 | 1288 __ BIND(L_copy_32_bytes); |
304 | 1289 __ addptr(qword_count, 4); |
0 | 1290 __ jcc(Assembler::lessEqual, L_loop); |
304 | 1291 __ subptr(qword_count, 4); |
0 | 1292 __ jcc(Assembler::less, L_copy_8_bytes); // Copy trailing qwords |
1293 } | |
1294 | |
1295 | |
1296 // Copy big chunks backward | |
1297 // | |
1298 // Inputs: | |
1299 // from - source arrays address | |
1300 // dest - destination array address | |
1301 // qword_count - 64-bits element count | |
1302 // to - scratch | |
1303 // L_copy_32_bytes - entry label | |
1304 // L_copy_8_bytes - exit label | |
1305 // | |
1306 void copy_32_bytes_backward(Register from, Register dest, | |
1307 Register qword_count, Register to, | |
1308 Label& L_copy_32_bytes, Label& L_copy_8_bytes) { | |
1309 DEBUG_ONLY(__ stop("enter at entry label, not here")); | |
1310 Label L_loop; | |
1365 | 1311 __ align(OptoLoopAlignment); |
0 | 1312 __ BIND(L_loop); |
405 | 1313 if(UseUnalignedLoadStores) { |
1314 __ movdqu(xmm0, Address(from, qword_count, Address::times_8, 16)); | |
1315 __ movdqu(Address(dest, qword_count, Address::times_8, 16), xmm0); | |
1316 __ movdqu(xmm1, Address(from, qword_count, Address::times_8, 0)); | |
1317 __ movdqu(Address(dest, qword_count, Address::times_8, 0), xmm1); | |
1318 | |
1319 } else { | |
1320 __ movq(to, Address(from, qword_count, Address::times_8, 24)); | |
1321 __ movq(Address(dest, qword_count, Address::times_8, 24), to); | |
1322 __ movq(to, Address(from, qword_count, Address::times_8, 16)); | |
1323 __ movq(Address(dest, qword_count, Address::times_8, 16), to); | |
1324 __ movq(to, Address(from, qword_count, Address::times_8, 8)); | |
1325 __ movq(Address(dest, qword_count, Address::times_8, 8), to); | |
1326 __ movq(to, Address(from, qword_count, Address::times_8, 0)); | |
1327 __ movq(Address(dest, qword_count, Address::times_8, 0), to); | |
1328 } | |
0 | 1329 __ BIND(L_copy_32_bytes); |
304 | 1330 __ subptr(qword_count, 4); |
0 | 1331 __ jcc(Assembler::greaterEqual, L_loop); |
304 | 1332 __ addptr(qword_count, 4); |
0 | 1333 __ jcc(Assembler::greater, L_copy_8_bytes); // Copy trailing qwords |
1334 } | |
1335 | |
1336 | |
1337 // Arguments: | |
1338 // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary | |
1339 // ignored | |
1340 // name - stub name string | |
1341 // | |
1342 // Inputs: | |
1343 // c_rarg0 - source array address | |
1344 // c_rarg1 - destination array address | |
1345 // c_rarg2 - element count, treated as ssize_t, can be zero | |
1346 // | |
1347 // If 'from' and/or 'to' are aligned on 4-, 2-, or 1-byte boundaries, | |
1348 // we let the hardware handle it. The one to eight bytes within words, | |
1349 // dwords or qwords that span cache line boundaries will still be loaded | |
1350 // and stored atomically. | |
1351 // | |
1352 // Side Effects: | |
1353 // disjoint_byte_copy_entry is set to the no-overlap entry point | |
1354 // used by generate_conjoint_byte_copy(). | |
1355 // | |
1356 address generate_disjoint_byte_copy(bool aligned, const char *name) { | |
1357 __ align(CodeEntryAlignment); | |
1358 StubCodeMark mark(this, "StubRoutines", name); | |
1359 address start = __ pc(); | |
1360 | |
1361 Label L_copy_32_bytes, L_copy_8_bytes, L_copy_4_bytes, L_copy_2_bytes; | |
1362 Label L_copy_byte, L_exit; | |
1363 const Register from = rdi; // source array address | |
1364 const Register to = rsi; // destination array address | |
1365 const Register count = rdx; // elements count | |
1366 const Register byte_count = rcx; | |
1367 const Register qword_count = count; | |
1368 const Register end_from = from; // source array end address | |
1369 const Register end_to = to; // destination array end address | |
1370 // End pointers are inclusive, and if count is not zero they point | |
1371 // to the last unit copied: end_to[0] := end_from[0] | |
1372 | |
1373 __ enter(); // required for proper stackwalking of RuntimeStub frame | |
1374 assert_clean_int(c_rarg2, rax); // Make sure 'count' is clean int. | |
1375 | |
1376 disjoint_byte_copy_entry = __ pc(); | |
1377 BLOCK_COMMENT("Entry:"); | |
1378 // caller can pass a 64-bit byte count here (from Unsafe.copyMemory) | |
1379 | |
1380 setup_arg_regs(); // from => rdi, to => rsi, count => rdx | |
1381 // r9 and r10 may be used to save non-volatile registers | |
1382 | |
1383 // 'from', 'to' and 'count' are now valid | |
304 | 1384 __ movptr(byte_count, count); |
1385 __ shrptr(count, 3); // count => qword_count | |
0 | 1386 |
1387 // Copy from low to high addresses. Use 'to' as scratch. | |
304 | 1388 __ lea(end_from, Address(from, qword_count, Address::times_8, -8)); |
1389 __ lea(end_to, Address(to, qword_count, Address::times_8, -8)); | |
1390 __ negptr(qword_count); // make the count negative | |
0 | 1391 __ jmp(L_copy_32_bytes); |
1392 | |
1393 // Copy trailing qwords | |
1394 __ BIND(L_copy_8_bytes); | |
1395 __ movq(rax, Address(end_from, qword_count, Address::times_8, 8)); | |
1396 __ movq(Address(end_to, qword_count, Address::times_8, 8), rax); | |
304 | 1397 __ increment(qword_count); |
0 | 1398 __ jcc(Assembler::notZero, L_copy_8_bytes); |
1399 | |
1400 // Check for and copy trailing dword | |
1401 __ BIND(L_copy_4_bytes); | |
304 | 1402 __ testl(byte_count, 4); |
0 | 1403 __ jccb(Assembler::zero, L_copy_2_bytes); |
1404 __ movl(rax, Address(end_from, 8)); | |
1405 __ movl(Address(end_to, 8), rax); | |
1406 | |
304 | 1407 __ addptr(end_from, 4); |
1408 __ addptr(end_to, 4); | |
0 | 1409 |
1410 // Check for and copy trailing word | |
1411 __ BIND(L_copy_2_bytes); | |
304 | 1412 __ testl(byte_count, 2); |
0 | 1413 __ jccb(Assembler::zero, L_copy_byte); |
1414 __ movw(rax, Address(end_from, 8)); | |
1415 __ movw(Address(end_to, 8), rax); | |
1416 | |
304 | 1417 __ addptr(end_from, 2); |
1418 __ addptr(end_to, 2); | |
0 | 1419 |
1420 // Check for and copy trailing byte | |
1421 __ BIND(L_copy_byte); | |
304 | 1422 __ testl(byte_count, 1); |
0 | 1423 __ jccb(Assembler::zero, L_exit); |
1424 __ movb(rax, Address(end_from, 8)); | |
1425 __ movb(Address(end_to, 8), rax); | |
1426 | |
1427 __ BIND(L_exit); | |
1428 inc_counter_np(SharedRuntime::_jbyte_array_copy_ctr); | |
1429 restore_arg_regs(); | |
304 | 1430 __ xorptr(rax, rax); // return 0 |
0 | 1431 __ leave(); // required for proper stackwalking of RuntimeStub frame |
1432 __ ret(0); | |
1433 | |
1434 // Copy in 32-bytes chunks | |
1435 copy_32_bytes_forward(end_from, end_to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes); | |
1436 __ jmp(L_copy_4_bytes); | |
1437 | |
1438 return start; | |
1439 } | |
1440 | |
1441 // Arguments: | |
1442 // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary | |
1443 // ignored | |
1444 // name - stub name string | |
1445 // | |
1446 // Inputs: | |
1447 // c_rarg0 - source array address | |
1448 // c_rarg1 - destination array address | |
1449 // c_rarg2 - element count, treated as ssize_t, can be zero | |
1450 // | |
1451 // If 'from' and/or 'to' are aligned on 4-, 2-, or 1-byte boundaries, | |
1452 // we let the hardware handle it. The one to eight bytes within words, | |
1453 // dwords or qwords that span cache line boundaries will still be loaded | |
1454 // and stored atomically. | |
1455 // | |
1456 address generate_conjoint_byte_copy(bool aligned, const char *name) { | |
1457 __ align(CodeEntryAlignment); | |
1458 StubCodeMark mark(this, "StubRoutines", name); | |
1459 address start = __ pc(); | |
1460 | |
1461 Label L_copy_32_bytes, L_copy_8_bytes, L_copy_4_bytes, L_copy_2_bytes; | |
1462 const Register from = rdi; // source array address | |
1463 const Register to = rsi; // destination array address | |
1464 const Register count = rdx; // elements count | |
1465 const Register byte_count = rcx; | |
1466 const Register qword_count = count; | |
1467 | |
1468 __ enter(); // required for proper stackwalking of RuntimeStub frame | |
1469 assert_clean_int(c_rarg2, rax); // Make sure 'count' is clean int. | |
1470 | |
1471 byte_copy_entry = __ pc(); | |
1472 BLOCK_COMMENT("Entry:"); | |
1473 // caller can pass a 64-bit byte count here (from Unsafe.copyMemory) | |
1474 | |
1475 array_overlap_test(disjoint_byte_copy_entry, Address::times_1); | |
1476 setup_arg_regs(); // from => rdi, to => rsi, count => rdx | |
1477 // r9 and r10 may be used to save non-volatile registers | |
1478 | |
1479 // 'from', 'to' and 'count' are now valid | |
304 | 1480 __ movptr(byte_count, count); |
1481 __ shrptr(count, 3); // count => qword_count | |
0 | 1482 |
1483 // Copy from high to low addresses. | |
1484 | |
1485 // Check for and copy trailing byte | |
304 | 1486 __ testl(byte_count, 1); |
0 | 1487 __ jcc(Assembler::zero, L_copy_2_bytes); |
1488 __ movb(rax, Address(from, byte_count, Address::times_1, -1)); | |
1489 __ movb(Address(to, byte_count, Address::times_1, -1), rax); | |
304 | 1490 __ decrement(byte_count); // Adjust for possible trailing word |
0 | 1491 |
1492 // Check for and copy trailing word | |
1493 __ BIND(L_copy_2_bytes); | |
304 | 1494 __ testl(byte_count, 2); |
0 | 1495 __ jcc(Assembler::zero, L_copy_4_bytes); |
1496 __ movw(rax, Address(from, byte_count, Address::times_1, -2)); | |
1497 __ movw(Address(to, byte_count, Address::times_1, -2), rax); | |
1498 | |
1499 // Check for and copy trailing dword | |
1500 __ BIND(L_copy_4_bytes); | |
304 | 1501 __ testl(byte_count, 4); |
0 | 1502 __ jcc(Assembler::zero, L_copy_32_bytes); |
1503 __ movl(rax, Address(from, qword_count, Address::times_8)); | |
1504 __ movl(Address(to, qword_count, Address::times_8), rax); | |
1505 __ jmp(L_copy_32_bytes); | |
1506 | |
1507 // Copy trailing qwords | |
1508 __ BIND(L_copy_8_bytes); | |
1509 __ movq(rax, Address(from, qword_count, Address::times_8, -8)); | |
1510 __ movq(Address(to, qword_count, Address::times_8, -8), rax); | |
304 | 1511 __ decrement(qword_count); |
0 | 1512 __ jcc(Assembler::notZero, L_copy_8_bytes); |
1513 | |
1514 inc_counter_np(SharedRuntime::_jbyte_array_copy_ctr); | |
1515 restore_arg_regs(); | |
304 | 1516 __ xorptr(rax, rax); // return 0 |
0 | 1517 __ leave(); // required for proper stackwalking of RuntimeStub frame |
1518 __ ret(0); | |
1519 | |
1520 // Copy in 32-bytes chunks | |
1521 copy_32_bytes_backward(from, to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes); | |
1522 | |
1523 inc_counter_np(SharedRuntime::_jbyte_array_copy_ctr); | |
1524 restore_arg_regs(); | |
304 | 1525 __ xorptr(rax, rax); // return 0 |
0 | 1526 __ leave(); // required for proper stackwalking of RuntimeStub frame |
1527 __ ret(0); | |
1528 | |
1529 return start; | |
1530 } | |
1531 | |
1532 // Arguments: | |
1533 // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary | |
1534 // ignored | |
1535 // name - stub name string | |
1536 // | |
1537 // Inputs: | |
1538 // c_rarg0 - source array address | |
1539 // c_rarg1 - destination array address | |
1540 // c_rarg2 - element count, treated as ssize_t, can be zero | |
1541 // | |
1542 // If 'from' and/or 'to' are aligned on 4- or 2-byte boundaries, we | |
1543 // let the hardware handle it. The two or four words within dwords | |
1544 // or qwords that span cache line boundaries will still be loaded | |
1545 // and stored atomically. | |
1546 // | |
1547 // Side Effects: | |
1548 // disjoint_short_copy_entry is set to the no-overlap entry point | |
1549 // used by generate_conjoint_short_copy(). | |
1550 // | |
1551 address generate_disjoint_short_copy(bool aligned, const char *name) { | |
1552 __ align(CodeEntryAlignment); | |
1553 StubCodeMark mark(this, "StubRoutines", name); | |
1554 address start = __ pc(); | |
1555 | |
1556 Label L_copy_32_bytes, L_copy_8_bytes, L_copy_4_bytes,L_copy_2_bytes,L_exit; | |
1557 const Register from = rdi; // source array address | |
1558 const Register to = rsi; // destination array address | |
1559 const Register count = rdx; // elements count | |
1560 const Register word_count = rcx; | |
1561 const Register qword_count = count; | |
1562 const Register end_from = from; // source array end address | |
1563 const Register end_to = to; // destination array end address | |
1564 // End pointers are inclusive, and if count is not zero they point | |
1565 // to the last unit copied: end_to[0] := end_from[0] | |
1566 | |
1567 __ enter(); // required for proper stackwalking of RuntimeStub frame | |
1568 assert_clean_int(c_rarg2, rax); // Make sure 'count' is clean int. | |
1569 | |
1570 disjoint_short_copy_entry = __ pc(); | |
1571 BLOCK_COMMENT("Entry:"); | |
1572 // caller can pass a 64-bit byte count here (from Unsafe.copyMemory) | |
1573 | |
1574 setup_arg_regs(); // from => rdi, to => rsi, count => rdx | |
1575 // r9 and r10 may be used to save non-volatile registers | |
1576 | |
1577 // 'from', 'to' and 'count' are now valid | |
304 | 1578 __ movptr(word_count, count); |
1579 __ shrptr(count, 2); // count => qword_count | |
0 | 1580 |
1581 // Copy from low to high addresses. Use 'to' as scratch. | |
304 | 1582 __ lea(end_from, Address(from, qword_count, Address::times_8, -8)); |
1583 __ lea(end_to, Address(to, qword_count, Address::times_8, -8)); | |
1584 __ negptr(qword_count); | |
0 | 1585 __ jmp(L_copy_32_bytes); |
1586 | |
1587 // Copy trailing qwords | |
1588 __ BIND(L_copy_8_bytes); | |
1589 __ movq(rax, Address(end_from, qword_count, Address::times_8, 8)); | |
1590 __ movq(Address(end_to, qword_count, Address::times_8, 8), rax); | |
304 | 1591 __ increment(qword_count); |
0 | 1592 __ jcc(Assembler::notZero, L_copy_8_bytes); |
1593 | |
1594 // Original 'dest' is trashed, so we can't use it as a | |
1595 // base register for a possible trailing word copy | |
1596 | |
1597 // Check for and copy trailing dword | |
1598 __ BIND(L_copy_4_bytes); | |
304 | 1599 __ testl(word_count, 2); |
0 | 1600 __ jccb(Assembler::zero, L_copy_2_bytes); |
1601 __ movl(rax, Address(end_from, 8)); | |
1602 __ movl(Address(end_to, 8), rax); | |
1603 | |
304 | 1604 __ addptr(end_from, 4); |
1605 __ addptr(end_to, 4); | |
0 | 1606 |
1607 // Check for and copy trailing word | |
1608 __ BIND(L_copy_2_bytes); | |
304 | 1609 __ testl(word_count, 1); |
0 | 1610 __ jccb(Assembler::zero, L_exit); |
1611 __ movw(rax, Address(end_from, 8)); | |
1612 __ movw(Address(end_to, 8), rax); | |
1613 | |
1614 __ BIND(L_exit); | |
1615 inc_counter_np(SharedRuntime::_jshort_array_copy_ctr); | |
1616 restore_arg_regs(); | |
304 | 1617 __ xorptr(rax, rax); // return 0 |
0 | 1618 __ leave(); // required for proper stackwalking of RuntimeStub frame |
1619 __ ret(0); | |
1620 | |
1621 // Copy in 32-bytes chunks | |
1622 copy_32_bytes_forward(end_from, end_to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes); | |
1623 __ jmp(L_copy_4_bytes); | |
1624 | |
1625 return start; | |
1626 } | |
1627 | |
1628 // Arguments: | |
1629 // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary | |
1630 // ignored | |
1631 // name - stub name string | |
1632 // | |
1633 // Inputs: | |
1634 // c_rarg0 - source array address | |
1635 // c_rarg1 - destination array address | |
1636 // c_rarg2 - element count, treated as ssize_t, can be zero | |
1637 // | |
1638 // If 'from' and/or 'to' are aligned on 4- or 2-byte boundaries, we | |
1639 // let the hardware handle it. The two or four words within dwords | |
1640 // or qwords that span cache line boundaries will still be loaded | |
1641 // and stored atomically. | |
1642 // | |
1643 address generate_conjoint_short_copy(bool aligned, const char *name) { | |
1644 __ align(CodeEntryAlignment); | |
1645 StubCodeMark mark(this, "StubRoutines", name); | |
1646 address start = __ pc(); | |
1647 | |
1648 Label L_copy_32_bytes, L_copy_8_bytes, L_copy_4_bytes; | |
1649 const Register from = rdi; // source array address | |
1650 const Register to = rsi; // destination array address | |
1651 const Register count = rdx; // elements count | |
1652 const Register word_count = rcx; | |
1653 const Register qword_count = count; | |
1654 | |
1655 __ enter(); // required for proper stackwalking of RuntimeStub frame | |
1656 assert_clean_int(c_rarg2, rax); // Make sure 'count' is clean int. | |
1657 | |
1658 short_copy_entry = __ pc(); | |
1659 BLOCK_COMMENT("Entry:"); | |
1660 // caller can pass a 64-bit byte count here (from Unsafe.copyMemory) | |
1661 | |
1662 array_overlap_test(disjoint_short_copy_entry, Address::times_2); | |
1663 setup_arg_regs(); // from => rdi, to => rsi, count => rdx | |
1664 // r9 and r10 may be used to save non-volatile registers | |
1665 | |
1666 // 'from', 'to' and 'count' are now valid | |
304 | 1667 __ movptr(word_count, count); |
1668 __ shrptr(count, 2); // count => qword_count | |
0 | 1669 |
1670 // Copy from high to low addresses. Use 'to' as scratch. | |
1671 | |
1672 // Check for and copy trailing word | |
304 | 1673 __ testl(word_count, 1); |
0 | 1674 __ jccb(Assembler::zero, L_copy_4_bytes); |
1675 __ movw(rax, Address(from, word_count, Address::times_2, -2)); | |
1676 __ movw(Address(to, word_count, Address::times_2, -2), rax); | |
1677 | |
1678 // Check for and copy trailing dword | |
1679 __ BIND(L_copy_4_bytes); | |
304 | 1680 __ testl(word_count, 2); |
0 | 1681 __ jcc(Assembler::zero, L_copy_32_bytes); |
1682 __ movl(rax, Address(from, qword_count, Address::times_8)); | |
1683 __ movl(Address(to, qword_count, Address::times_8), rax); | |
1684 __ jmp(L_copy_32_bytes); | |
1685 | |
1686 // Copy trailing qwords | |
1687 __ BIND(L_copy_8_bytes); | |
1688 __ movq(rax, Address(from, qword_count, Address::times_8, -8)); | |
1689 __ movq(Address(to, qword_count, Address::times_8, -8), rax); | |
304 | 1690 __ decrement(qword_count); |
0 | 1691 __ jcc(Assembler::notZero, L_copy_8_bytes); |
1692 | |
1693 inc_counter_np(SharedRuntime::_jshort_array_copy_ctr); | |
1694 restore_arg_regs(); | |
304 | 1695 __ xorptr(rax, rax); // return 0 |
0 | 1696 __ leave(); // required for proper stackwalking of RuntimeStub frame |
1697 __ ret(0); | |
1698 | |
1699 // Copy in 32-bytes chunks | |
1700 copy_32_bytes_backward(from, to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes); | |
1701 | |
1702 inc_counter_np(SharedRuntime::_jshort_array_copy_ctr); | |
1703 restore_arg_regs(); | |
304 | 1704 __ xorptr(rax, rax); // return 0 |
0 | 1705 __ leave(); // required for proper stackwalking of RuntimeStub frame |
1706 __ ret(0); | |
1707 | |
1708 return start; | |
1709 } | |
1710 | |
1711 // Arguments: | |
1712 // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary | |
1713 // ignored | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1714 // is_oop - true => oop array, so generate store check code |
0 | 1715 // name - stub name string |
1716 // | |
1717 // Inputs: | |
1718 // c_rarg0 - source array address | |
1719 // c_rarg1 - destination array address | |
1720 // c_rarg2 - element count, treated as ssize_t, can be zero | |
1721 // | |
1722 // If 'from' and/or 'to' are aligned on 4-byte boundaries, we let | |
1723 // the hardware handle it. The two dwords within qwords that span | |
1724 // cache line boundaries will still be loaded and stored atomicly. | |
1725 // | |
1726 // Side Effects: | |
1727 // disjoint_int_copy_entry is set to the no-overlap entry point | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1728 // used by generate_conjoint_int_oop_copy(). |
0 | 1729 // |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1730 address generate_disjoint_int_oop_copy(bool aligned, bool is_oop, const char *name) { |
0 | 1731 __ align(CodeEntryAlignment); |
1732 StubCodeMark mark(this, "StubRoutines", name); | |
1733 address start = __ pc(); | |
1734 | |
1735 Label L_copy_32_bytes, L_copy_8_bytes, L_copy_4_bytes, L_exit; | |
1736 const Register from = rdi; // source array address | |
1737 const Register to = rsi; // destination array address | |
1738 const Register count = rdx; // elements count | |
1739 const Register dword_count = rcx; | |
1740 const Register qword_count = count; | |
1741 const Register end_from = from; // source array end address | |
1742 const Register end_to = to; // destination array end address | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1743 const Register saved_to = r11; // saved destination array address |
0 | 1744 // End pointers are inclusive, and if count is not zero they point |
1745 // to the last unit copied: end_to[0] := end_from[0] | |
1746 | |
1747 __ enter(); // required for proper stackwalking of RuntimeStub frame | |
1748 assert_clean_int(c_rarg2, rax); // Make sure 'count' is clean int. | |
1749 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1750 (is_oop ? disjoint_oop_copy_entry : disjoint_int_copy_entry) = __ pc(); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1751 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1752 if (is_oop) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1753 // no registers are destroyed by this call |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1754 gen_write_ref_array_pre_barrier(/* dest */ c_rarg1, /* count */ c_rarg2); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1755 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1756 |
0 | 1757 BLOCK_COMMENT("Entry:"); |
1758 // caller can pass a 64-bit byte count here (from Unsafe.copyMemory) | |
1759 | |
1760 setup_arg_regs(); // from => rdi, to => rsi, count => rdx | |
1761 // r9 and r10 may be used to save non-volatile registers | |
1762 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1763 if (is_oop) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1764 __ movq(saved_to, to); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1765 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1766 |
0 | 1767 // 'from', 'to' and 'count' are now valid |
304 | 1768 __ movptr(dword_count, count); |
1769 __ shrptr(count, 1); // count => qword_count | |
0 | 1770 |
1771 // Copy from low to high addresses. Use 'to' as scratch. | |
304 | 1772 __ lea(end_from, Address(from, qword_count, Address::times_8, -8)); |
1773 __ lea(end_to, Address(to, qword_count, Address::times_8, -8)); | |
1774 __ negptr(qword_count); | |
0 | 1775 __ jmp(L_copy_32_bytes); |
1776 | |
1777 // Copy trailing qwords | |
1778 __ BIND(L_copy_8_bytes); | |
1779 __ movq(rax, Address(end_from, qword_count, Address::times_8, 8)); | |
1780 __ movq(Address(end_to, qword_count, Address::times_8, 8), rax); | |
304 | 1781 __ increment(qword_count); |
0 | 1782 __ jcc(Assembler::notZero, L_copy_8_bytes); |
1783 | |
1784 // Check for and copy trailing dword | |
1785 __ BIND(L_copy_4_bytes); | |
304 | 1786 __ testl(dword_count, 1); // Only byte test since the value is 0 or 1 |
0 | 1787 __ jccb(Assembler::zero, L_exit); |
1788 __ movl(rax, Address(end_from, 8)); | |
1789 __ movl(Address(end_to, 8), rax); | |
1790 | |
1791 __ BIND(L_exit); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1792 if (is_oop) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1793 __ leaq(end_to, Address(saved_to, dword_count, Address::times_4, -4)); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1794 gen_write_ref_array_post_barrier(saved_to, end_to, rax); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1795 } |
0 | 1796 inc_counter_np(SharedRuntime::_jint_array_copy_ctr); |
1797 restore_arg_regs(); | |
304 | 1798 __ xorptr(rax, rax); // return 0 |
0 | 1799 __ leave(); // required for proper stackwalking of RuntimeStub frame |
1800 __ ret(0); | |
1801 | |
1802 // Copy 32-bytes chunks | |
1803 copy_32_bytes_forward(end_from, end_to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes); | |
1804 __ jmp(L_copy_4_bytes); | |
1805 | |
1806 return start; | |
1807 } | |
1808 | |
1809 // Arguments: | |
1810 // aligned - true => Input and output aligned on a HeapWord == 8-byte boundary | |
1811 // ignored | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1812 // is_oop - true => oop array, so generate store check code |
0 | 1813 // name - stub name string |
1814 // | |
1815 // Inputs: | |
1816 // c_rarg0 - source array address | |
1817 // c_rarg1 - destination array address | |
1818 // c_rarg2 - element count, treated as ssize_t, can be zero | |
1819 // | |
1820 // If 'from' and/or 'to' are aligned on 4-byte boundaries, we let | |
1821 // the hardware handle it. The two dwords within qwords that span | |
1822 // cache line boundaries will still be loaded and stored atomicly. | |
1823 // | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1824 address generate_conjoint_int_oop_copy(bool aligned, bool is_oop, const char *name) { |
0 | 1825 __ align(CodeEntryAlignment); |
1826 StubCodeMark mark(this, "StubRoutines", name); | |
1827 address start = __ pc(); | |
1828 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1829 Label L_copy_32_bytes, L_copy_8_bytes, L_copy_2_bytes, L_exit; |
0 | 1830 const Register from = rdi; // source array address |
1831 const Register to = rsi; // destination array address | |
1832 const Register count = rdx; // elements count | |
1833 const Register dword_count = rcx; | |
1834 const Register qword_count = count; | |
1835 | |
1836 __ enter(); // required for proper stackwalking of RuntimeStub frame | |
1837 assert_clean_int(c_rarg2, rax); // Make sure 'count' is clean int. | |
1838 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1839 if (is_oop) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1840 // no registers are destroyed by this call |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1841 gen_write_ref_array_pre_barrier(/* dest */ c_rarg1, /* count */ c_rarg2); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1842 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1843 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1844 (is_oop ? oop_copy_entry : int_copy_entry) = __ pc(); |
0 | 1845 BLOCK_COMMENT("Entry:"); |
1846 // caller can pass a 64-bit byte count here (from Unsafe.copyMemory) | |
1847 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1848 array_overlap_test(is_oop ? disjoint_oop_copy_entry : disjoint_int_copy_entry, |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1849 Address::times_4); |
0 | 1850 setup_arg_regs(); // from => rdi, to => rsi, count => rdx |
1851 // r9 and r10 may be used to save non-volatile registers | |
1852 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1853 assert_clean_int(count, rax); // Make sure 'count' is clean int. |
0 | 1854 // 'from', 'to' and 'count' are now valid |
304 | 1855 __ movptr(dword_count, count); |
1856 __ shrptr(count, 1); // count => qword_count | |
0 | 1857 |
1858 // Copy from high to low addresses. Use 'to' as scratch. | |
1859 | |
1860 // Check for and copy trailing dword | |
304 | 1861 __ testl(dword_count, 1); |
0 | 1862 __ jcc(Assembler::zero, L_copy_32_bytes); |
1863 __ movl(rax, Address(from, dword_count, Address::times_4, -4)); | |
1864 __ movl(Address(to, dword_count, Address::times_4, -4), rax); | |
1865 __ jmp(L_copy_32_bytes); | |
1866 | |
1867 // Copy trailing qwords | |
1868 __ BIND(L_copy_8_bytes); | |
1869 __ movq(rax, Address(from, qword_count, Address::times_8, -8)); | |
1870 __ movq(Address(to, qword_count, Address::times_8, -8), rax); | |
304 | 1871 __ decrement(qword_count); |
0 | 1872 __ jcc(Assembler::notZero, L_copy_8_bytes); |
1873 | |
1874 inc_counter_np(SharedRuntime::_jint_array_copy_ctr); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1875 if (is_oop) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1876 __ jmp(L_exit); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1877 } |
0 | 1878 restore_arg_regs(); |
304 | 1879 __ xorptr(rax, rax); // return 0 |
0 | 1880 __ leave(); // required for proper stackwalking of RuntimeStub frame |
1881 __ ret(0); | |
1882 | |
1883 // Copy in 32-bytes chunks | |
1884 copy_32_bytes_backward(from, to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes); | |
1885 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1886 inc_counter_np(SharedRuntime::_jint_array_copy_ctr); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1887 __ bind(L_exit); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1888 if (is_oop) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1889 Register end_to = rdx; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1890 __ leaq(end_to, Address(to, dword_count, Address::times_4, -4)); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1891 gen_write_ref_array_post_barrier(to, end_to, rax); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1892 } |
0 | 1893 restore_arg_regs(); |
304 | 1894 __ xorptr(rax, rax); // return 0 |
0 | 1895 __ leave(); // required for proper stackwalking of RuntimeStub frame |
1896 __ ret(0); | |
1897 | |
1898 return start; | |
1899 } | |
1900 | |
1901 // Arguments: | |
1902 // aligned - true => Input and output aligned on a HeapWord boundary == 8 bytes | |
1903 // ignored | |
1904 // is_oop - true => oop array, so generate store check code | |
1905 // name - stub name string | |
1906 // | |
1907 // Inputs: | |
1908 // c_rarg0 - source array address | |
1909 // c_rarg1 - destination array address | |
1910 // c_rarg2 - element count, treated as ssize_t, can be zero | |
1911 // | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
1912 // Side Effects: |
0 | 1913 // disjoint_oop_copy_entry or disjoint_long_copy_entry is set to the |
1914 // no-overlap entry point used by generate_conjoint_long_oop_copy(). | |
1915 // | |
1916 address generate_disjoint_long_oop_copy(bool aligned, bool is_oop, const char *name) { | |
1917 __ align(CodeEntryAlignment); | |
1918 StubCodeMark mark(this, "StubRoutines", name); | |
1919 address start = __ pc(); | |
1920 | |
1921 Label L_copy_32_bytes, L_copy_8_bytes, L_exit; | |
1922 const Register from = rdi; // source array address | |
1923 const Register to = rsi; // destination array address | |
1924 const Register qword_count = rdx; // elements count | |
1925 const Register end_from = from; // source array end address | |
1926 const Register end_to = rcx; // destination array end address | |
1927 const Register saved_to = to; | |
1928 // End pointers are inclusive, and if count is not zero they point | |
1929 // to the last unit copied: end_to[0] := end_from[0] | |
1930 | |
1931 __ enter(); // required for proper stackwalking of RuntimeStub frame | |
1932 // Save no-overlap entry point for generate_conjoint_long_oop_copy() | |
1933 assert_clean_int(c_rarg2, rax); // Make sure 'count' is clean int. | |
1934 | |
1935 if (is_oop) { | |
1936 disjoint_oop_copy_entry = __ pc(); | |
1937 // no registers are destroyed by this call | |
1938 gen_write_ref_array_pre_barrier(/* dest */ c_rarg1, /* count */ c_rarg2); | |
1939 } else { | |
1940 disjoint_long_copy_entry = __ pc(); | |
1941 } | |
1942 BLOCK_COMMENT("Entry:"); | |
1943 // caller can pass a 64-bit byte count here (from Unsafe.copyMemory) | |
1944 | |
1945 setup_arg_regs(); // from => rdi, to => rsi, count => rdx | |
1946 // r9 and r10 may be used to save non-volatile registers | |
1947 | |
1948 // 'from', 'to' and 'qword_count' are now valid | |
1949 | |
1950 // Copy from low to high addresses. Use 'to' as scratch. | |
304 | 1951 __ lea(end_from, Address(from, qword_count, Address::times_8, -8)); |
1952 __ lea(end_to, Address(to, qword_count, Address::times_8, -8)); | |
1953 __ negptr(qword_count); | |
0 | 1954 __ jmp(L_copy_32_bytes); |
1955 | |
1956 // Copy trailing qwords | |
1957 __ BIND(L_copy_8_bytes); | |
1958 __ movq(rax, Address(end_from, qword_count, Address::times_8, 8)); | |
1959 __ movq(Address(end_to, qword_count, Address::times_8, 8), rax); | |
304 | 1960 __ increment(qword_count); |
0 | 1961 __ jcc(Assembler::notZero, L_copy_8_bytes); |
1962 | |
1963 if (is_oop) { | |
1964 __ jmp(L_exit); | |
1965 } else { | |
1966 inc_counter_np(SharedRuntime::_jlong_array_copy_ctr); | |
1967 restore_arg_regs(); | |
304 | 1968 __ xorptr(rax, rax); // return 0 |
0 | 1969 __ leave(); // required for proper stackwalking of RuntimeStub frame |
1970 __ ret(0); | |
1971 } | |
1972 | |
1973 // Copy 64-byte chunks | |
1974 copy_32_bytes_forward(end_from, end_to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes); | |
1975 | |
1976 if (is_oop) { | |
1977 __ BIND(L_exit); | |
1978 gen_write_ref_array_post_barrier(saved_to, end_to, rax); | |
1979 inc_counter_np(SharedRuntime::_oop_array_copy_ctr); | |
1980 } else { | |
1981 inc_counter_np(SharedRuntime::_jlong_array_copy_ctr); | |
1982 } | |
1983 restore_arg_regs(); | |
304 | 1984 __ xorptr(rax, rax); // return 0 |
0 | 1985 __ leave(); // required for proper stackwalking of RuntimeStub frame |
1986 __ ret(0); | |
1987 | |
1988 return start; | |
1989 } | |
1990 | |
1991 // Arguments: | |
1992 // aligned - true => Input and output aligned on a HeapWord boundary == 8 bytes | |
1993 // ignored | |
1994 // is_oop - true => oop array, so generate store check code | |
1995 // name - stub name string | |
1996 // | |
1997 // Inputs: | |
1998 // c_rarg0 - source array address | |
1999 // c_rarg1 - destination array address | |
2000 // c_rarg2 - element count, treated as ssize_t, can be zero | |
2001 // | |
2002 address generate_conjoint_long_oop_copy(bool aligned, bool is_oop, const char *name) { | |
2003 __ align(CodeEntryAlignment); | |
2004 StubCodeMark mark(this, "StubRoutines", name); | |
2005 address start = __ pc(); | |
2006 | |
2007 Label L_copy_32_bytes, L_copy_8_bytes, L_exit; | |
2008 const Register from = rdi; // source array address | |
2009 const Register to = rsi; // destination array address | |
2010 const Register qword_count = rdx; // elements count | |
2011 const Register saved_count = rcx; | |
2012 | |
2013 __ enter(); // required for proper stackwalking of RuntimeStub frame | |
2014 assert_clean_int(c_rarg2, rax); // Make sure 'count' is clean int. | |
2015 | |
2016 address disjoint_copy_entry = NULL; | |
2017 if (is_oop) { | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2018 assert(!UseCompressedOops, "shouldn't be called for compressed oops"); |
0 | 2019 disjoint_copy_entry = disjoint_oop_copy_entry; |
2020 oop_copy_entry = __ pc(); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2021 array_overlap_test(disjoint_oop_copy_entry, Address::times_8); |
0 | 2022 } else { |
2023 disjoint_copy_entry = disjoint_long_copy_entry; | |
2024 long_copy_entry = __ pc(); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2025 array_overlap_test(disjoint_long_copy_entry, Address::times_8); |
0 | 2026 } |
2027 BLOCK_COMMENT("Entry:"); | |
2028 // caller can pass a 64-bit byte count here (from Unsafe.copyMemory) | |
2029 | |
2030 array_overlap_test(disjoint_copy_entry, Address::times_8); | |
2031 setup_arg_regs(); // from => rdi, to => rsi, count => rdx | |
2032 // r9 and r10 may be used to save non-volatile registers | |
2033 | |
2034 // 'from', 'to' and 'qword_count' are now valid | |
2035 | |
2036 if (is_oop) { | |
2037 // Save to and count for store barrier | |
304 | 2038 __ movptr(saved_count, qword_count); |
0 | 2039 // No registers are destroyed by this call |
2040 gen_write_ref_array_pre_barrier(to, saved_count); | |
2041 } | |
2042 | |
2043 __ jmp(L_copy_32_bytes); | |
2044 | |
2045 // Copy trailing qwords | |
2046 __ BIND(L_copy_8_bytes); | |
2047 __ movq(rax, Address(from, qword_count, Address::times_8, -8)); | |
2048 __ movq(Address(to, qword_count, Address::times_8, -8), rax); | |
304 | 2049 __ decrement(qword_count); |
0 | 2050 __ jcc(Assembler::notZero, L_copy_8_bytes); |
2051 | |
2052 if (is_oop) { | |
2053 __ jmp(L_exit); | |
2054 } else { | |
2055 inc_counter_np(SharedRuntime::_jlong_array_copy_ctr); | |
2056 restore_arg_regs(); | |
304 | 2057 __ xorptr(rax, rax); // return 0 |
0 | 2058 __ leave(); // required for proper stackwalking of RuntimeStub frame |
2059 __ ret(0); | |
2060 } | |
2061 | |
2062 // Copy in 32-bytes chunks | |
2063 copy_32_bytes_backward(from, to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes); | |
2064 | |
2065 if (is_oop) { | |
2066 __ BIND(L_exit); | |
304 | 2067 __ lea(rcx, Address(to, saved_count, Address::times_8, -8)); |
0 | 2068 gen_write_ref_array_post_barrier(to, rcx, rax); |
2069 inc_counter_np(SharedRuntime::_oop_array_copy_ctr); | |
2070 } else { | |
2071 inc_counter_np(SharedRuntime::_jlong_array_copy_ctr); | |
2072 } | |
2073 restore_arg_regs(); | |
304 | 2074 __ xorptr(rax, rax); // return 0 |
0 | 2075 __ leave(); // required for proper stackwalking of RuntimeStub frame |
2076 __ ret(0); | |
2077 | |
2078 return start; | |
2079 } | |
2080 | |
2081 | |
2082 // Helper for generating a dynamic type check. | |
2083 // Smashes no registers. | |
2084 void generate_type_check(Register sub_klass, | |
2085 Register super_check_offset, | |
2086 Register super_klass, | |
2087 Label& L_success) { | |
2088 assert_different_registers(sub_klass, super_check_offset, super_klass); | |
2089 | |
2090 BLOCK_COMMENT("type_check:"); | |
2091 | |
2092 Label L_miss; | |
2093 | |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
512
diff
changeset
|
2094 __ check_klass_subtype_fast_path(sub_klass, super_klass, noreg, &L_success, &L_miss, NULL, |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
512
diff
changeset
|
2095 super_check_offset); |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
512
diff
changeset
|
2096 __ check_klass_subtype_slow_path(sub_klass, super_klass, noreg, noreg, &L_success, NULL); |
0 | 2097 |
2098 // Fall through on failure! | |
2099 __ BIND(L_miss); | |
2100 } | |
2101 | |
2102 // | |
2103 // Generate checkcasting array copy stub | |
2104 // | |
2105 // Input: | |
2106 // c_rarg0 - source array address | |
2107 // c_rarg1 - destination array address | |
2108 // c_rarg2 - element count, treated as ssize_t, can be zero | |
2109 // c_rarg3 - size_t ckoff (super_check_offset) | |
2110 // not Win64 | |
2111 // c_rarg4 - oop ckval (super_klass) | |
2112 // Win64 | |
2113 // rsp+40 - oop ckval (super_klass) | |
2114 // | |
2115 // Output: | |
2116 // rax == 0 - success | |
2117 // rax == -1^K - failure, where K is partial transfer count | |
2118 // | |
2119 address generate_checkcast_copy(const char *name) { | |
2120 | |
2121 Label L_load_element, L_store_element, L_do_card_marks, L_done; | |
2122 | |
2123 // Input registers (after setup_arg_regs) | |
2124 const Register from = rdi; // source array address | |
2125 const Register to = rsi; // destination array address | |
2126 const Register length = rdx; // elements count | |
2127 const Register ckoff = rcx; // super_check_offset | |
2128 const Register ckval = r8; // super_klass | |
2129 | |
2130 // Registers used as temps (r13, r14 are save-on-entry) | |
2131 const Register end_from = from; // source array end address | |
2132 const Register end_to = r13; // destination array end address | |
2133 const Register count = rdx; // -(count_remaining) | |
2134 const Register r14_length = r14; // saved copy of length | |
2135 // End pointers are inclusive, and if length is not zero they point | |
2136 // to the last unit copied: end_to[0] := end_from[0] | |
2137 | |
2138 const Register rax_oop = rax; // actual oop copied | |
2139 const Register r11_klass = r11; // oop._klass | |
2140 | |
2141 //--------------------------------------------------------------- | |
2142 // Assembler stub will be used for this call to arraycopy | |
2143 // if the two arrays are subtypes of Object[] but the | |
2144 // destination array type is not equal to or a supertype | |
2145 // of the source type. Each element must be separately | |
2146 // checked. | |
2147 | |
2148 __ align(CodeEntryAlignment); | |
2149 StubCodeMark mark(this, "StubRoutines", name); | |
2150 address start = __ pc(); | |
2151 | |
2152 __ enter(); // required for proper stackwalking of RuntimeStub frame | |
2153 | |
2154 checkcast_copy_entry = __ pc(); | |
2155 BLOCK_COMMENT("Entry:"); | |
2156 | |
2157 #ifdef ASSERT | |
2158 // caller guarantees that the arrays really are different | |
2159 // otherwise, we would have to make conjoint checks | |
2160 { Label L; | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2161 array_overlap_test(L, TIMES_OOP); |
0 | 2162 __ stop("checkcast_copy within a single array"); |
2163 __ bind(L); | |
2164 } | |
2165 #endif //ASSERT | |
2166 | |
2167 // allocate spill slots for r13, r14 | |
2168 enum { | |
2169 saved_r13_offset, | |
2170 saved_r14_offset, | |
2171 saved_rbp_offset, | |
2172 saved_rip_offset, | |
2173 saved_rarg0_offset | |
2174 }; | |
304 | 2175 __ subptr(rsp, saved_rbp_offset * wordSize); |
2176 __ movptr(Address(rsp, saved_r13_offset * wordSize), r13); | |
2177 __ movptr(Address(rsp, saved_r14_offset * wordSize), r14); | |
0 | 2178 setup_arg_regs(4); // from => rdi, to => rsi, length => rdx |
2179 // ckoff => rcx, ckval => r8 | |
2180 // r9 and r10 may be used to save non-volatile registers | |
2181 #ifdef _WIN64 | |
2182 // last argument (#4) is on stack on Win64 | |
2183 const int ckval_offset = saved_rarg0_offset + 4; | |
304 | 2184 __ movptr(ckval, Address(rsp, ckval_offset * wordSize)); |
0 | 2185 #endif |
2186 | |
2187 // check that int operands are properly extended to size_t | |
2188 assert_clean_int(length, rax); | |
2189 assert_clean_int(ckoff, rax); | |
2190 | |
2191 #ifdef ASSERT | |
2192 BLOCK_COMMENT("assert consistent ckoff/ckval"); | |
2193 // The ckoff and ckval must be mutually consistent, | |
2194 // even though caller generates both. | |
2195 { Label L; | |
2196 int sco_offset = (klassOopDesc::header_size() * HeapWordSize + | |
2197 Klass::super_check_offset_offset_in_bytes()); | |
2198 __ cmpl(ckoff, Address(ckval, sco_offset)); | |
2199 __ jcc(Assembler::equal, L); | |
2200 __ stop("super_check_offset inconsistent"); | |
2201 __ bind(L); | |
2202 } | |
2203 #endif //ASSERT | |
2204 | |
2205 // Loop-invariant addresses. They are exclusive end pointers. | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2206 Address end_from_addr(from, length, TIMES_OOP, 0); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2207 Address end_to_addr(to, length, TIMES_OOP, 0); |
0 | 2208 // Loop-variant addresses. They assume post-incremented count < 0. |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2209 Address from_element_addr(end_from, count, TIMES_OOP, 0); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2210 Address to_element_addr(end_to, count, TIMES_OOP, 0); |
0 | 2211 |
2212 gen_write_ref_array_pre_barrier(to, count); | |
2213 | |
2214 // Copy from low to high addresses, indexed from the end of each array. | |
304 | 2215 __ lea(end_from, end_from_addr); |
2216 __ lea(end_to, end_to_addr); | |
2217 __ movptr(r14_length, length); // save a copy of the length | |
2218 assert(length == count, ""); // else fix next line: | |
2219 __ negptr(count); // negate and test the length | |
0 | 2220 __ jcc(Assembler::notZero, L_load_element); |
2221 | |
2222 // Empty array: Nothing to do. | |
304 | 2223 __ xorptr(rax, rax); // return 0 on (trivial) success |
0 | 2224 __ jmp(L_done); |
2225 | |
2226 // ======== begin loop ======== | |
2227 // (Loop is rotated; its entry is L_load_element.) | |
2228 // Loop control: | |
2229 // for (count = -count; count != 0; count++) | |
2230 // Base pointers src, dst are biased by 8*(count-1),to last element. | |
1365 | 2231 __ align(OptoLoopAlignment); |
0 | 2232 |
2233 __ BIND(L_store_element); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2234 __ store_heap_oop(to_element_addr, rax_oop); // store the oop |
304 | 2235 __ increment(count); // increment the count toward zero |
0 | 2236 __ jcc(Assembler::zero, L_do_card_marks); |
2237 | |
2238 // ======== loop entry is here ======== | |
2239 __ BIND(L_load_element); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2240 __ load_heap_oop(rax_oop, from_element_addr); // load the oop |
304 | 2241 __ testptr(rax_oop, rax_oop); |
0 | 2242 __ jcc(Assembler::zero, L_store_element); |
2243 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2244 __ load_klass(r11_klass, rax_oop);// query the object klass |
0 | 2245 generate_type_check(r11_klass, ckoff, ckval, L_store_element); |
2246 // ======== end loop ======== | |
2247 | |
2248 // It was a real error; we must depend on the caller to finish the job. | |
2249 // Register rdx = -1 * number of *remaining* oops, r14 = *total* oops. | |
2250 // Emit GC store barriers for the oops we have copied (r14 + rdx), | |
2251 // and report their number to the caller. | |
2252 assert_different_registers(rax, r14_length, count, to, end_to, rcx); | |
304 | 2253 __ lea(end_to, to_element_addr); |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
671
diff
changeset
|
2254 __ addptr(end_to, -heapOopSize); // make an inclusive end pointer |
362 | 2255 gen_write_ref_array_post_barrier(to, end_to, rscratch1); |
304 | 2256 __ movptr(rax, r14_length); // original oops |
2257 __ addptr(rax, count); // K = (original - remaining) oops | |
2258 __ notptr(rax); // report (-1^K) to caller | |
0 | 2259 __ jmp(L_done); |
2260 | |
2261 // Come here on success only. | |
2262 __ BIND(L_do_card_marks); | |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
671
diff
changeset
|
2263 __ addptr(end_to, -heapOopSize); // make an inclusive end pointer |
362 | 2264 gen_write_ref_array_post_barrier(to, end_to, rscratch1); |
304 | 2265 __ xorptr(rax, rax); // return 0 on success |
0 | 2266 |
2267 // Common exit point (success or failure). | |
2268 __ BIND(L_done); | |
304 | 2269 __ movptr(r13, Address(rsp, saved_r13_offset * wordSize)); |
2270 __ movptr(r14, Address(rsp, saved_r14_offset * wordSize)); | |
0 | 2271 inc_counter_np(SharedRuntime::_checkcast_array_copy_ctr); |
2272 restore_arg_regs(); | |
2273 __ leave(); // required for proper stackwalking of RuntimeStub frame | |
2274 __ ret(0); | |
2275 | |
2276 return start; | |
2277 } | |
2278 | |
2279 // | |
2280 // Generate 'unsafe' array copy stub | |
2281 // Though just as safe as the other stubs, it takes an unscaled | |
2282 // size_t argument instead of an element count. | |
2283 // | |
2284 // Input: | |
2285 // c_rarg0 - source array address | |
2286 // c_rarg1 - destination array address | |
2287 // c_rarg2 - byte count, treated as ssize_t, can be zero | |
2288 // | |
2289 // Examines the alignment of the operands and dispatches | |
2290 // to a long, int, short, or byte copy loop. | |
2291 // | |
2292 address generate_unsafe_copy(const char *name) { | |
2293 | |
2294 Label L_long_aligned, L_int_aligned, L_short_aligned; | |
2295 | |
2296 // Input registers (before setup_arg_regs) | |
2297 const Register from = c_rarg0; // source array address | |
2298 const Register to = c_rarg1; // destination array address | |
2299 const Register size = c_rarg2; // byte count (size_t) | |
2300 | |
2301 // Register used as a temp | |
2302 const Register bits = rax; // test copy of low bits | |
2303 | |
2304 __ align(CodeEntryAlignment); | |
2305 StubCodeMark mark(this, "StubRoutines", name); | |
2306 address start = __ pc(); | |
2307 | |
2308 __ enter(); // required for proper stackwalking of RuntimeStub frame | |
2309 | |
2310 // bump this on entry, not on exit: | |
2311 inc_counter_np(SharedRuntime::_unsafe_array_copy_ctr); | |
2312 | |
304 | 2313 __ mov(bits, from); |
2314 __ orptr(bits, to); | |
2315 __ orptr(bits, size); | |
0 | 2316 |
2317 __ testb(bits, BytesPerLong-1); | |
2318 __ jccb(Assembler::zero, L_long_aligned); | |
2319 | |
2320 __ testb(bits, BytesPerInt-1); | |
2321 __ jccb(Assembler::zero, L_int_aligned); | |
2322 | |
2323 __ testb(bits, BytesPerShort-1); | |
2324 __ jump_cc(Assembler::notZero, RuntimeAddress(byte_copy_entry)); | |
2325 | |
2326 __ BIND(L_short_aligned); | |
304 | 2327 __ shrptr(size, LogBytesPerShort); // size => short_count |
0 | 2328 __ jump(RuntimeAddress(short_copy_entry)); |
2329 | |
2330 __ BIND(L_int_aligned); | |
304 | 2331 __ shrptr(size, LogBytesPerInt); // size => int_count |
0 | 2332 __ jump(RuntimeAddress(int_copy_entry)); |
2333 | |
2334 __ BIND(L_long_aligned); | |
304 | 2335 __ shrptr(size, LogBytesPerLong); // size => qword_count |
0 | 2336 __ jump(RuntimeAddress(long_copy_entry)); |
2337 | |
2338 return start; | |
2339 } | |
2340 | |
2341 // Perform range checks on the proposed arraycopy. | |
2342 // Kills temp, but nothing else. | |
2343 // Also, clean the sign bits of src_pos and dst_pos. | |
2344 void arraycopy_range_checks(Register src, // source array oop (c_rarg0) | |
2345 Register src_pos, // source position (c_rarg1) | |
2346 Register dst, // destination array oo (c_rarg2) | |
2347 Register dst_pos, // destination position (c_rarg3) | |
2348 Register length, | |
2349 Register temp, | |
2350 Label& L_failed) { | |
2351 BLOCK_COMMENT("arraycopy_range_checks:"); | |
2352 | |
2353 // if (src_pos + length > arrayOop(src)->length()) FAIL; | |
2354 __ movl(temp, length); | |
2355 __ addl(temp, src_pos); // src_pos + length | |
2356 __ cmpl(temp, Address(src, arrayOopDesc::length_offset_in_bytes())); | |
2357 __ jcc(Assembler::above, L_failed); | |
2358 | |
2359 // if (dst_pos + length > arrayOop(dst)->length()) FAIL; | |
2360 __ movl(temp, length); | |
2361 __ addl(temp, dst_pos); // dst_pos + length | |
2362 __ cmpl(temp, Address(dst, arrayOopDesc::length_offset_in_bytes())); | |
2363 __ jcc(Assembler::above, L_failed); | |
2364 | |
2365 // Have to clean up high 32-bits of 'src_pos' and 'dst_pos'. | |
2366 // Move with sign extension can be used since they are positive. | |
2367 __ movslq(src_pos, src_pos); | |
2368 __ movslq(dst_pos, dst_pos); | |
2369 | |
2370 BLOCK_COMMENT("arraycopy_range_checks done"); | |
2371 } | |
2372 | |
2373 // | |
2374 // Generate generic array copy stubs | |
2375 // | |
2376 // Input: | |
2377 // c_rarg0 - src oop | |
2378 // c_rarg1 - src_pos (32-bits) | |
2379 // c_rarg2 - dst oop | |
2380 // c_rarg3 - dst_pos (32-bits) | |
2381 // not Win64 | |
2382 // c_rarg4 - element count (32-bits) | |
2383 // Win64 | |
2384 // rsp+40 - element count (32-bits) | |
2385 // | |
2386 // Output: | |
2387 // rax == 0 - success | |
2388 // rax == -1^K - failure, where K is partial transfer count | |
2389 // | |
2390 address generate_generic_copy(const char *name) { | |
2391 | |
2392 Label L_failed, L_failed_0, L_objArray; | |
2393 Label L_copy_bytes, L_copy_shorts, L_copy_ints, L_copy_longs; | |
2394 | |
2395 // Input registers | |
2396 const Register src = c_rarg0; // source array oop | |
2397 const Register src_pos = c_rarg1; // source position | |
2398 const Register dst = c_rarg2; // destination array oop | |
2399 const Register dst_pos = c_rarg3; // destination position | |
2400 // elements count is on stack on Win64 | |
2401 #ifdef _WIN64 | |
2402 #define C_RARG4 Address(rsp, 6 * wordSize) | |
2403 #else | |
2404 #define C_RARG4 c_rarg4 | |
2405 #endif | |
2406 | |
2407 { int modulus = CodeEntryAlignment; | |
2408 int target = modulus - 5; // 5 = sizeof jmp(L_failed) | |
2409 int advance = target - (__ offset() % modulus); | |
2410 if (advance < 0) advance += modulus; | |
2411 if (advance > 0) __ nop(advance); | |
2412 } | |
2413 StubCodeMark mark(this, "StubRoutines", name); | |
2414 | |
2415 // Short-hop target to L_failed. Makes for denser prologue code. | |
2416 __ BIND(L_failed_0); | |
2417 __ jmp(L_failed); | |
2418 assert(__ offset() % CodeEntryAlignment == 0, "no further alignment needed"); | |
2419 | |
2420 __ align(CodeEntryAlignment); | |
2421 address start = __ pc(); | |
2422 | |
2423 __ enter(); // required for proper stackwalking of RuntimeStub frame | |
2424 | |
2425 // bump this on entry, not on exit: | |
2426 inc_counter_np(SharedRuntime::_generic_array_copy_ctr); | |
2427 | |
2428 //----------------------------------------------------------------------- | |
2429 // Assembler stub will be used for this call to arraycopy | |
2430 // if the following conditions are met: | |
2431 // | |
2432 // (1) src and dst must not be null. | |
2433 // (2) src_pos must not be negative. | |
2434 // (3) dst_pos must not be negative. | |
2435 // (4) length must not be negative. | |
2436 // (5) src klass and dst klass should be the same and not NULL. | |
2437 // (6) src and dst should be arrays. | |
2438 // (7) src_pos + length must not exceed length of src. | |
2439 // (8) dst_pos + length must not exceed length of dst. | |
2440 // | |
2441 | |
2442 // if (src == NULL) return -1; | |
304 | 2443 __ testptr(src, src); // src oop |
0 | 2444 size_t j1off = __ offset(); |
2445 __ jccb(Assembler::zero, L_failed_0); | |
2446 | |
2447 // if (src_pos < 0) return -1; | |
2448 __ testl(src_pos, src_pos); // src_pos (32-bits) | |
2449 __ jccb(Assembler::negative, L_failed_0); | |
2450 | |
2451 // if (dst == NULL) return -1; | |
304 | 2452 __ testptr(dst, dst); // dst oop |
0 | 2453 __ jccb(Assembler::zero, L_failed_0); |
2454 | |
2455 // if (dst_pos < 0) return -1; | |
2456 __ testl(dst_pos, dst_pos); // dst_pos (32-bits) | |
2457 size_t j4off = __ offset(); | |
2458 __ jccb(Assembler::negative, L_failed_0); | |
2459 | |
2460 // The first four tests are very dense code, | |
2461 // but not quite dense enough to put four | |
2462 // jumps in a 16-byte instruction fetch buffer. | |
2463 // That's good, because some branch predicters | |
2464 // do not like jumps so close together. | |
2465 // Make sure of this. | |
2466 guarantee(((j1off ^ j4off) & ~15) != 0, "I$ line of 1st & 4th jumps"); | |
2467 | |
2468 // registers used as temp | |
2469 const Register r11_length = r11; // elements count to copy | |
2470 const Register r10_src_klass = r10; // array klass | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2471 const Register r9_dst_klass = r9; // dest array klass |
0 | 2472 |
2473 // if (length < 0) return -1; | |
2474 __ movl(r11_length, C_RARG4); // length (elements count, 32-bits value) | |
2475 __ testl(r11_length, r11_length); | |
2476 __ jccb(Assembler::negative, L_failed_0); | |
2477 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2478 __ load_klass(r10_src_klass, src); |
0 | 2479 #ifdef ASSERT |
2480 // assert(src->klass() != NULL); | |
2481 BLOCK_COMMENT("assert klasses not null"); | |
2482 { Label L1, L2; | |
304 | 2483 __ testptr(r10_src_klass, r10_src_klass); |
0 | 2484 __ jcc(Assembler::notZero, L2); // it is broken if klass is NULL |
2485 __ bind(L1); | |
2486 __ stop("broken null klass"); | |
2487 __ bind(L2); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2488 __ load_klass(r9_dst_klass, dst); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2489 __ cmpq(r9_dst_klass, 0); |
0 | 2490 __ jcc(Assembler::equal, L1); // this would be broken also |
2491 BLOCK_COMMENT("assert done"); | |
2492 } | |
2493 #endif | |
2494 | |
2495 // Load layout helper (32-bits) | |
2496 // | |
2497 // |array_tag| | header_size | element_type | |log2_element_size| | |
2498 // 32 30 24 16 8 2 0 | |
2499 // | |
2500 // array_tag: typeArray = 0x3, objArray = 0x2, non-array = 0x0 | |
2501 // | |
2502 | |
2503 int lh_offset = klassOopDesc::header_size() * HeapWordSize + | |
2504 Klass::layout_helper_offset_in_bytes(); | |
2505 | |
2506 const Register rax_lh = rax; // layout helper | |
2507 | |
2508 __ movl(rax_lh, Address(r10_src_klass, lh_offset)); | |
2509 | |
2510 // Handle objArrays completely differently... | |
2511 jint objArray_lh = Klass::array_layout_helper(T_OBJECT); | |
2512 __ cmpl(rax_lh, objArray_lh); | |
2513 __ jcc(Assembler::equal, L_objArray); | |
2514 | |
2515 // if (src->klass() != dst->klass()) return -1; | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2516 __ load_klass(r9_dst_klass, dst); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2517 __ cmpq(r10_src_klass, r9_dst_klass); |
0 | 2518 __ jcc(Assembler::notEqual, L_failed); |
2519 | |
2520 // if (!src->is_Array()) return -1; | |
2521 __ cmpl(rax_lh, Klass::_lh_neutral_value); | |
2522 __ jcc(Assembler::greaterEqual, L_failed); | |
2523 | |
2524 // At this point, it is known to be a typeArray (array_tag 0x3). | |
2525 #ifdef ASSERT | |
2526 { Label L; | |
2527 __ cmpl(rax_lh, (Klass::_lh_array_tag_type_value << Klass::_lh_array_tag_shift)); | |
2528 __ jcc(Assembler::greaterEqual, L); | |
2529 __ stop("must be a primitive array"); | |
2530 __ bind(L); | |
2531 } | |
2532 #endif | |
2533 | |
2534 arraycopy_range_checks(src, src_pos, dst, dst_pos, r11_length, | |
2535 r10, L_failed); | |
2536 | |
2537 // typeArrayKlass | |
2538 // | |
2539 // src_addr = (src + array_header_in_bytes()) + (src_pos << log2elemsize); | |
2540 // dst_addr = (dst + array_header_in_bytes()) + (dst_pos << log2elemsize); | |
2541 // | |
2542 | |
2543 const Register r10_offset = r10; // array offset | |
2544 const Register rax_elsize = rax_lh; // element size | |
2545 | |
2546 __ movl(r10_offset, rax_lh); | |
2547 __ shrl(r10_offset, Klass::_lh_header_size_shift); | |
304 | 2548 __ andptr(r10_offset, Klass::_lh_header_size_mask); // array_offset |
2549 __ addptr(src, r10_offset); // src array offset | |
2550 __ addptr(dst, r10_offset); // dst array offset | |
0 | 2551 BLOCK_COMMENT("choose copy loop based on element size"); |
2552 __ andl(rax_lh, Klass::_lh_log2_element_size_mask); // rax_lh -> rax_elsize | |
2553 | |
2554 // next registers should be set before the jump to corresponding stub | |
2555 const Register from = c_rarg0; // source array address | |
2556 const Register to = c_rarg1; // destination array address | |
2557 const Register count = c_rarg2; // elements count | |
2558 | |
2559 // 'from', 'to', 'count' registers should be set in such order | |
2560 // since they are the same as 'src', 'src_pos', 'dst'. | |
2561 | |
2562 __ BIND(L_copy_bytes); | |
2563 __ cmpl(rax_elsize, 0); | |
2564 __ jccb(Assembler::notEqual, L_copy_shorts); | |
304 | 2565 __ lea(from, Address(src, src_pos, Address::times_1, 0));// src_addr |
2566 __ lea(to, Address(dst, dst_pos, Address::times_1, 0));// dst_addr | |
2567 __ movl2ptr(count, r11_length); // length | |
0 | 2568 __ jump(RuntimeAddress(byte_copy_entry)); |
2569 | |
2570 __ BIND(L_copy_shorts); | |
2571 __ cmpl(rax_elsize, LogBytesPerShort); | |
2572 __ jccb(Assembler::notEqual, L_copy_ints); | |
304 | 2573 __ lea(from, Address(src, src_pos, Address::times_2, 0));// src_addr |
2574 __ lea(to, Address(dst, dst_pos, Address::times_2, 0));// dst_addr | |
2575 __ movl2ptr(count, r11_length); // length | |
0 | 2576 __ jump(RuntimeAddress(short_copy_entry)); |
2577 | |
2578 __ BIND(L_copy_ints); | |
2579 __ cmpl(rax_elsize, LogBytesPerInt); | |
2580 __ jccb(Assembler::notEqual, L_copy_longs); | |
304 | 2581 __ lea(from, Address(src, src_pos, Address::times_4, 0));// src_addr |
2582 __ lea(to, Address(dst, dst_pos, Address::times_4, 0));// dst_addr | |
2583 __ movl2ptr(count, r11_length); // length | |
0 | 2584 __ jump(RuntimeAddress(int_copy_entry)); |
2585 | |
2586 __ BIND(L_copy_longs); | |
2587 #ifdef ASSERT | |
2588 { Label L; | |
2589 __ cmpl(rax_elsize, LogBytesPerLong); | |
2590 __ jcc(Assembler::equal, L); | |
2591 __ stop("must be long copy, but elsize is wrong"); | |
2592 __ bind(L); | |
2593 } | |
2594 #endif | |
304 | 2595 __ lea(from, Address(src, src_pos, Address::times_8, 0));// src_addr |
2596 __ lea(to, Address(dst, dst_pos, Address::times_8, 0));// dst_addr | |
2597 __ movl2ptr(count, r11_length); // length | |
0 | 2598 __ jump(RuntimeAddress(long_copy_entry)); |
2599 | |
2600 // objArrayKlass | |
2601 __ BIND(L_objArray); | |
2602 // live at this point: r10_src_klass, src[_pos], dst[_pos] | |
2603 | |
2604 Label L_plain_copy, L_checkcast_copy; | |
2605 // test array classes for subtyping | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2606 __ load_klass(r9_dst_klass, dst); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2607 __ cmpq(r10_src_klass, r9_dst_klass); // usual case is exact equality |
0 | 2608 __ jcc(Assembler::notEqual, L_checkcast_copy); |
2609 | |
2610 // Identically typed arrays can be copied without element-wise checks. | |
2611 arraycopy_range_checks(src, src_pos, dst, dst_pos, r11_length, | |
2612 r10, L_failed); | |
2613 | |
304 | 2614 __ lea(from, Address(src, src_pos, TIMES_OOP, |
0 | 2615 arrayOopDesc::base_offset_in_bytes(T_OBJECT))); // src_addr |
304 | 2616 __ lea(to, Address(dst, dst_pos, TIMES_OOP, |
2617 arrayOopDesc::base_offset_in_bytes(T_OBJECT))); // dst_addr | |
2618 __ movl2ptr(count, r11_length); // length | |
0 | 2619 __ BIND(L_plain_copy); |
2620 __ jump(RuntimeAddress(oop_copy_entry)); | |
2621 | |
2622 __ BIND(L_checkcast_copy); | |
2623 // live at this point: r10_src_klass, !r11_length | |
2624 { | |
2625 // assert(r11_length == C_RARG4); // will reload from here | |
2626 Register r11_dst_klass = r11; | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2627 __ load_klass(r11_dst_klass, dst); |
0 | 2628 |
2629 // Before looking at dst.length, make sure dst is also an objArray. | |
2630 __ cmpl(Address(r11_dst_klass, lh_offset), objArray_lh); | |
2631 __ jcc(Assembler::notEqual, L_failed); | |
2632 | |
2633 // It is safe to examine both src.length and dst.length. | |
2634 #ifndef _WIN64 | |
2635 arraycopy_range_checks(src, src_pos, dst, dst_pos, C_RARG4, | |
2636 rax, L_failed); | |
2637 #else | |
2638 __ movl(r11_length, C_RARG4); // reload | |
2639 arraycopy_range_checks(src, src_pos, dst, dst_pos, r11_length, | |
2640 rax, L_failed); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2641 __ load_klass(r11_dst_klass, dst); // reload |
0 | 2642 #endif |
2643 | |
2644 // Marshal the base address arguments now, freeing registers. | |
304 | 2645 __ lea(from, Address(src, src_pos, TIMES_OOP, |
0 | 2646 arrayOopDesc::base_offset_in_bytes(T_OBJECT))); |
304 | 2647 __ lea(to, Address(dst, dst_pos, TIMES_OOP, |
0 | 2648 arrayOopDesc::base_offset_in_bytes(T_OBJECT))); |
2649 __ movl(count, C_RARG4); // length (reloaded) | |
2650 Register sco_temp = c_rarg3; // this register is free now | |
2651 assert_different_registers(from, to, count, sco_temp, | |
2652 r11_dst_klass, r10_src_klass); | |
2653 assert_clean_int(count, sco_temp); | |
2654 | |
2655 // Generate the type check. | |
2656 int sco_offset = (klassOopDesc::header_size() * HeapWordSize + | |
2657 Klass::super_check_offset_offset_in_bytes()); | |
2658 __ movl(sco_temp, Address(r11_dst_klass, sco_offset)); | |
2659 assert_clean_int(sco_temp, rax); | |
2660 generate_type_check(r10_src_klass, sco_temp, r11_dst_klass, L_plain_copy); | |
2661 | |
2662 // Fetch destination element klass from the objArrayKlass header. | |
2663 int ek_offset = (klassOopDesc::header_size() * HeapWordSize + | |
2664 objArrayKlass::element_klass_offset_in_bytes()); | |
304 | 2665 __ movptr(r11_dst_klass, Address(r11_dst_klass, ek_offset)); |
0 | 2666 __ movl(sco_temp, Address(r11_dst_klass, sco_offset)); |
2667 assert_clean_int(sco_temp, rax); | |
2668 | |
2669 // the checkcast_copy loop needs two extra arguments: | |
2670 assert(c_rarg3 == sco_temp, "#3 already in place"); | |
304 | 2671 __ movptr(C_RARG4, r11_dst_klass); // dst.klass.element_klass |
0 | 2672 __ jump(RuntimeAddress(checkcast_copy_entry)); |
2673 } | |
2674 | |
2675 __ BIND(L_failed); | |
304 | 2676 __ xorptr(rax, rax); |
2677 __ notptr(rax); // return -1 | |
0 | 2678 __ leave(); // required for proper stackwalking of RuntimeStub frame |
2679 __ ret(0); | |
2680 | |
2681 return start; | |
2682 } | |
2683 | |
2684 #undef length_arg | |
2685 | |
2686 void generate_arraycopy_stubs() { | |
2687 // Call the conjoint generation methods immediately after | |
2688 // the disjoint ones so that short branches from the former | |
2689 // to the latter can be generated. | |
2690 StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(false, "jbyte_disjoint_arraycopy"); | |
2691 StubRoutines::_jbyte_arraycopy = generate_conjoint_byte_copy(false, "jbyte_arraycopy"); | |
2692 | |
2693 StubRoutines::_jshort_disjoint_arraycopy = generate_disjoint_short_copy(false, "jshort_disjoint_arraycopy"); | |
2694 StubRoutines::_jshort_arraycopy = generate_conjoint_short_copy(false, "jshort_arraycopy"); | |
2695 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2696 StubRoutines::_jint_disjoint_arraycopy = generate_disjoint_int_oop_copy(false, false, "jint_disjoint_arraycopy"); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2697 StubRoutines::_jint_arraycopy = generate_conjoint_int_oop_copy(false, false, "jint_arraycopy"); |
0 | 2698 |
2699 StubRoutines::_jlong_disjoint_arraycopy = generate_disjoint_long_oop_copy(false, false, "jlong_disjoint_arraycopy"); | |
2700 StubRoutines::_jlong_arraycopy = generate_conjoint_long_oop_copy(false, false, "jlong_arraycopy"); | |
2701 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2702 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2703 if (UseCompressedOops) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2704 StubRoutines::_oop_disjoint_arraycopy = generate_disjoint_int_oop_copy(false, true, "oop_disjoint_arraycopy"); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2705 StubRoutines::_oop_arraycopy = generate_conjoint_int_oop_copy(false, true, "oop_arraycopy"); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2706 } else { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2707 StubRoutines::_oop_disjoint_arraycopy = generate_disjoint_long_oop_copy(false, true, "oop_disjoint_arraycopy"); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2708 StubRoutines::_oop_arraycopy = generate_conjoint_long_oop_copy(false, true, "oop_arraycopy"); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
16
diff
changeset
|
2709 } |
0 | 2710 |
2711 StubRoutines::_checkcast_arraycopy = generate_checkcast_copy("checkcast_arraycopy"); | |
2712 StubRoutines::_unsafe_arraycopy = generate_unsafe_copy("unsafe_arraycopy"); | |
2713 StubRoutines::_generic_arraycopy = generate_generic_copy("generic_arraycopy"); | |
2714 | |
2715 // We don't generate specialized code for HeapWord-aligned source | |
2716 // arrays, so just use the code we've already generated | |
2717 StubRoutines::_arrayof_jbyte_disjoint_arraycopy = StubRoutines::_jbyte_disjoint_arraycopy; | |
2718 StubRoutines::_arrayof_jbyte_arraycopy = StubRoutines::_jbyte_arraycopy; | |
2719 | |
2720 StubRoutines::_arrayof_jshort_disjoint_arraycopy = StubRoutines::_jshort_disjoint_arraycopy; | |
2721 StubRoutines::_arrayof_jshort_arraycopy = StubRoutines::_jshort_arraycopy; | |
2722 | |
2723 StubRoutines::_arrayof_jint_disjoint_arraycopy = StubRoutines::_jint_disjoint_arraycopy; | |
2724 StubRoutines::_arrayof_jint_arraycopy = StubRoutines::_jint_arraycopy; | |
2725 | |
2726 StubRoutines::_arrayof_jlong_disjoint_arraycopy = StubRoutines::_jlong_disjoint_arraycopy; | |
2727 StubRoutines::_arrayof_jlong_arraycopy = StubRoutines::_jlong_arraycopy; | |
2728 | |
2729 StubRoutines::_arrayof_oop_disjoint_arraycopy = StubRoutines::_oop_disjoint_arraycopy; | |
2730 StubRoutines::_arrayof_oop_arraycopy = StubRoutines::_oop_arraycopy; | |
2731 } | |
2732 | |
1174
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2733 void generate_math_stubs() { |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2734 { |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2735 StubCodeMark mark(this, "StubRoutines", "log"); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2736 StubRoutines::_intrinsic_log = (double (*)(double)) __ pc(); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2737 |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2738 __ subq(rsp, 8); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2739 __ movdbl(Address(rsp, 0), xmm0); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2740 __ fld_d(Address(rsp, 0)); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2741 __ flog(); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2742 __ fstp_d(Address(rsp, 0)); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2743 __ movdbl(xmm0, Address(rsp, 0)); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2744 __ addq(rsp, 8); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2745 __ ret(0); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2746 } |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2747 { |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2748 StubCodeMark mark(this, "StubRoutines", "log10"); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2749 StubRoutines::_intrinsic_log10 = (double (*)(double)) __ pc(); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2750 |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2751 __ subq(rsp, 8); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2752 __ movdbl(Address(rsp, 0), xmm0); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2753 __ fld_d(Address(rsp, 0)); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2754 __ flog10(); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2755 __ fstp_d(Address(rsp, 0)); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2756 __ movdbl(xmm0, Address(rsp, 0)); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2757 __ addq(rsp, 8); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2758 __ ret(0); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2759 } |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2760 { |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2761 StubCodeMark mark(this, "StubRoutines", "sin"); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2762 StubRoutines::_intrinsic_sin = (double (*)(double)) __ pc(); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2763 |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2764 __ subq(rsp, 8); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2765 __ movdbl(Address(rsp, 0), xmm0); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2766 __ fld_d(Address(rsp, 0)); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2767 __ trigfunc('s'); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2768 __ fstp_d(Address(rsp, 0)); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2769 __ movdbl(xmm0, Address(rsp, 0)); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2770 __ addq(rsp, 8); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2771 __ ret(0); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2772 } |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2773 { |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2774 StubCodeMark mark(this, "StubRoutines", "cos"); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2775 StubRoutines::_intrinsic_cos = (double (*)(double)) __ pc(); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2776 |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2777 __ subq(rsp, 8); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2778 __ movdbl(Address(rsp, 0), xmm0); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2779 __ fld_d(Address(rsp, 0)); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2780 __ trigfunc('c'); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2781 __ fstp_d(Address(rsp, 0)); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2782 __ movdbl(xmm0, Address(rsp, 0)); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2783 __ addq(rsp, 8); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2784 __ ret(0); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2785 } |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2786 { |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2787 StubCodeMark mark(this, "StubRoutines", "tan"); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2788 StubRoutines::_intrinsic_tan = (double (*)(double)) __ pc(); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2789 |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2790 __ subq(rsp, 8); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2791 __ movdbl(Address(rsp, 0), xmm0); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2792 __ fld_d(Address(rsp, 0)); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2793 __ trigfunc('t'); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2794 __ fstp_d(Address(rsp, 0)); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2795 __ movdbl(xmm0, Address(rsp, 0)); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2796 __ addq(rsp, 8); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2797 __ ret(0); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2798 } |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2799 |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2800 // The intrinsic version of these seem to return the same value as |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2801 // the strict version. |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2802 StubRoutines::_intrinsic_exp = SharedRuntime::dexp; |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2803 StubRoutines::_intrinsic_pow = SharedRuntime::dpow; |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2804 } |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
2805 |
0 | 2806 #undef __ |
2807 #define __ masm-> | |
2808 | |
2809 // Continuation point for throwing of implicit exceptions that are | |
2810 // not handled in the current activation. Fabricates an exception | |
2811 // oop and initiates normal exception dispatching in this | |
2812 // frame. Since we need to preserve callee-saved values (currently | |
2813 // only for C2, but done for C1 as well) we need a callee-saved oop | |
2814 // map and therefore have to make these stubs into RuntimeStubs | |
2815 // rather than BufferBlobs. If the compiler needs all registers to | |
2816 // be preserved between the fault point and the exception handler | |
2817 // then it must assume responsibility for that in | |
2818 // AbstractCompiler::continuation_for_implicit_null_exception or | |
2819 // continuation_for_implicit_division_by_zero_exception. All other | |
2820 // implicit exceptions (e.g., NullPointerException or | |
2821 // AbstractMethodError on entry) are either at call sites or | |
2822 // otherwise assume that stack unwinding will be initiated, so | |
2823 // caller saved registers were assumed volatile in the compiler. | |
2824 address generate_throw_exception(const char* name, | |
2825 address runtime_entry, | |
2826 bool restore_saved_exception_pc) { | |
2827 // Information about frame layout at time of blocking runtime call. | |
2828 // Note that we only have to preserve callee-saved registers since | |
2829 // the compilers are responsible for supplying a continuation point | |
2830 // if they expect all registers to be preserved. | |
2831 enum layout { | |
2832 rbp_off = frame::arg_reg_save_area_bytes/BytesPerInt, | |
2833 rbp_off2, | |
2834 return_off, | |
2835 return_off2, | |
2836 framesize // inclusive of return address | |
2837 }; | |
2838 | |
2839 int insts_size = 512; | |
2840 int locs_size = 64; | |
2841 | |
2842 CodeBuffer code(name, insts_size, locs_size); | |
2843 OopMapSet* oop_maps = new OopMapSet(); | |
2844 MacroAssembler* masm = new MacroAssembler(&code); | |
2845 | |
2846 address start = __ pc(); | |
2847 | |
2848 // This is an inlined and slightly modified version of call_VM | |
2849 // which has the ability to fetch the return PC out of | |
2850 // thread-local storage and also sets up last_Java_sp slightly | |
2851 // differently than the real call_VM | |
2852 if (restore_saved_exception_pc) { | |
304 | 2853 __ movptr(rax, |
2854 Address(r15_thread, | |
2855 in_bytes(JavaThread::saved_exception_pc_offset()))); | |
2856 __ push(rax); | |
0 | 2857 } |
2858 | |
2859 __ enter(); // required for proper stackwalking of RuntimeStub frame | |
2860 | |
2861 assert(is_even(framesize/2), "sp not 16-byte aligned"); | |
2862 | |
2863 // return address and rbp are already in place | |
304 | 2864 __ subptr(rsp, (framesize-4) << LogBytesPerInt); // prolog |
0 | 2865 |
2866 int frame_complete = __ pc() - start; | |
2867 | |
2868 // Set up last_Java_sp and last_Java_fp | |
2869 __ set_last_Java_frame(rsp, rbp, NULL); | |
2870 | |
2871 // Call runtime | |
304 | 2872 __ movptr(c_rarg0, r15_thread); |
0 | 2873 BLOCK_COMMENT("call runtime_entry"); |
2874 __ call(RuntimeAddress(runtime_entry)); | |
2875 | |
2876 // Generate oop map | |
2877 OopMap* map = new OopMap(framesize, 0); | |
2878 | |
2879 oop_maps->add_gc_map(__ pc() - start, map); | |
2880 | |
2881 __ reset_last_Java_frame(true, false); | |
2882 | |
2883 __ leave(); // required for proper stackwalking of RuntimeStub frame | |
2884 | |
2885 // check for pending exceptions | |
2886 #ifdef ASSERT | |
2887 Label L; | |
304 | 2888 __ cmpptr(Address(r15_thread, Thread::pending_exception_offset()), |
2889 (int32_t) NULL_WORD); | |
0 | 2890 __ jcc(Assembler::notEqual, L); |
2891 __ should_not_reach_here(); | |
2892 __ bind(L); | |
2893 #endif // ASSERT | |
2894 __ jump(RuntimeAddress(StubRoutines::forward_exception_entry())); | |
2895 | |
2896 | |
2897 // codeBlob framesize is in words (not VMRegImpl::slot_size) | |
2898 RuntimeStub* stub = | |
2899 RuntimeStub::new_runtime_stub(name, | |
2900 &code, | |
2901 frame_complete, | |
2902 (framesize >> (LogBytesPerWord - LogBytesPerInt)), | |
2903 oop_maps, false); | |
2904 return stub->entry_point(); | |
2905 } | |
2906 | |
2907 // Initialization | |
2908 void generate_initial() { | |
2909 // Generates all stubs and initializes the entry points | |
2910 | |
2911 // This platform-specific stub is needed by generate_call_stub() | |
304 | 2912 StubRoutines::x86::_mxcsr_std = generate_fp_mask("mxcsr_std", 0x0000000000001F80); |
0 | 2913 |
2914 // entry points that exist in all platforms Note: This is code | |
2915 // that could be shared among different platforms - however the | |
2916 // benefit seems to be smaller than the disadvantage of having a | |
2917 // much more complicated generator structure. See also comment in | |
2918 // stubRoutines.hpp. | |
2919 | |
2920 StubRoutines::_forward_exception_entry = generate_forward_exception(); | |
2921 | |
2922 StubRoutines::_call_stub_entry = | |
2923 generate_call_stub(StubRoutines::_call_stub_return_address); | |
2924 | |
2925 // is referenced by megamorphic call | |
2926 StubRoutines::_catch_exception_entry = generate_catch_exception(); | |
2927 | |
2928 // atomic calls | |
2929 StubRoutines::_atomic_xchg_entry = generate_atomic_xchg(); | |
2930 StubRoutines::_atomic_xchg_ptr_entry = generate_atomic_xchg_ptr(); | |
2931 StubRoutines::_atomic_cmpxchg_entry = generate_atomic_cmpxchg(); | |
2932 StubRoutines::_atomic_cmpxchg_long_entry = generate_atomic_cmpxchg_long(); | |
2933 StubRoutines::_atomic_add_entry = generate_atomic_add(); | |
2934 StubRoutines::_atomic_add_ptr_entry = generate_atomic_add_ptr(); | |
2935 StubRoutines::_fence_entry = generate_orderaccess_fence(); | |
2936 | |
2937 StubRoutines::_handler_for_unsafe_access_entry = | |
2938 generate_handler_for_unsafe_access(); | |
2939 | |
2940 // platform dependent | |
304 | 2941 StubRoutines::x86::_get_previous_fp_entry = generate_get_previous_fp(); |
2942 | |
2943 StubRoutines::x86::_verify_mxcsr_entry = generate_verify_mxcsr(); | |
0 | 2944 } |
2945 | |
2946 void generate_all() { | |
2947 // Generates all stubs and initializes the entry points | |
2948 | |
2949 // These entry points require SharedInfo::stack0 to be set up in | |
2950 // non-core builds and need to be relocatable, so they each | |
2951 // fabricate a RuntimeStub internally. | |
2952 StubRoutines::_throw_AbstractMethodError_entry = | |
2953 generate_throw_exception("AbstractMethodError throw_exception", | |
2954 CAST_FROM_FN_PTR(address, | |
2955 SharedRuntime:: | |
2956 throw_AbstractMethodError), | |
2957 false); | |
2958 | |
16
f8236e79048a
6664627: Merge changes made only in hotspot 11 forward to jdk 7
dcubed
parents:
0
diff
changeset
|
2959 StubRoutines::_throw_IncompatibleClassChangeError_entry = |
f8236e79048a
6664627: Merge changes made only in hotspot 11 forward to jdk 7
dcubed
parents:
0
diff
changeset
|
2960 generate_throw_exception("IncompatibleClassChangeError throw_exception", |
f8236e79048a
6664627: Merge changes made only in hotspot 11 forward to jdk 7
dcubed
parents:
0
diff
changeset
|
2961 CAST_FROM_FN_PTR(address, |
f8236e79048a
6664627: Merge changes made only in hotspot 11 forward to jdk 7
dcubed
parents:
0
diff
changeset
|
2962 SharedRuntime:: |
f8236e79048a
6664627: Merge changes made only in hotspot 11 forward to jdk 7
dcubed
parents:
0
diff
changeset
|
2963 throw_IncompatibleClassChangeError), |
f8236e79048a
6664627: Merge changes made only in hotspot 11 forward to jdk 7
dcubed
parents:
0
diff
changeset
|
2964 false); |
f8236e79048a
6664627: Merge changes made only in hotspot 11 forward to jdk 7
dcubed
parents:
0
diff
changeset
|
2965 |
0 | 2966 StubRoutines::_throw_ArithmeticException_entry = |
2967 generate_throw_exception("ArithmeticException throw_exception", | |
2968 CAST_FROM_FN_PTR(address, | |
2969 SharedRuntime:: | |
2970 throw_ArithmeticException), | |
2971 true); | |
2972 | |
2973 StubRoutines::_throw_NullPointerException_entry = | |
2974 generate_throw_exception("NullPointerException throw_exception", | |
2975 CAST_FROM_FN_PTR(address, | |
2976 SharedRuntime:: | |
2977 throw_NullPointerException), | |
2978 true); | |
2979 | |
2980 StubRoutines::_throw_NullPointerException_at_call_entry = | |
2981 generate_throw_exception("NullPointerException at call throw_exception", | |
2982 CAST_FROM_FN_PTR(address, | |
2983 SharedRuntime:: | |
2984 throw_NullPointerException_at_call), | |
2985 false); | |
2986 | |
2987 StubRoutines::_throw_StackOverflowError_entry = | |
2988 generate_throw_exception("StackOverflowError throw_exception", | |
2989 CAST_FROM_FN_PTR(address, | |
2990 SharedRuntime:: | |
2991 throw_StackOverflowError), | |
2992 false); | |
2993 | |
2994 // entry points that are platform specific | |
304 | 2995 StubRoutines::x86::_f2i_fixup = generate_f2i_fixup(); |
2996 StubRoutines::x86::_f2l_fixup = generate_f2l_fixup(); | |
2997 StubRoutines::x86::_d2i_fixup = generate_d2i_fixup(); | |
2998 StubRoutines::x86::_d2l_fixup = generate_d2l_fixup(); | |
2999 | |
3000 StubRoutines::x86::_float_sign_mask = generate_fp_mask("float_sign_mask", 0x7FFFFFFF7FFFFFFF); | |
3001 StubRoutines::x86::_float_sign_flip = generate_fp_mask("float_sign_flip", 0x8000000080000000); | |
3002 StubRoutines::x86::_double_sign_mask = generate_fp_mask("double_sign_mask", 0x7FFFFFFFFFFFFFFF); | |
3003 StubRoutines::x86::_double_sign_flip = generate_fp_mask("double_sign_flip", 0x8000000000000000); | |
0 | 3004 |
3005 // support for verify_oop (must happen after universe_init) | |
3006 StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop(); | |
3007 | |
3008 // arraycopy stubs used by compilers | |
3009 generate_arraycopy_stubs(); | |
1108 | 3010 |
1174
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
1108
diff
changeset
|
3011 generate_math_stubs(); |
0 | 3012 } |
3013 | |
3014 public: | |
3015 StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) { | |
3016 if (all) { | |
3017 generate_all(); | |
3018 } else { | |
3019 generate_initial(); | |
3020 } | |
3021 } | |
3022 }; // end class declaration | |
3023 | |
3024 address StubGenerator::disjoint_byte_copy_entry = NULL; | |
3025 address StubGenerator::disjoint_short_copy_entry = NULL; | |
3026 address StubGenerator::disjoint_int_copy_entry = NULL; | |
3027 address StubGenerator::disjoint_long_copy_entry = NULL; | |
3028 address StubGenerator::disjoint_oop_copy_entry = NULL; | |
3029 | |
3030 address StubGenerator::byte_copy_entry = NULL; | |
3031 address StubGenerator::short_copy_entry = NULL; | |
3032 address StubGenerator::int_copy_entry = NULL; | |
3033 address StubGenerator::long_copy_entry = NULL; | |
3034 address StubGenerator::oop_copy_entry = NULL; | |
3035 | |
3036 address StubGenerator::checkcast_copy_entry = NULL; | |
3037 | |
3038 void StubGenerator_generate(CodeBuffer* code, bool all) { | |
3039 StubGenerator g(code, all); | |
3040 } |