Mercurial > hg > truffle
annotate src/cpu/x86/vm/stubGenerator_x86_32.cpp @ 1493:5dabb4e73380
Merge
author | trims |
---|---|
date | Thu, 06 May 2010 13:03:03 -0700 |
parents | 93767e6a2dfd |
children | 2338d41fbd81 |
rev | line source |
---|---|
0 | 1 /* |
1174
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2 * Copyright 1999-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_32.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-> | |
304 | 33 #define a__ ((Assembler*)_masm)-> |
0 | 34 |
35 #ifdef PRODUCT | |
36 #define BLOCK_COMMENT(str) /* nothing */ | |
37 #else | |
38 #define BLOCK_COMMENT(str) __ block_comment(str) | |
39 #endif | |
40 | |
41 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":") | |
42 | |
43 const int MXCSR_MASK = 0xFFC0; // Mask out any pending exceptions | |
44 const int FPU_CNTRL_WRD_MASK = 0xFFFF; | |
45 | |
46 // ------------------------------------------------------------------------------------------------------------------------- | |
47 // Stub Code definitions | |
48 | |
49 static address handle_unsafe_access() { | |
50 JavaThread* thread = JavaThread::current(); | |
51 address pc = thread->saved_exception_pc(); | |
52 // pc is the instruction which we must emulate | |
53 // doing a no-op is fine: return garbage from the load | |
54 // therefore, compute npc | |
55 address npc = Assembler::locate_next_instruction(pc); | |
56 | |
57 // request an async exception | |
58 thread->set_pending_unsafe_access_error(); | |
59 | |
60 // return address of next instruction to execute | |
61 return npc; | |
62 } | |
63 | |
64 class StubGenerator: public StubCodeGenerator { | |
65 private: | |
66 | |
67 #ifdef PRODUCT | |
68 #define inc_counter_np(counter) (0) | |
69 #else | |
70 void inc_counter_np_(int& counter) { | |
304 | 71 __ incrementl(ExternalAddress((address)&counter)); |
0 | 72 } |
73 #define inc_counter_np(counter) \ | |
74 BLOCK_COMMENT("inc_counter " #counter); \ | |
75 inc_counter_np_(counter); | |
76 #endif //PRODUCT | |
77 | |
78 void inc_copy_counter_np(BasicType t) { | |
79 #ifndef PRODUCT | |
80 switch (t) { | |
81 case T_BYTE: inc_counter_np(SharedRuntime::_jbyte_array_copy_ctr); return; | |
82 case T_SHORT: inc_counter_np(SharedRuntime::_jshort_array_copy_ctr); return; | |
83 case T_INT: inc_counter_np(SharedRuntime::_jint_array_copy_ctr); return; | |
84 case T_LONG: inc_counter_np(SharedRuntime::_jlong_array_copy_ctr); return; | |
85 case T_OBJECT: inc_counter_np(SharedRuntime::_oop_array_copy_ctr); return; | |
86 } | |
87 ShouldNotReachHere(); | |
88 #endif //PRODUCT | |
89 } | |
90 | |
91 //------------------------------------------------------------------------------------------------------------------------ | |
92 // Call stubs are used to call Java from C | |
93 // | |
94 // [ return_from_Java ] <--- rsp | |
95 // [ argument word n ] | |
96 // ... | |
97 // -N [ argument word 1 ] | |
98 // -7 [ Possible padding for stack alignment ] | |
99 // -6 [ Possible padding for stack alignment ] | |
100 // -5 [ Possible padding for stack alignment ] | |
101 // -4 [ mxcsr save ] <--- rsp_after_call | |
102 // -3 [ saved rbx, ] | |
103 // -2 [ saved rsi ] | |
104 // -1 [ saved rdi ] | |
105 // 0 [ saved rbp, ] <--- rbp, | |
106 // 1 [ return address ] | |
107 // 2 [ ptr. to call wrapper ] | |
108 // 3 [ result ] | |
109 // 4 [ result_type ] | |
110 // 5 [ method ] | |
111 // 6 [ entry_point ] | |
112 // 7 [ parameters ] | |
113 // 8 [ parameter_size ] | |
114 // 9 [ thread ] | |
115 | |
116 | |
117 address generate_call_stub(address& return_address) { | |
118 StubCodeMark mark(this, "StubRoutines", "call_stub"); | |
119 address start = __ pc(); | |
120 | |
121 // stub code parameters / addresses | |
122 assert(frame::entry_frame_call_wrapper_offset == 2, "adjust this code"); | |
123 bool sse_save = false; | |
124 const Address rsp_after_call(rbp, -4 * wordSize); // same as in generate_catch_exception()! | |
125 const int locals_count_in_bytes (4*wordSize); | |
126 const Address mxcsr_save (rbp, -4 * wordSize); | |
127 const Address saved_rbx (rbp, -3 * wordSize); | |
128 const Address saved_rsi (rbp, -2 * wordSize); | |
129 const Address saved_rdi (rbp, -1 * wordSize); | |
130 const Address result (rbp, 3 * wordSize); | |
131 const Address result_type (rbp, 4 * wordSize); | |
132 const Address method (rbp, 5 * wordSize); | |
133 const Address entry_point (rbp, 6 * wordSize); | |
134 const Address parameters (rbp, 7 * wordSize); | |
135 const Address parameter_size(rbp, 8 * wordSize); | |
136 const Address thread (rbp, 9 * wordSize); // same as in generate_catch_exception()! | |
137 sse_save = UseSSE > 0; | |
138 | |
139 // stub code | |
140 __ enter(); | |
304 | 141 __ movptr(rcx, parameter_size); // parameter counter |
142 __ shlptr(rcx, Interpreter::logStackElementSize()); // convert parameter count to bytes | |
143 __ addptr(rcx, locals_count_in_bytes); // reserve space for register saves | |
144 __ subptr(rsp, rcx); | |
145 __ andptr(rsp, -(StackAlignmentInBytes)); // Align stack | |
0 | 146 |
147 // save rdi, rsi, & rbx, according to C calling conventions | |
304 | 148 __ movptr(saved_rdi, rdi); |
149 __ movptr(saved_rsi, rsi); | |
150 __ movptr(saved_rbx, rbx); | |
0 | 151 // save and initialize %mxcsr |
152 if (sse_save) { | |
153 Label skip_ldmx; | |
154 __ stmxcsr(mxcsr_save); | |
155 __ movl(rax, mxcsr_save); | |
156 __ andl(rax, MXCSR_MASK); // Only check control and mask bits | |
157 ExternalAddress mxcsr_std(StubRoutines::addr_mxcsr_std()); | |
158 __ cmp32(rax, mxcsr_std); | |
159 __ jcc(Assembler::equal, skip_ldmx); | |
160 __ ldmxcsr(mxcsr_std); | |
161 __ bind(skip_ldmx); | |
162 } | |
163 | |
164 // make sure the control word is correct. | |
165 __ fldcw(ExternalAddress(StubRoutines::addr_fpu_cntrl_wrd_std())); | |
166 | |
167 #ifdef ASSERT | |
168 // make sure we have no pending exceptions | |
169 { Label L; | |
304 | 170 __ movptr(rcx, thread); |
171 __ cmpptr(Address(rcx, Thread::pending_exception_offset()), (int32_t)NULL_WORD); | |
0 | 172 __ jcc(Assembler::equal, L); |
173 __ stop("StubRoutines::call_stub: entered with pending exception"); | |
174 __ bind(L); | |
175 } | |
176 #endif | |
177 | |
178 // pass parameters if any | |
179 BLOCK_COMMENT("pass parameters if any"); | |
180 Label parameters_done; | |
181 __ movl(rcx, parameter_size); // parameter counter | |
182 __ testl(rcx, rcx); | |
183 __ jcc(Assembler::zero, parameters_done); | |
184 | |
185 // parameter passing loop | |
186 | |
187 Label loop; | |
188 // Copy Java parameters in reverse order (receiver last) | |
189 // Note that the argument order is inverted in the process | |
190 // source is rdx[rcx: N-1..0] | |
191 // dest is rsp[rbx: 0..N-1] | |
192 | |
304 | 193 __ movptr(rdx, parameters); // parameter pointer |
194 __ xorptr(rbx, rbx); | |
0 | 195 |
196 __ BIND(loop); | |
197 if (TaggedStackInterpreter) { | |
304 | 198 __ movptr(rax, Address(rdx, rcx, Interpreter::stackElementScale(), |
0 | 199 -2*wordSize)); // get tag |
304 | 200 __ movptr(Address(rsp, rbx, Interpreter::stackElementScale(), |
0 | 201 Interpreter::expr_tag_offset_in_bytes(0)), rax); // store tag |
202 } | |
203 | |
204 // get parameter | |
304 | 205 __ movptr(rax, Address(rdx, rcx, Interpreter::stackElementScale(), -wordSize)); |
206 __ movptr(Address(rsp, rbx, Interpreter::stackElementScale(), | |
0 | 207 Interpreter::expr_offset_in_bytes(0)), rax); // store parameter |
208 __ increment(rbx); | |
209 __ decrement(rcx); | |
210 __ jcc(Assembler::notZero, loop); | |
211 | |
212 // call Java function | |
213 __ BIND(parameters_done); | |
304 | 214 __ movptr(rbx, method); // get methodOop |
215 __ movptr(rax, entry_point); // get entry_point | |
216 __ mov(rsi, rsp); // set sender sp | |
0 | 217 BLOCK_COMMENT("call Java function"); |
218 __ call(rax); | |
219 | |
220 BLOCK_COMMENT("call_stub_return_address:"); | |
221 return_address = __ pc(); | |
222 | |
223 Label common_return; | |
224 | |
225 __ BIND(common_return); | |
226 | |
227 // store result depending on type | |
228 // (everything that is not T_LONG, T_FLOAT or T_DOUBLE is treated as T_INT) | |
304 | 229 __ movptr(rdi, result); |
0 | 230 Label is_long, is_float, is_double, exit; |
231 __ movl(rsi, result_type); | |
232 __ cmpl(rsi, T_LONG); | |
233 __ jcc(Assembler::equal, is_long); | |
234 __ cmpl(rsi, T_FLOAT); | |
235 __ jcc(Assembler::equal, is_float); | |
236 __ cmpl(rsi, T_DOUBLE); | |
237 __ jcc(Assembler::equal, is_double); | |
238 | |
239 // handle T_INT case | |
240 __ movl(Address(rdi, 0), rax); | |
241 __ BIND(exit); | |
242 | |
243 // check that FPU stack is empty | |
244 __ verify_FPU(0, "generate_call_stub"); | |
245 | |
246 // pop parameters | |
304 | 247 __ lea(rsp, rsp_after_call); |
0 | 248 |
249 // restore %mxcsr | |
250 if (sse_save) { | |
251 __ ldmxcsr(mxcsr_save); | |
252 } | |
253 | |
254 // restore rdi, rsi and rbx, | |
304 | 255 __ movptr(rbx, saved_rbx); |
256 __ movptr(rsi, saved_rsi); | |
257 __ movptr(rdi, saved_rdi); | |
258 __ addptr(rsp, 4*wordSize); | |
0 | 259 |
260 // return | |
304 | 261 __ pop(rbp); |
0 | 262 __ ret(0); |
263 | |
264 // handle return types different from T_INT | |
265 __ BIND(is_long); | |
266 __ movl(Address(rdi, 0 * wordSize), rax); | |
267 __ movl(Address(rdi, 1 * wordSize), rdx); | |
268 __ jmp(exit); | |
269 | |
270 __ BIND(is_float); | |
271 // interpreter uses xmm0 for return values | |
272 if (UseSSE >= 1) { | |
273 __ movflt(Address(rdi, 0), xmm0); | |
274 } else { | |
275 __ fstp_s(Address(rdi, 0)); | |
276 } | |
277 __ jmp(exit); | |
278 | |
279 __ BIND(is_double); | |
280 // interpreter uses xmm0 for return values | |
281 if (UseSSE >= 2) { | |
282 __ movdbl(Address(rdi, 0), xmm0); | |
283 } else { | |
284 __ fstp_d(Address(rdi, 0)); | |
285 } | |
286 __ jmp(exit); | |
287 | |
288 // If we call compiled code directly from the call stub we will | |
289 // need to adjust the return back to the call stub to a specialized | |
290 // piece of code that can handle compiled results and cleaning the fpu | |
291 // stack. compiled code will be set to return here instead of the | |
292 // return above that handles interpreter returns. | |
293 | |
294 BLOCK_COMMENT("call_stub_compiled_return:"); | |
304 | 295 StubRoutines::x86::set_call_stub_compiled_return( __ pc()); |
0 | 296 |
297 #ifdef COMPILER2 | |
298 if (UseSSE >= 2) { | |
299 __ verify_FPU(0, "call_stub_compiled_return"); | |
300 } else { | |
301 for (int i = 1; i < 8; i++) { | |
302 __ ffree(i); | |
303 } | |
304 | |
305 // UseSSE <= 1 so double result should be left on TOS | |
306 __ movl(rsi, result_type); | |
307 __ cmpl(rsi, T_DOUBLE); | |
308 __ jcc(Assembler::equal, common_return); | |
309 if (UseSSE == 0) { | |
310 // UseSSE == 0 so float result should be left on TOS | |
311 __ cmpl(rsi, T_FLOAT); | |
312 __ jcc(Assembler::equal, common_return); | |
313 } | |
314 __ ffree(0); | |
315 } | |
316 #endif /* COMPILER2 */ | |
317 __ jmp(common_return); | |
318 | |
319 return start; | |
320 } | |
321 | |
322 | |
323 //------------------------------------------------------------------------------------------------------------------------ | |
324 // Return point for a Java call if there's an exception thrown in Java code. | |
325 // The exception is caught and transformed into a pending exception stored in | |
326 // JavaThread that can be tested from within the VM. | |
327 // | |
328 // Note: Usually the parameters are removed by the callee. In case of an exception | |
329 // crossing an activation frame boundary, that is not the case if the callee | |
330 // is compiled code => need to setup the rsp. | |
331 // | |
332 // rax,: exception oop | |
333 | |
334 address generate_catch_exception() { | |
335 StubCodeMark mark(this, "StubRoutines", "catch_exception"); | |
336 const Address rsp_after_call(rbp, -4 * wordSize); // same as in generate_call_stub()! | |
337 const Address thread (rbp, 9 * wordSize); // same as in generate_call_stub()! | |
338 address start = __ pc(); | |
339 | |
340 // get thread directly | |
304 | 341 __ movptr(rcx, thread); |
0 | 342 #ifdef ASSERT |
343 // verify that threads correspond | |
344 { Label L; | |
345 __ get_thread(rbx); | |
304 | 346 __ cmpptr(rbx, rcx); |
0 | 347 __ jcc(Assembler::equal, L); |
348 __ stop("StubRoutines::catch_exception: threads must correspond"); | |
349 __ bind(L); | |
350 } | |
351 #endif | |
352 // set pending exception | |
353 __ verify_oop(rax); | |
304 | 354 __ movptr(Address(rcx, Thread::pending_exception_offset()), rax ); |
0 | 355 __ lea(Address(rcx, Thread::exception_file_offset ()), |
356 ExternalAddress((address)__FILE__)); | |
357 __ movl(Address(rcx, Thread::exception_line_offset ()), __LINE__ ); | |
358 // complete return to VM | |
359 assert(StubRoutines::_call_stub_return_address != NULL, "_call_stub_return_address must have been generated before"); | |
360 __ jump(RuntimeAddress(StubRoutines::_call_stub_return_address)); | |
361 | |
362 return start; | |
363 } | |
364 | |
365 | |
366 //------------------------------------------------------------------------------------------------------------------------ | |
367 // Continuation point for runtime calls returning with a pending exception. | |
368 // The pending exception check happened in the runtime or native call stub. | |
369 // The pending exception in Thread is converted into a Java-level exception. | |
370 // | |
371 // Contract with Java-level exception handlers: | |
1295 | 372 // rax: exception |
0 | 373 // rdx: throwing pc |
374 // | |
375 // NOTE: At entry of this stub, exception-pc must be on stack !! | |
376 | |
377 address generate_forward_exception() { | |
378 StubCodeMark mark(this, "StubRoutines", "forward exception"); | |
379 address start = __ pc(); | |
1295 | 380 const Register thread = rcx; |
381 | |
382 // other registers used in this stub | |
383 const Register exception_oop = rax; | |
384 const Register handler_addr = rbx; | |
385 const Register exception_pc = rdx; | |
0 | 386 |
387 // Upon entry, the sp points to the return address returning into Java | |
388 // (interpreted or compiled) code; i.e., the return address becomes the | |
389 // throwing pc. | |
390 // | |
391 // Arguments pushed before the runtime call are still on the stack but | |
392 // the exception handler will reset the stack pointer -> ignore them. | |
393 // A potential result in registers can be ignored as well. | |
394 | |
395 #ifdef ASSERT | |
396 // make sure this code is only executed if there is a pending exception | |
397 { Label L; | |
1295 | 398 __ get_thread(thread); |
399 __ cmpptr(Address(thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); | |
0 | 400 __ jcc(Assembler::notEqual, L); |
401 __ stop("StubRoutines::forward exception: no pending exception (1)"); | |
402 __ bind(L); | |
403 } | |
404 #endif | |
405 | |
406 // compute exception handler into rbx, | |
1295 | 407 __ get_thread(thread); |
408 __ movptr(exception_pc, Address(rsp, 0)); | |
0 | 409 BLOCK_COMMENT("call exception_handler_for_return_address"); |
1295 | 410 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), thread, exception_pc); |
411 __ mov(handler_addr, rax); | |
0 | 412 |
1295 | 413 // setup rax & rdx, remove return address & clear pending exception |
414 __ get_thread(thread); | |
415 __ pop(exception_pc); | |
416 __ movptr(exception_oop, Address(thread, Thread::pending_exception_offset())); | |
417 __ movptr(Address(thread, Thread::pending_exception_offset()), NULL_WORD); | |
0 | 418 |
419 #ifdef ASSERT | |
420 // make sure exception is set | |
421 { Label L; | |
1295 | 422 __ testptr(exception_oop, exception_oop); |
0 | 423 __ jcc(Assembler::notEqual, L); |
424 __ stop("StubRoutines::forward exception: no pending exception (2)"); | |
425 __ bind(L); | |
426 } | |
427 #endif | |
428 | |
1295 | 429 // Verify that there is really a valid exception in RAX. |
430 __ verify_oop(exception_oop); | |
431 | |
432 // Restore SP from BP if the exception PC is a MethodHandle call site. | |
1368
93767e6a2dfd
6941529: SharedRuntime::raw_exception_handler_for_return_address must reset thread MethodHandle flag
twisti
parents:
1365
diff
changeset
|
433 __ cmpl(Address(thread, JavaThread::is_method_handle_return_offset()), 0); |
1295 | 434 __ cmovptr(Assembler::notEqual, rsp, rbp); |
435 | |
0 | 436 // continue at exception handler (return address removed) |
1295 | 437 // rax: exception |
438 // rbx: exception handler | |
0 | 439 // rdx: throwing pc |
1295 | 440 __ jmp(handler_addr); |
0 | 441 |
442 return start; | |
443 } | |
444 | |
445 | |
446 //---------------------------------------------------------------------------------------------------- | |
447 // Support for jint Atomic::xchg(jint exchange_value, volatile jint* dest) | |
448 // | |
449 // xchg exists as far back as 8086, lock needed for MP only | |
450 // Stack layout immediately after call: | |
451 // | |
452 // 0 [ret addr ] <--- rsp | |
453 // 1 [ ex ] | |
454 // 2 [ dest ] | |
455 // | |
456 // Result: *dest <- ex, return (old *dest) | |
457 // | |
458 // Note: win32 does not currently use this code | |
459 | |
460 address generate_atomic_xchg() { | |
461 StubCodeMark mark(this, "StubRoutines", "atomic_xchg"); | |
462 address start = __ pc(); | |
463 | |
304 | 464 __ push(rdx); |
0 | 465 Address exchange(rsp, 2 * wordSize); |
466 Address dest_addr(rsp, 3 * wordSize); | |
467 __ movl(rax, exchange); | |
304 | 468 __ movptr(rdx, dest_addr); |
469 __ xchgl(rax, Address(rdx, 0)); | |
470 __ pop(rdx); | |
0 | 471 __ ret(0); |
472 | |
473 return start; | |
474 } | |
475 | |
476 //---------------------------------------------------------------------------------------------------- | |
477 // Support for void verify_mxcsr() | |
478 // | |
479 // This routine is used with -Xcheck:jni to verify that native | |
480 // JNI code does not return to Java code without restoring the | |
481 // MXCSR register to our expected state. | |
482 | |
483 | |
484 address generate_verify_mxcsr() { | |
485 StubCodeMark mark(this, "StubRoutines", "verify_mxcsr"); | |
486 address start = __ pc(); | |
487 | |
488 const Address mxcsr_save(rsp, 0); | |
489 | |
490 if (CheckJNICalls && UseSSE > 0 ) { | |
491 Label ok_ret; | |
492 ExternalAddress mxcsr_std(StubRoutines::addr_mxcsr_std()); | |
304 | 493 __ push(rax); |
494 __ subptr(rsp, wordSize); // allocate a temp location | |
0 | 495 __ stmxcsr(mxcsr_save); |
496 __ movl(rax, mxcsr_save); | |
497 __ andl(rax, MXCSR_MASK); | |
498 __ cmp32(rax, mxcsr_std); | |
499 __ jcc(Assembler::equal, ok_ret); | |
500 | |
501 __ warn("MXCSR changed by native JNI code."); | |
502 | |
503 __ ldmxcsr(mxcsr_std); | |
504 | |
505 __ bind(ok_ret); | |
304 | 506 __ addptr(rsp, wordSize); |
507 __ pop(rax); | |
0 | 508 } |
509 | |
510 __ ret(0); | |
511 | |
512 return start; | |
513 } | |
514 | |
515 | |
516 //--------------------------------------------------------------------------- | |
517 // Support for void verify_fpu_cntrl_wrd() | |
518 // | |
519 // This routine is used with -Xcheck:jni to verify that native | |
520 // JNI code does not return to Java code without restoring the | |
521 // FP control word to our expected state. | |
522 | |
523 address generate_verify_fpu_cntrl_wrd() { | |
524 StubCodeMark mark(this, "StubRoutines", "verify_spcw"); | |
525 address start = __ pc(); | |
526 | |
527 const Address fpu_cntrl_wrd_save(rsp, 0); | |
528 | |
529 if (CheckJNICalls) { | |
530 Label ok_ret; | |
304 | 531 __ push(rax); |
532 __ subptr(rsp, wordSize); // allocate a temp location | |
0 | 533 __ fnstcw(fpu_cntrl_wrd_save); |
534 __ movl(rax, fpu_cntrl_wrd_save); | |
535 __ andl(rax, FPU_CNTRL_WRD_MASK); | |
536 ExternalAddress fpu_std(StubRoutines::addr_fpu_cntrl_wrd_std()); | |
537 __ cmp32(rax, fpu_std); | |
538 __ jcc(Assembler::equal, ok_ret); | |
539 | |
540 __ warn("Floating point control word changed by native JNI code."); | |
541 | |
542 __ fldcw(fpu_std); | |
543 | |
544 __ bind(ok_ret); | |
304 | 545 __ addptr(rsp, wordSize); |
546 __ pop(rax); | |
0 | 547 } |
548 | |
549 __ ret(0); | |
550 | |
551 return start; | |
552 } | |
553 | |
554 //--------------------------------------------------------------------------- | |
555 // Wrapper for slow-case handling of double-to-integer conversion | |
556 // d2i or f2i fast case failed either because it is nan or because | |
557 // of under/overflow. | |
558 // Input: FPU TOS: float value | |
559 // Output: rax, (rdx): integer (long) result | |
560 | |
561 address generate_d2i_wrapper(BasicType t, address fcn) { | |
562 StubCodeMark mark(this, "StubRoutines", "d2i_wrapper"); | |
563 address start = __ pc(); | |
564 | |
565 // Capture info about frame layout | |
566 enum layout { FPUState_off = 0, | |
567 rbp_off = FPUStateSizeInWords, | |
568 rdi_off, | |
569 rsi_off, | |
570 rcx_off, | |
571 rbx_off, | |
572 saved_argument_off, | |
573 saved_argument_off2, // 2nd half of double | |
574 framesize | |
575 }; | |
576 | |
577 assert(FPUStateSizeInWords == 27, "update stack layout"); | |
578 | |
579 // Save outgoing argument to stack across push_FPU_state() | |
304 | 580 __ subptr(rsp, wordSize * 2); |
0 | 581 __ fstp_d(Address(rsp, 0)); |
582 | |
583 // Save CPU & FPU state | |
304 | 584 __ push(rbx); |
585 __ push(rcx); | |
586 __ push(rsi); | |
587 __ push(rdi); | |
588 __ push(rbp); | |
0 | 589 __ push_FPU_state(); |
590 | |
591 // push_FPU_state() resets the FP top of stack | |
592 // Load original double into FP top of stack | |
593 __ fld_d(Address(rsp, saved_argument_off * wordSize)); | |
594 // Store double into stack as outgoing argument | |
304 | 595 __ subptr(rsp, wordSize*2); |
0 | 596 __ fst_d(Address(rsp, 0)); |
597 | |
598 // Prepare FPU for doing math in C-land | |
599 __ empty_FPU_stack(); | |
600 // Call the C code to massage the double. Result in EAX | |
601 if (t == T_INT) | |
602 { BLOCK_COMMENT("SharedRuntime::d2i"); } | |
603 else if (t == T_LONG) | |
604 { BLOCK_COMMENT("SharedRuntime::d2l"); } | |
605 __ call_VM_leaf( fcn, 2 ); | |
606 | |
607 // Restore CPU & FPU state | |
608 __ pop_FPU_state(); | |
304 | 609 __ pop(rbp); |
610 __ pop(rdi); | |
611 __ pop(rsi); | |
612 __ pop(rcx); | |
613 __ pop(rbx); | |
614 __ addptr(rsp, wordSize * 2); | |
0 | 615 |
616 __ ret(0); | |
617 | |
618 return start; | |
619 } | |
620 | |
621 | |
622 //--------------------------------------------------------------------------- | |
623 // The following routine generates a subroutine to throw an asynchronous | |
624 // UnknownError when an unsafe access gets a fault that could not be | |
625 // reasonably prevented by the programmer. (Example: SIGBUS/OBJERR.) | |
626 address generate_handler_for_unsafe_access() { | |
627 StubCodeMark mark(this, "StubRoutines", "handler_for_unsafe_access"); | |
628 address start = __ pc(); | |
629 | |
304 | 630 __ push(0); // hole for return address-to-be |
631 __ pusha(); // push registers | |
0 | 632 Address next_pc(rsp, RegisterImpl::number_of_registers * BytesPerWord); |
633 BLOCK_COMMENT("call handle_unsafe_access"); | |
634 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, handle_unsafe_access))); | |
304 | 635 __ movptr(next_pc, rax); // stuff next address |
636 __ popa(); | |
0 | 637 __ ret(0); // jump to next address |
638 | |
639 return start; | |
640 } | |
641 | |
642 | |
643 //---------------------------------------------------------------------------------------------------- | |
644 // Non-destructive plausibility checks for oops | |
645 | |
646 address generate_verify_oop() { | |
647 StubCodeMark mark(this, "StubRoutines", "verify_oop"); | |
648 address start = __ pc(); | |
649 | |
650 // Incoming arguments on stack after saving rax,: | |
651 // | |
652 // [tos ]: saved rdx | |
653 // [tos + 1]: saved EFLAGS | |
654 // [tos + 2]: return address | |
655 // [tos + 3]: char* error message | |
656 // [tos + 4]: oop object to verify | |
657 // [tos + 5]: saved rax, - saved by caller and bashed | |
658 | |
659 Label exit, error; | |
304 | 660 __ pushf(); |
661 __ incrementl(ExternalAddress((address) StubRoutines::verify_oop_count_addr())); | |
662 __ push(rdx); // save rdx | |
0 | 663 // make sure object is 'reasonable' |
304 | 664 __ movptr(rax, Address(rsp, 4 * wordSize)); // get object |
665 __ testptr(rax, rax); | |
0 | 666 __ jcc(Assembler::zero, exit); // if obj is NULL it is ok |
667 | |
668 // Check if the oop is in the right area of memory | |
669 const int oop_mask = Universe::verify_oop_mask(); | |
670 const int oop_bits = Universe::verify_oop_bits(); | |
304 | 671 __ mov(rdx, rax); |
672 __ andptr(rdx, oop_mask); | |
673 __ cmpptr(rdx, oop_bits); | |
0 | 674 __ jcc(Assembler::notZero, error); |
675 | |
676 // make sure klass is 'reasonable' | |
304 | 677 __ movptr(rax, Address(rax, oopDesc::klass_offset_in_bytes())); // get klass |
678 __ testptr(rax, rax); | |
0 | 679 __ jcc(Assembler::zero, error); // if klass is NULL it is broken |
680 | |
681 // Check if the klass is in the right area of memory | |
682 const int klass_mask = Universe::verify_klass_mask(); | |
683 const int klass_bits = Universe::verify_klass_bits(); | |
304 | 684 __ mov(rdx, rax); |
685 __ andptr(rdx, klass_mask); | |
686 __ cmpptr(rdx, klass_bits); | |
0 | 687 __ jcc(Assembler::notZero, error); |
688 | |
689 // make sure klass' klass is 'reasonable' | |
304 | 690 __ movptr(rax, Address(rax, oopDesc::klass_offset_in_bytes())); // get klass' klass |
691 __ testptr(rax, rax); | |
0 | 692 __ jcc(Assembler::zero, error); // if klass' klass is NULL it is broken |
693 | |
304 | 694 __ mov(rdx, rax); |
695 __ andptr(rdx, klass_mask); | |
696 __ cmpptr(rdx, klass_bits); | |
0 | 697 __ jcc(Assembler::notZero, error); // if klass not in right area |
698 // of memory it is broken too. | |
699 | |
700 // return if everything seems ok | |
701 __ bind(exit); | |
304 | 702 __ movptr(rax, Address(rsp, 5 * wordSize)); // get saved rax, back |
703 __ pop(rdx); // restore rdx | |
704 __ popf(); // restore EFLAGS | |
0 | 705 __ ret(3 * wordSize); // pop arguments |
706 | |
707 // handle errors | |
708 __ bind(error); | |
304 | 709 __ movptr(rax, Address(rsp, 5 * wordSize)); // get saved rax, back |
710 __ pop(rdx); // get saved rdx back | |
711 __ popf(); // get saved EFLAGS off stack -- will be ignored | |
712 __ pusha(); // push registers (eip = return address & msg are already pushed) | |
0 | 713 BLOCK_COMMENT("call MacroAssembler::debug"); |
304 | 714 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, MacroAssembler::debug32))); |
715 __ popa(); | |
0 | 716 __ ret(3 * wordSize); // pop arguments |
717 return start; | |
718 } | |
719 | |
720 // | |
721 // Generate pre-barrier for array stores | |
722 // | |
723 // Input: | |
724 // start - starting address | |
845
df6caf649ff7
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
710
diff
changeset
|
725 // count - element count |
0 | 726 void gen_write_ref_array_pre_barrier(Register start, Register count) { |
727 assert_different_registers(start, count); | |
728 BarrierSet* bs = Universe::heap()->barrier_set(); | |
729 switch (bs->kind()) { | |
730 case BarrierSet::G1SATBCT: | |
731 case BarrierSet::G1SATBCTLogging: | |
732 { | |
304 | 733 __ pusha(); // push registers |
1192
776fb94f33cc
6918006: G1: spill space must be reserved on the stack for barrier calls on Windows x64
apetrusenko
parents:
1174
diff
changeset
|
734 __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre), |
776fb94f33cc
6918006: G1: spill space must be reserved on the stack for barrier calls on Windows x64
apetrusenko
parents:
1174
diff
changeset
|
735 start, count); |
304 | 736 __ popa(); |
0 | 737 } |
738 break; | |
739 case BarrierSet::CardTableModRef: | |
740 case BarrierSet::CardTableExtension: | |
741 case BarrierSet::ModRef: | |
742 break; | |
743 default : | |
744 ShouldNotReachHere(); | |
745 | |
746 } | |
747 } | |
748 | |
749 | |
750 // | |
751 // Generate a post-barrier for an array store | |
752 // | |
753 // start - starting address | |
754 // count - element count | |
755 // | |
756 // The two input registers are overwritten. | |
757 // | |
758 void gen_write_ref_array_post_barrier(Register start, Register count) { | |
759 BarrierSet* bs = Universe::heap()->barrier_set(); | |
760 assert_different_registers(start, count); | |
761 switch (bs->kind()) { | |
762 case BarrierSet::G1SATBCT: | |
763 case BarrierSet::G1SATBCTLogging: | |
764 { | |
304 | 765 __ pusha(); // push registers |
1192
776fb94f33cc
6918006: G1: spill space must be reserved on the stack for barrier calls on Windows x64
apetrusenko
parents:
1174
diff
changeset
|
766 __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post), |
776fb94f33cc
6918006: G1: spill space must be reserved on the stack for barrier calls on Windows x64
apetrusenko
parents:
1174
diff
changeset
|
767 start, count); |
304 | 768 __ popa(); |
0 | 769 } |
770 break; | |
771 | |
772 case BarrierSet::CardTableModRef: | |
773 case BarrierSet::CardTableExtension: | |
774 { | |
775 CardTableModRefBS* ct = (CardTableModRefBS*)bs; | |
776 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); | |
777 | |
778 Label L_loop; | |
779 const Register end = count; // elements count; end == start+count-1 | |
780 assert_different_registers(start, end); | |
781 | |
304 | 782 __ lea(end, Address(start, count, Address::times_ptr, -wordSize)); |
783 __ shrptr(start, CardTableModRefBS::card_shift); | |
784 __ shrptr(end, CardTableModRefBS::card_shift); | |
785 __ subptr(end, start); // end --> count | |
0 | 786 __ BIND(L_loop); |
249
910a4cb98e9e
6717457: Internal Error (src/share/vm/code/relocInfo.hpp:1089)
never
parents:
19
diff
changeset
|
787 intptr_t disp = (intptr_t) ct->byte_map_base; |
910a4cb98e9e
6717457: Internal Error (src/share/vm/code/relocInfo.hpp:1089)
never
parents:
19
diff
changeset
|
788 Address cardtable(start, count, Address::times_1, disp); |
910a4cb98e9e
6717457: Internal Error (src/share/vm/code/relocInfo.hpp:1089)
never
parents:
19
diff
changeset
|
789 __ movb(cardtable, 0); |
0 | 790 __ decrement(count); |
791 __ jcc(Assembler::greaterEqual, L_loop); | |
792 } | |
793 break; | |
794 case BarrierSet::ModRef: | |
795 break; | |
796 default : | |
797 ShouldNotReachHere(); | |
798 | |
799 } | |
800 } | |
801 | |
405 | 802 |
803 // Copy 64 bytes chunks | |
804 // | |
805 // Inputs: | |
806 // from - source array address | |
807 // to_from - destination array address - from | |
808 // qword_count - 8-bytes element count, negative | |
809 // | |
810 void xmm_copy_forward(Register from, Register to_from, Register qword_count) { | |
811 assert( UseSSE >= 2, "supported cpu only" ); | |
812 Label L_copy_64_bytes_loop, L_copy_64_bytes, L_copy_8_bytes, L_exit; | |
813 // Copy 64-byte chunks | |
814 __ jmpb(L_copy_64_bytes); | |
1365 | 815 __ align(OptoLoopAlignment); |
405 | 816 __ BIND(L_copy_64_bytes_loop); |
817 | |
818 if(UseUnalignedLoadStores) { | |
819 __ movdqu(xmm0, Address(from, 0)); | |
820 __ movdqu(Address(from, to_from, Address::times_1, 0), xmm0); | |
821 __ movdqu(xmm1, Address(from, 16)); | |
822 __ movdqu(Address(from, to_from, Address::times_1, 16), xmm1); | |
823 __ movdqu(xmm2, Address(from, 32)); | |
824 __ movdqu(Address(from, to_from, Address::times_1, 32), xmm2); | |
825 __ movdqu(xmm3, Address(from, 48)); | |
826 __ movdqu(Address(from, to_from, Address::times_1, 48), xmm3); | |
827 | |
828 } else { | |
829 __ movq(xmm0, Address(from, 0)); | |
830 __ movq(Address(from, to_from, Address::times_1, 0), xmm0); | |
831 __ movq(xmm1, Address(from, 8)); | |
832 __ movq(Address(from, to_from, Address::times_1, 8), xmm1); | |
833 __ movq(xmm2, Address(from, 16)); | |
834 __ movq(Address(from, to_from, Address::times_1, 16), xmm2); | |
835 __ movq(xmm3, Address(from, 24)); | |
836 __ movq(Address(from, to_from, Address::times_1, 24), xmm3); | |
837 __ movq(xmm4, Address(from, 32)); | |
838 __ movq(Address(from, to_from, Address::times_1, 32), xmm4); | |
839 __ movq(xmm5, Address(from, 40)); | |
840 __ movq(Address(from, to_from, Address::times_1, 40), xmm5); | |
841 __ movq(xmm6, Address(from, 48)); | |
842 __ movq(Address(from, to_from, Address::times_1, 48), xmm6); | |
843 __ movq(xmm7, Address(from, 56)); | |
844 __ movq(Address(from, to_from, Address::times_1, 56), xmm7); | |
845 } | |
846 | |
847 __ addl(from, 64); | |
848 __ BIND(L_copy_64_bytes); | |
849 __ subl(qword_count, 8); | |
850 __ jcc(Assembler::greaterEqual, L_copy_64_bytes_loop); | |
851 __ addl(qword_count, 8); | |
852 __ jccb(Assembler::zero, L_exit); | |
853 // | |
854 // length is too short, just copy qwords | |
855 // | |
856 __ BIND(L_copy_8_bytes); | |
857 __ movq(xmm0, Address(from, 0)); | |
858 __ movq(Address(from, to_from, Address::times_1), xmm0); | |
859 __ addl(from, 8); | |
860 __ decrement(qword_count); | |
861 __ jcc(Assembler::greater, L_copy_8_bytes); | |
862 __ BIND(L_exit); | |
863 } | |
864 | |
0 | 865 // Copy 64 bytes chunks |
866 // | |
867 // Inputs: | |
868 // from - source array address | |
869 // to_from - destination array address - from | |
870 // qword_count - 8-bytes element count, negative | |
871 // | |
872 void mmx_copy_forward(Register from, Register to_from, Register qword_count) { | |
405 | 873 assert( VM_Version::supports_mmx(), "supported cpu only" ); |
0 | 874 Label L_copy_64_bytes_loop, L_copy_64_bytes, L_copy_8_bytes, L_exit; |
875 // Copy 64-byte chunks | |
876 __ jmpb(L_copy_64_bytes); | |
1365 | 877 __ align(OptoLoopAlignment); |
0 | 878 __ BIND(L_copy_64_bytes_loop); |
879 __ movq(mmx0, Address(from, 0)); | |
880 __ movq(mmx1, Address(from, 8)); | |
881 __ movq(mmx2, Address(from, 16)); | |
882 __ movq(Address(from, to_from, Address::times_1, 0), mmx0); | |
883 __ movq(mmx3, Address(from, 24)); | |
884 __ movq(Address(from, to_from, Address::times_1, 8), mmx1); | |
885 __ movq(mmx4, Address(from, 32)); | |
886 __ movq(Address(from, to_from, Address::times_1, 16), mmx2); | |
887 __ movq(mmx5, Address(from, 40)); | |
888 __ movq(Address(from, to_from, Address::times_1, 24), mmx3); | |
889 __ movq(mmx6, Address(from, 48)); | |
890 __ movq(Address(from, to_from, Address::times_1, 32), mmx4); | |
891 __ movq(mmx7, Address(from, 56)); | |
892 __ movq(Address(from, to_from, Address::times_1, 40), mmx5); | |
893 __ movq(Address(from, to_from, Address::times_1, 48), mmx6); | |
894 __ movq(Address(from, to_from, Address::times_1, 56), mmx7); | |
304 | 895 __ addptr(from, 64); |
0 | 896 __ BIND(L_copy_64_bytes); |
897 __ subl(qword_count, 8); | |
898 __ jcc(Assembler::greaterEqual, L_copy_64_bytes_loop); | |
899 __ addl(qword_count, 8); | |
900 __ jccb(Assembler::zero, L_exit); | |
901 // | |
902 // length is too short, just copy qwords | |
903 // | |
904 __ BIND(L_copy_8_bytes); | |
905 __ movq(mmx0, Address(from, 0)); | |
906 __ movq(Address(from, to_from, Address::times_1), mmx0); | |
304 | 907 __ addptr(from, 8); |
0 | 908 __ decrement(qword_count); |
909 __ jcc(Assembler::greater, L_copy_8_bytes); | |
910 __ BIND(L_exit); | |
911 __ emms(); | |
912 } | |
913 | |
914 address generate_disjoint_copy(BasicType t, bool aligned, | |
915 Address::ScaleFactor sf, | |
916 address* entry, const char *name) { | |
917 __ align(CodeEntryAlignment); | |
918 StubCodeMark mark(this, "StubRoutines", name); | |
919 address start = __ pc(); | |
920 | |
921 Label L_0_count, L_exit, L_skip_align1, L_skip_align2, L_copy_byte; | |
922 Label L_copy_2_bytes, L_copy_4_bytes, L_copy_64_bytes; | |
923 | |
304 | 924 int shift = Address::times_ptr - sf; |
0 | 925 |
926 const Register from = rsi; // source array address | |
927 const Register to = rdi; // destination array address | |
928 const Register count = rcx; // elements count | |
929 const Register to_from = to; // (to - from) | |
930 const Register saved_to = rdx; // saved destination array address | |
931 | |
932 __ enter(); // required for proper stackwalking of RuntimeStub frame | |
304 | 933 __ push(rsi); |
934 __ push(rdi); | |
935 __ movptr(from , Address(rsp, 12+ 4)); | |
936 __ movptr(to , Address(rsp, 12+ 8)); | |
0 | 937 __ movl(count, Address(rsp, 12+ 12)); |
938 if (t == T_OBJECT) { | |
939 __ testl(count, count); | |
940 __ jcc(Assembler::zero, L_0_count); | |
941 gen_write_ref_array_pre_barrier(to, count); | |
304 | 942 __ mov(saved_to, to); // save 'to' |
0 | 943 } |
944 | |
945 *entry = __ pc(); // Entry point from conjoint arraycopy stub. | |
946 BLOCK_COMMENT("Entry:"); | |
947 | |
304 | 948 __ subptr(to, from); // to --> to_from |
0 | 949 __ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element |
950 __ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp | |
405 | 951 if (!UseUnalignedLoadStores && !aligned && (t == T_BYTE || t == T_SHORT)) { |
0 | 952 // align source address at 4 bytes address boundary |
953 if (t == T_BYTE) { | |
954 // One byte misalignment happens only for byte arrays | |
955 __ testl(from, 1); | |
956 __ jccb(Assembler::zero, L_skip_align1); | |
957 __ movb(rax, Address(from, 0)); | |
958 __ movb(Address(from, to_from, Address::times_1, 0), rax); | |
959 __ increment(from); | |
960 __ decrement(count); | |
961 __ BIND(L_skip_align1); | |
962 } | |
963 // Two bytes misalignment happens only for byte and short (char) arrays | |
964 __ testl(from, 2); | |
965 __ jccb(Assembler::zero, L_skip_align2); | |
966 __ movw(rax, Address(from, 0)); | |
967 __ movw(Address(from, to_from, Address::times_1, 0), rax); | |
304 | 968 __ addptr(from, 2); |
0 | 969 __ subl(count, 1<<(shift-1)); |
970 __ BIND(L_skip_align2); | |
971 } | |
972 if (!VM_Version::supports_mmx()) { | |
304 | 973 __ mov(rax, count); // save 'count' |
974 __ shrl(count, shift); // bytes count | |
975 __ addptr(to_from, from);// restore 'to' | |
976 __ rep_mov(); | |
977 __ subptr(to_from, from);// restore 'to_from' | |
978 __ mov(count, rax); // restore 'count' | |
0 | 979 __ jmpb(L_copy_2_bytes); // all dwords were copied |
980 } else { | |
405 | 981 if (!UseUnalignedLoadStores) { |
982 // align to 8 bytes, we know we are 4 byte aligned to start | |
983 __ testptr(from, 4); | |
984 __ jccb(Assembler::zero, L_copy_64_bytes); | |
985 __ movl(rax, Address(from, 0)); | |
986 __ movl(Address(from, to_from, Address::times_1, 0), rax); | |
987 __ addptr(from, 4); | |
988 __ subl(count, 1<<shift); | |
989 } | |
0 | 990 __ BIND(L_copy_64_bytes); |
304 | 991 __ mov(rax, count); |
0 | 992 __ shrl(rax, shift+1); // 8 bytes chunk count |
993 // | |
994 // Copy 8-byte chunks through MMX registers, 8 per iteration of the loop | |
995 // | |
405 | 996 if (UseXMMForArrayCopy) { |
997 xmm_copy_forward(from, to_from, rax); | |
998 } else { | |
999 mmx_copy_forward(from, to_from, rax); | |
1000 } | |
0 | 1001 } |
1002 // copy tailing dword | |
1003 __ BIND(L_copy_4_bytes); | |
1004 __ testl(count, 1<<shift); | |
1005 __ jccb(Assembler::zero, L_copy_2_bytes); | |
1006 __ movl(rax, Address(from, 0)); | |
1007 __ movl(Address(from, to_from, Address::times_1, 0), rax); | |
1008 if (t == T_BYTE || t == T_SHORT) { | |
304 | 1009 __ addptr(from, 4); |
0 | 1010 __ BIND(L_copy_2_bytes); |
1011 // copy tailing word | |
1012 __ testl(count, 1<<(shift-1)); | |
1013 __ jccb(Assembler::zero, L_copy_byte); | |
1014 __ movw(rax, Address(from, 0)); | |
1015 __ movw(Address(from, to_from, Address::times_1, 0), rax); | |
1016 if (t == T_BYTE) { | |
304 | 1017 __ addptr(from, 2); |
0 | 1018 __ BIND(L_copy_byte); |
1019 // copy tailing byte | |
1020 __ testl(count, 1); | |
1021 __ jccb(Assembler::zero, L_exit); | |
1022 __ movb(rax, Address(from, 0)); | |
1023 __ movb(Address(from, to_from, Address::times_1, 0), rax); | |
1024 __ BIND(L_exit); | |
1025 } else { | |
1026 __ BIND(L_copy_byte); | |
1027 } | |
1028 } else { | |
1029 __ BIND(L_copy_2_bytes); | |
1030 } | |
1031 | |
1032 if (t == T_OBJECT) { | |
1033 __ movl(count, Address(rsp, 12+12)); // reread 'count' | |
304 | 1034 __ mov(to, saved_to); // restore 'to' |
0 | 1035 gen_write_ref_array_post_barrier(to, count); |
1036 __ BIND(L_0_count); | |
1037 } | |
1038 inc_copy_counter_np(t); | |
304 | 1039 __ pop(rdi); |
1040 __ pop(rsi); | |
0 | 1041 __ leave(); // required for proper stackwalking of RuntimeStub frame |
304 | 1042 __ xorptr(rax, rax); // return 0 |
0 | 1043 __ ret(0); |
1044 return start; | |
1045 } | |
1046 | |
1047 | |
1048 address generate_conjoint_copy(BasicType t, bool aligned, | |
1049 Address::ScaleFactor sf, | |
1050 address nooverlap_target, | |
1051 address* entry, const char *name) { | |
1052 __ align(CodeEntryAlignment); | |
1053 StubCodeMark mark(this, "StubRoutines", name); | |
1054 address start = __ pc(); | |
1055 | |
1056 Label L_0_count, L_exit, L_skip_align1, L_skip_align2, L_copy_byte; | |
1057 Label L_copy_2_bytes, L_copy_4_bytes, L_copy_8_bytes, L_copy_8_bytes_loop; | |
1058 | |
304 | 1059 int shift = Address::times_ptr - sf; |
0 | 1060 |
1061 const Register src = rax; // source array address | |
1062 const Register dst = rdx; // destination array address | |
1063 const Register from = rsi; // source array address | |
1064 const Register to = rdi; // destination array address | |
1065 const Register count = rcx; // elements count | |
1066 const Register end = rax; // array end address | |
1067 | |
1068 __ enter(); // required for proper stackwalking of RuntimeStub frame | |
304 | 1069 __ push(rsi); |
1070 __ push(rdi); | |
1071 __ movptr(src , Address(rsp, 12+ 4)); // from | |
1072 __ movptr(dst , Address(rsp, 12+ 8)); // to | |
1073 __ movl2ptr(count, Address(rsp, 12+12)); // count | |
0 | 1074 if (t == T_OBJECT) { |
1075 gen_write_ref_array_pre_barrier(dst, count); | |
1076 } | |
1077 | |
1078 if (entry != NULL) { | |
1079 *entry = __ pc(); // Entry point from generic arraycopy stub. | |
1080 BLOCK_COMMENT("Entry:"); | |
1081 } | |
1082 | |
1083 if (t == T_OBJECT) { | |
1084 __ testl(count, count); | |
1085 __ jcc(Assembler::zero, L_0_count); | |
1086 } | |
304 | 1087 __ mov(from, src); |
1088 __ mov(to , dst); | |
0 | 1089 |
1090 // arrays overlap test | |
1091 RuntimeAddress nooverlap(nooverlap_target); | |
304 | 1092 __ cmpptr(dst, src); |
1093 __ lea(end, Address(src, count, sf, 0)); // src + count * elem_size | |
0 | 1094 __ jump_cc(Assembler::belowEqual, nooverlap); |
304 | 1095 __ cmpptr(dst, end); |
0 | 1096 __ jump_cc(Assembler::aboveEqual, nooverlap); |
1097 | |
1098 // copy from high to low | |
1099 __ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element | |
1100 __ jcc(Assembler::below, L_copy_4_bytes); // use unsigned cmp | |
1101 if (t == T_BYTE || t == T_SHORT) { | |
1102 // Align the end of destination array at 4 bytes address boundary | |
304 | 1103 __ lea(end, Address(dst, count, sf, 0)); |
0 | 1104 if (t == T_BYTE) { |
1105 // One byte misalignment happens only for byte arrays | |
1106 __ testl(end, 1); | |
1107 __ jccb(Assembler::zero, L_skip_align1); | |
1108 __ decrement(count); | |
1109 __ movb(rdx, Address(from, count, sf, 0)); | |
1110 __ movb(Address(to, count, sf, 0), rdx); | |
1111 __ BIND(L_skip_align1); | |
1112 } | |
1113 // Two bytes misalignment happens only for byte and short (char) arrays | |
1114 __ testl(end, 2); | |
1115 __ jccb(Assembler::zero, L_skip_align2); | |
304 | 1116 __ subptr(count, 1<<(shift-1)); |
0 | 1117 __ movw(rdx, Address(from, count, sf, 0)); |
1118 __ movw(Address(to, count, sf, 0), rdx); | |
1119 __ BIND(L_skip_align2); | |
1120 __ cmpl(count, 2<<shift); // Short arrays (< 8 bytes) copy by element | |
1121 __ jcc(Assembler::below, L_copy_4_bytes); | |
1122 } | |
1123 | |
1124 if (!VM_Version::supports_mmx()) { | |
1125 __ std(); | |
304 | 1126 __ mov(rax, count); // Save 'count' |
1127 __ mov(rdx, to); // Save 'to' | |
1128 __ lea(rsi, Address(from, count, sf, -4)); | |
1129 __ lea(rdi, Address(to , count, sf, -4)); | |
1130 __ shrptr(count, shift); // bytes count | |
1131 __ rep_mov(); | |
0 | 1132 __ cld(); |
304 | 1133 __ mov(count, rax); // restore 'count' |
0 | 1134 __ andl(count, (1<<shift)-1); // mask the number of rest elements |
304 | 1135 __ movptr(from, Address(rsp, 12+4)); // reread 'from' |
1136 __ mov(to, rdx); // restore 'to' | |
0 | 1137 __ jmpb(L_copy_2_bytes); // all dword were copied |
1138 } else { | |
1139 // Align to 8 bytes the end of array. It is aligned to 4 bytes already. | |
304 | 1140 __ testptr(end, 4); |
0 | 1141 __ jccb(Assembler::zero, L_copy_8_bytes); |
1142 __ subl(count, 1<<shift); | |
1143 __ movl(rdx, Address(from, count, sf, 0)); | |
1144 __ movl(Address(to, count, sf, 0), rdx); | |
1145 __ jmpb(L_copy_8_bytes); | |
1146 | |
1365 | 1147 __ align(OptoLoopAlignment); |
0 | 1148 // Move 8 bytes |
1149 __ BIND(L_copy_8_bytes_loop); | |
405 | 1150 if (UseXMMForArrayCopy) { |
1151 __ movq(xmm0, Address(from, count, sf, 0)); | |
1152 __ movq(Address(to, count, sf, 0), xmm0); | |
1153 } else { | |
1154 __ movq(mmx0, Address(from, count, sf, 0)); | |
1155 __ movq(Address(to, count, sf, 0), mmx0); | |
1156 } | |
0 | 1157 __ BIND(L_copy_8_bytes); |
1158 __ subl(count, 2<<shift); | |
1159 __ jcc(Assembler::greaterEqual, L_copy_8_bytes_loop); | |
1160 __ addl(count, 2<<shift); | |
405 | 1161 if (!UseXMMForArrayCopy) { |
1162 __ emms(); | |
1163 } | |
0 | 1164 } |
1165 __ BIND(L_copy_4_bytes); | |
1166 // copy prefix qword | |
1167 __ testl(count, 1<<shift); | |
1168 __ jccb(Assembler::zero, L_copy_2_bytes); | |
1169 __ movl(rdx, Address(from, count, sf, -4)); | |
1170 __ movl(Address(to, count, sf, -4), rdx); | |
1171 | |
1172 if (t == T_BYTE || t == T_SHORT) { | |
1173 __ subl(count, (1<<shift)); | |
1174 __ BIND(L_copy_2_bytes); | |
1175 // copy prefix dword | |
1176 __ testl(count, 1<<(shift-1)); | |
1177 __ jccb(Assembler::zero, L_copy_byte); | |
1178 __ movw(rdx, Address(from, count, sf, -2)); | |
1179 __ movw(Address(to, count, sf, -2), rdx); | |
1180 if (t == T_BYTE) { | |
1181 __ subl(count, 1<<(shift-1)); | |
1182 __ BIND(L_copy_byte); | |
1183 // copy prefix byte | |
1184 __ testl(count, 1); | |
1185 __ jccb(Assembler::zero, L_exit); | |
1186 __ movb(rdx, Address(from, 0)); | |
1187 __ movb(Address(to, 0), rdx); | |
1188 __ BIND(L_exit); | |
1189 } else { | |
1190 __ BIND(L_copy_byte); | |
1191 } | |
1192 } else { | |
1193 __ BIND(L_copy_2_bytes); | |
1194 } | |
1195 if (t == T_OBJECT) { | |
304 | 1196 __ movl2ptr(count, Address(rsp, 12+12)); // reread count |
0 | 1197 gen_write_ref_array_post_barrier(to, count); |
1198 __ BIND(L_0_count); | |
1199 } | |
1200 inc_copy_counter_np(t); | |
304 | 1201 __ pop(rdi); |
1202 __ pop(rsi); | |
0 | 1203 __ leave(); // required for proper stackwalking of RuntimeStub frame |
304 | 1204 __ xorptr(rax, rax); // return 0 |
0 | 1205 __ ret(0); |
1206 return start; | |
1207 } | |
1208 | |
1209 | |
1210 address generate_disjoint_long_copy(address* entry, const char *name) { | |
1211 __ align(CodeEntryAlignment); | |
1212 StubCodeMark mark(this, "StubRoutines", name); | |
1213 address start = __ pc(); | |
1214 | |
1215 Label L_copy_8_bytes, L_copy_8_bytes_loop; | |
1216 const Register from = rax; // source array address | |
1217 const Register to = rdx; // destination array address | |
1218 const Register count = rcx; // elements count | |
1219 const Register to_from = rdx; // (to - from) | |
1220 | |
1221 __ enter(); // required for proper stackwalking of RuntimeStub frame | |
304 | 1222 __ movptr(from , Address(rsp, 8+0)); // from |
1223 __ movptr(to , Address(rsp, 8+4)); // to | |
1224 __ movl2ptr(count, Address(rsp, 8+8)); // count | |
0 | 1225 |
1226 *entry = __ pc(); // Entry point from conjoint arraycopy stub. | |
1227 BLOCK_COMMENT("Entry:"); | |
1228 | |
304 | 1229 __ subptr(to, from); // to --> to_from |
0 | 1230 if (VM_Version::supports_mmx()) { |
405 | 1231 if (UseXMMForArrayCopy) { |
1232 xmm_copy_forward(from, to_from, count); | |
1233 } else { | |
1234 mmx_copy_forward(from, to_from, count); | |
1235 } | |
0 | 1236 } else { |
1237 __ jmpb(L_copy_8_bytes); | |
1365 | 1238 __ align(OptoLoopAlignment); |
0 | 1239 __ BIND(L_copy_8_bytes_loop); |
1240 __ fild_d(Address(from, 0)); | |
1241 __ fistp_d(Address(from, to_from, Address::times_1)); | |
304 | 1242 __ addptr(from, 8); |
0 | 1243 __ BIND(L_copy_8_bytes); |
1244 __ decrement(count); | |
1245 __ jcc(Assembler::greaterEqual, L_copy_8_bytes_loop); | |
1246 } | |
1247 inc_copy_counter_np(T_LONG); | |
1248 __ leave(); // required for proper stackwalking of RuntimeStub frame | |
304 | 1249 __ xorptr(rax, rax); // return 0 |
0 | 1250 __ ret(0); |
1251 return start; | |
1252 } | |
1253 | |
1254 address generate_conjoint_long_copy(address nooverlap_target, | |
1255 address* entry, const char *name) { | |
1256 __ align(CodeEntryAlignment); | |
1257 StubCodeMark mark(this, "StubRoutines", name); | |
1258 address start = __ pc(); | |
1259 | |
1260 Label L_copy_8_bytes, L_copy_8_bytes_loop; | |
1261 const Register from = rax; // source array address | |
1262 const Register to = rdx; // destination array address | |
1263 const Register count = rcx; // elements count | |
1264 const Register end_from = rax; // source array end address | |
1265 | |
1266 __ enter(); // required for proper stackwalking of RuntimeStub frame | |
304 | 1267 __ movptr(from , Address(rsp, 8+0)); // from |
1268 __ movptr(to , Address(rsp, 8+4)); // to | |
1269 __ movl2ptr(count, Address(rsp, 8+8)); // count | |
0 | 1270 |
1271 *entry = __ pc(); // Entry point from generic arraycopy stub. | |
1272 BLOCK_COMMENT("Entry:"); | |
1273 | |
1274 // arrays overlap test | |
304 | 1275 __ cmpptr(to, from); |
0 | 1276 RuntimeAddress nooverlap(nooverlap_target); |
1277 __ jump_cc(Assembler::belowEqual, nooverlap); | |
304 | 1278 __ lea(end_from, Address(from, count, Address::times_8, 0)); |
1279 __ cmpptr(to, end_from); | |
1280 __ movptr(from, Address(rsp, 8)); // from | |
0 | 1281 __ jump_cc(Assembler::aboveEqual, nooverlap); |
1282 | |
1283 __ jmpb(L_copy_8_bytes); | |
1284 | |
1365 | 1285 __ align(OptoLoopAlignment); |
0 | 1286 __ BIND(L_copy_8_bytes_loop); |
1287 if (VM_Version::supports_mmx()) { | |
405 | 1288 if (UseXMMForArrayCopy) { |
1289 __ movq(xmm0, Address(from, count, Address::times_8)); | |
1290 __ movq(Address(to, count, Address::times_8), xmm0); | |
1291 } else { | |
1292 __ movq(mmx0, Address(from, count, Address::times_8)); | |
1293 __ movq(Address(to, count, Address::times_8), mmx0); | |
1294 } | |
0 | 1295 } else { |
1296 __ fild_d(Address(from, count, Address::times_8)); | |
1297 __ fistp_d(Address(to, count, Address::times_8)); | |
1298 } | |
1299 __ BIND(L_copy_8_bytes); | |
1300 __ decrement(count); | |
1301 __ jcc(Assembler::greaterEqual, L_copy_8_bytes_loop); | |
1302 | |
405 | 1303 if (VM_Version::supports_mmx() && !UseXMMForArrayCopy) { |
0 | 1304 __ emms(); |
1305 } | |
1306 inc_copy_counter_np(T_LONG); | |
1307 __ leave(); // required for proper stackwalking of RuntimeStub frame | |
304 | 1308 __ xorptr(rax, rax); // return 0 |
0 | 1309 __ ret(0); |
1310 return start; | |
1311 } | |
1312 | |
1313 | |
1314 // Helper for generating a dynamic type check. | |
1315 // The sub_klass must be one of {rbx, rdx, rsi}. | |
1316 // The temp is killed. | |
1317 void generate_type_check(Register sub_klass, | |
1318 Address& super_check_offset_addr, | |
1319 Address& super_klass_addr, | |
1320 Register temp, | |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1321 Label* L_success, Label* L_failure) { |
0 | 1322 BLOCK_COMMENT("type_check:"); |
1323 | |
1324 Label L_fallthrough; | |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1325 #define LOCAL_JCC(assembler_con, label_ptr) \ |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1326 if (label_ptr != NULL) __ jcc(assembler_con, *(label_ptr)); \ |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1327 else __ jcc(assembler_con, L_fallthrough) /*omit semi*/ |
0 | 1328 |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1329 // The following is a strange variation of the fast path which requires |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1330 // one less register, because needed values are on the argument stack. |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1331 // __ check_klass_subtype_fast_path(sub_klass, *super_klass*, temp, |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1332 // L_success, L_failure, NULL); |
0 | 1333 assert_different_registers(sub_klass, temp); |
1334 | |
1335 int sc_offset = (klassOopDesc::header_size() * HeapWordSize + | |
1336 Klass::secondary_super_cache_offset_in_bytes()); | |
1337 | |
1338 // if the pointers are equal, we are done (e.g., String[] elements) | |
304 | 1339 __ cmpptr(sub_klass, super_klass_addr); |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1340 LOCAL_JCC(Assembler::equal, L_success); |
0 | 1341 |
1342 // check the supertype display: | |
304 | 1343 __ movl2ptr(temp, super_check_offset_addr); |
0 | 1344 Address super_check_addr(sub_klass, temp, Address::times_1, 0); |
304 | 1345 __ movptr(temp, super_check_addr); // load displayed supertype |
1346 __ cmpptr(temp, super_klass_addr); // test the super type | |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1347 LOCAL_JCC(Assembler::equal, L_success); |
0 | 1348 |
1349 // if it was a primary super, we can just fail immediately | |
1350 __ cmpl(super_check_offset_addr, sc_offset); | |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1351 LOCAL_JCC(Assembler::notEqual, L_failure); |
0 | 1352 |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1353 // The repne_scan instruction uses fixed registers, which will get spilled. |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1354 // We happen to know this works best when super_klass is in rax. |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1355 Register super_klass = temp; |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1356 __ movptr(super_klass, super_klass_addr); |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1357 __ check_klass_subtype_slow_path(sub_klass, super_klass, noreg, noreg, |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1358 L_success, L_failure); |
0 | 1359 |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1360 __ bind(L_fallthrough); |
0 | 1361 |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1362 if (L_success == NULL) { BLOCK_COMMENT("L_success:"); } |
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1363 if (L_failure == NULL) { BLOCK_COMMENT("L_failure:"); } |
0 | 1364 |
644
c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents:
533
diff
changeset
|
1365 #undef LOCAL_JCC |
0 | 1366 } |
1367 | |
1368 // | |
1369 // Generate checkcasting array copy stub | |
1370 // | |
1371 // Input: | |
1372 // 4(rsp) - source array address | |
1373 // 8(rsp) - destination array address | |
1374 // 12(rsp) - element count, can be zero | |
1375 // 16(rsp) - size_t ckoff (super_check_offset) | |
1376 // 20(rsp) - oop ckval (super_klass) | |
1377 // | |
1378 // Output: | |
1379 // rax, == 0 - success | |
1380 // rax, == -1^K - failure, where K is partial transfer count | |
1381 // | |
1382 address generate_checkcast_copy(const char *name, address* entry) { | |
1383 __ align(CodeEntryAlignment); | |
1384 StubCodeMark mark(this, "StubRoutines", name); | |
1385 address start = __ pc(); | |
1386 | |
1387 Label L_load_element, L_store_element, L_do_card_marks, L_done; | |
1388 | |
1389 // register use: | |
1390 // rax, rdx, rcx -- loop control (end_from, end_to, count) | |
1391 // rdi, rsi -- element access (oop, klass) | |
1392 // rbx, -- temp | |
1393 const Register from = rax; // source array address | |
1394 const Register to = rdx; // destination array address | |
1395 const Register length = rcx; // elements count | |
1396 const Register elem = rdi; // each oop copied | |
1397 const Register elem_klass = rsi; // each elem._klass (sub_klass) | |
1398 const Register temp = rbx; // lone remaining temp | |
1399 | |
1400 __ enter(); // required for proper stackwalking of RuntimeStub frame | |
1401 | |
304 | 1402 __ push(rsi); |
1403 __ push(rdi); | |
1404 __ push(rbx); | |
0 | 1405 |
1406 Address from_arg(rsp, 16+ 4); // from | |
1407 Address to_arg(rsp, 16+ 8); // to | |
1408 Address length_arg(rsp, 16+12); // elements count | |
1409 Address ckoff_arg(rsp, 16+16); // super_check_offset | |
1410 Address ckval_arg(rsp, 16+20); // super_klass | |
1411 | |
1412 // Load up: | |
304 | 1413 __ movptr(from, from_arg); |
1414 __ movptr(to, to_arg); | |
1415 __ movl2ptr(length, length_arg); | |
0 | 1416 |
1417 *entry = __ pc(); // Entry point from generic arraycopy stub. | |
1418 BLOCK_COMMENT("Entry:"); | |
1419 | |
1420 //--------------------------------------------------------------- | |
1421 // Assembler stub will be used for this call to arraycopy | |
1422 // if the two arrays are subtypes of Object[] but the | |
1423 // destination array type is not equal to or a supertype | |
1424 // of the source type. Each element must be separately | |
1425 // checked. | |
1426 | |
1427 // Loop-invariant addresses. They are exclusive end pointers. | |
304 | 1428 Address end_from_addr(from, length, Address::times_ptr, 0); |
1429 Address end_to_addr(to, length, Address::times_ptr, 0); | |
0 | 1430 |
1431 Register end_from = from; // re-use | |
1432 Register end_to = to; // re-use | |
1433 Register count = length; // re-use | |
1434 | |
1435 // Loop-variant addresses. They assume post-incremented count < 0. | |
304 | 1436 Address from_element_addr(end_from, count, Address::times_ptr, 0); |
1437 Address to_element_addr(end_to, count, Address::times_ptr, 0); | |
0 | 1438 Address elem_klass_addr(elem, oopDesc::klass_offset_in_bytes()); |
1439 | |
1440 // Copy from low to high addresses, indexed from the end of each array. | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
19
diff
changeset
|
1441 gen_write_ref_array_pre_barrier(to, count); |
304 | 1442 __ lea(end_from, end_from_addr); |
1443 __ lea(end_to, end_to_addr); | |
0 | 1444 assert(length == count, ""); // else fix next line: |
304 | 1445 __ negptr(count); // negate and test the length |
0 | 1446 __ jccb(Assembler::notZero, L_load_element); |
1447 | |
1448 // Empty array: Nothing to do. | |
304 | 1449 __ xorptr(rax, rax); // return 0 on (trivial) success |
0 | 1450 __ jmp(L_done); |
1451 | |
1452 // ======== begin loop ======== | |
1453 // (Loop is rotated; its entry is L_load_element.) | |
1454 // Loop control: | |
1455 // for (count = -count; count != 0; count++) | |
1456 // Base pointers src, dst are biased by 8*count,to last element. | |
1365 | 1457 __ align(OptoLoopAlignment); |
0 | 1458 |
1459 __ BIND(L_store_element); | |
304 | 1460 __ movptr(to_element_addr, elem); // store the oop |
0 | 1461 __ increment(count); // increment the count toward zero |
1462 __ jccb(Assembler::zero, L_do_card_marks); | |
1463 | |
1464 // ======== loop entry is here ======== | |
1465 __ BIND(L_load_element); | |
304 | 1466 __ movptr(elem, from_element_addr); // load the oop |
1467 __ testptr(elem, elem); | |
0 | 1468 __ jccb(Assembler::zero, L_store_element); |
1469 | |
1470 // (Could do a trick here: Remember last successful non-null | |
1471 // element stored and make a quick oop equality check on it.) | |
1472 | |
304 | 1473 __ movptr(elem_klass, elem_klass_addr); // query the object klass |
0 | 1474 generate_type_check(elem_klass, ckoff_arg, ckval_arg, temp, |
1475 &L_store_element, NULL); | |
1476 // (On fall-through, we have failed the element type check.) | |
1477 // ======== end loop ======== | |
1478 | |
1479 // It was a real error; we must depend on the caller to finish the job. | |
19
a73cc31728fe
6614036: REGRESSION: Java server x86 VM intermittently crash with SIGSEGV (0xb)
rasbold
parents:
16
diff
changeset
|
1480 // Register "count" = -1 * number of *remaining* oops, length_arg = *total* oops. |
a73cc31728fe
6614036: REGRESSION: Java server x86 VM intermittently crash with SIGSEGV (0xb)
rasbold
parents:
16
diff
changeset
|
1481 // Emit GC store barriers for the oops we have copied (length_arg + count), |
0 | 1482 // and report their number to the caller. |
1483 __ addl(count, length_arg); // transfers = (length - remaining) | |
304 | 1484 __ movl2ptr(rax, count); // save the value |
1485 __ notptr(rax); // report (-1^K) to caller | |
1486 __ movptr(to, to_arg); // reload | |
0 | 1487 assert_different_registers(to, count, rax); |
1488 gen_write_ref_array_post_barrier(to, count); | |
1489 __ jmpb(L_done); | |
1490 | |
1491 // Come here on success only. | |
1492 __ BIND(L_do_card_marks); | |
304 | 1493 __ movl2ptr(count, length_arg); |
1494 __ movptr(to, to_arg); // reload | |
0 | 1495 gen_write_ref_array_post_barrier(to, count); |
304 | 1496 __ xorptr(rax, rax); // return 0 on success |
0 | 1497 |
1498 // Common exit point (success or failure). | |
1499 __ BIND(L_done); | |
304 | 1500 __ pop(rbx); |
1501 __ pop(rdi); | |
1502 __ pop(rsi); | |
0 | 1503 inc_counter_np(SharedRuntime::_checkcast_array_copy_ctr); |
1504 __ leave(); // required for proper stackwalking of RuntimeStub frame | |
1505 __ ret(0); | |
1506 | |
1507 return start; | |
1508 } | |
1509 | |
1510 // | |
1511 // Generate 'unsafe' array copy stub | |
1512 // Though just as safe as the other stubs, it takes an unscaled | |
1513 // size_t argument instead of an element count. | |
1514 // | |
1515 // Input: | |
1516 // 4(rsp) - source array address | |
1517 // 8(rsp) - destination array address | |
1518 // 12(rsp) - byte count, can be zero | |
1519 // | |
1520 // Output: | |
1521 // rax, == 0 - success | |
1522 // rax, == -1 - need to call System.arraycopy | |
1523 // | |
1524 // Examines the alignment of the operands and dispatches | |
1525 // to a long, int, short, or byte copy loop. | |
1526 // | |
1527 address generate_unsafe_copy(const char *name, | |
1528 address byte_copy_entry, | |
1529 address short_copy_entry, | |
1530 address int_copy_entry, | |
1531 address long_copy_entry) { | |
1532 | |
1533 Label L_long_aligned, L_int_aligned, L_short_aligned; | |
1534 | |
1535 __ align(CodeEntryAlignment); | |
1536 StubCodeMark mark(this, "StubRoutines", name); | |
1537 address start = __ pc(); | |
1538 | |
1539 const Register from = rax; // source array address | |
1540 const Register to = rdx; // destination array address | |
1541 const Register count = rcx; // elements count | |
1542 | |
1543 __ enter(); // required for proper stackwalking of RuntimeStub frame | |
304 | 1544 __ push(rsi); |
1545 __ push(rdi); | |
0 | 1546 Address from_arg(rsp, 12+ 4); // from |
1547 Address to_arg(rsp, 12+ 8); // to | |
1548 Address count_arg(rsp, 12+12); // byte count | |
1549 | |
1550 // Load up: | |
304 | 1551 __ movptr(from , from_arg); |
1552 __ movptr(to , to_arg); | |
1553 __ movl2ptr(count, count_arg); | |
0 | 1554 |
1555 // bump this on entry, not on exit: | |
1556 inc_counter_np(SharedRuntime::_unsafe_array_copy_ctr); | |
1557 | |
1558 const Register bits = rsi; | |
304 | 1559 __ mov(bits, from); |
1560 __ orptr(bits, to); | |
1561 __ orptr(bits, count); | |
0 | 1562 |
1563 __ testl(bits, BytesPerLong-1); | |
1564 __ jccb(Assembler::zero, L_long_aligned); | |
1565 | |
1566 __ testl(bits, BytesPerInt-1); | |
1567 __ jccb(Assembler::zero, L_int_aligned); | |
1568 | |
1569 __ testl(bits, BytesPerShort-1); | |
1570 __ jump_cc(Assembler::notZero, RuntimeAddress(byte_copy_entry)); | |
1571 | |
1572 __ BIND(L_short_aligned); | |
304 | 1573 __ shrptr(count, LogBytesPerShort); // size => short_count |
0 | 1574 __ movl(count_arg, count); // update 'count' |
1575 __ jump(RuntimeAddress(short_copy_entry)); | |
1576 | |
1577 __ BIND(L_int_aligned); | |
304 | 1578 __ shrptr(count, LogBytesPerInt); // size => int_count |
0 | 1579 __ movl(count_arg, count); // update 'count' |
1580 __ jump(RuntimeAddress(int_copy_entry)); | |
1581 | |
1582 __ BIND(L_long_aligned); | |
304 | 1583 __ shrptr(count, LogBytesPerLong); // size => qword_count |
0 | 1584 __ movl(count_arg, count); // update 'count' |
304 | 1585 __ pop(rdi); // Do pops here since jlong_arraycopy stub does not do it. |
1586 __ pop(rsi); | |
0 | 1587 __ jump(RuntimeAddress(long_copy_entry)); |
1588 | |
1589 return start; | |
1590 } | |
1591 | |
1592 | |
1593 // Perform range checks on the proposed arraycopy. | |
1594 // Smashes src_pos and dst_pos. (Uses them up for temps.) | |
1595 void arraycopy_range_checks(Register src, | |
1596 Register src_pos, | |
1597 Register dst, | |
1598 Register dst_pos, | |
1599 Address& length, | |
1600 Label& L_failed) { | |
1601 BLOCK_COMMENT("arraycopy_range_checks:"); | |
1602 const Register src_end = src_pos; // source array end position | |
1603 const Register dst_end = dst_pos; // destination array end position | |
1604 __ addl(src_end, length); // src_pos + length | |
1605 __ addl(dst_end, length); // dst_pos + length | |
1606 | |
1607 // if (src_pos + length > arrayOop(src)->length() ) FAIL; | |
1608 __ cmpl(src_end, Address(src, arrayOopDesc::length_offset_in_bytes())); | |
1609 __ jcc(Assembler::above, L_failed); | |
1610 | |
1611 // if (dst_pos + length > arrayOop(dst)->length() ) FAIL; | |
1612 __ cmpl(dst_end, Address(dst, arrayOopDesc::length_offset_in_bytes())); | |
1613 __ jcc(Assembler::above, L_failed); | |
1614 | |
1615 BLOCK_COMMENT("arraycopy_range_checks done"); | |
1616 } | |
1617 | |
1618 | |
1619 // | |
1620 // Generate generic array copy stubs | |
1621 // | |
1622 // Input: | |
1623 // 4(rsp) - src oop | |
1624 // 8(rsp) - src_pos | |
1625 // 12(rsp) - dst oop | |
1626 // 16(rsp) - dst_pos | |
1627 // 20(rsp) - element count | |
1628 // | |
1629 // Output: | |
1630 // rax, == 0 - success | |
1631 // rax, == -1^K - failure, where K is partial transfer count | |
1632 // | |
1633 address generate_generic_copy(const char *name, | |
1634 address entry_jbyte_arraycopy, | |
1635 address entry_jshort_arraycopy, | |
1636 address entry_jint_arraycopy, | |
1637 address entry_oop_arraycopy, | |
1638 address entry_jlong_arraycopy, | |
1639 address entry_checkcast_arraycopy) { | |
1640 Label L_failed, L_failed_0, L_objArray; | |
1641 | |
1642 { int modulus = CodeEntryAlignment; | |
1643 int target = modulus - 5; // 5 = sizeof jmp(L_failed) | |
1644 int advance = target - (__ offset() % modulus); | |
1645 if (advance < 0) advance += modulus; | |
1646 if (advance > 0) __ nop(advance); | |
1647 } | |
1648 StubCodeMark mark(this, "StubRoutines", name); | |
1649 | |
1650 // Short-hop target to L_failed. Makes for denser prologue code. | |
1651 __ BIND(L_failed_0); | |
1652 __ jmp(L_failed); | |
1653 assert(__ offset() % CodeEntryAlignment == 0, "no further alignment needed"); | |
1654 | |
1655 __ align(CodeEntryAlignment); | |
1656 address start = __ pc(); | |
1657 | |
1658 __ enter(); // required for proper stackwalking of RuntimeStub frame | |
304 | 1659 __ push(rsi); |
1660 __ push(rdi); | |
0 | 1661 |
1662 // bump this on entry, not on exit: | |
1663 inc_counter_np(SharedRuntime::_generic_array_copy_ctr); | |
1664 | |
1665 // Input values | |
1666 Address SRC (rsp, 12+ 4); | |
1667 Address SRC_POS (rsp, 12+ 8); | |
1668 Address DST (rsp, 12+12); | |
1669 Address DST_POS (rsp, 12+16); | |
1670 Address LENGTH (rsp, 12+20); | |
1671 | |
1672 //----------------------------------------------------------------------- | |
1673 // Assembler stub will be used for this call to arraycopy | |
1674 // if the following conditions are met: | |
1675 // | |
1676 // (1) src and dst must not be null. | |
1677 // (2) src_pos must not be negative. | |
1678 // (3) dst_pos must not be negative. | |
1679 // (4) length must not be negative. | |
1680 // (5) src klass and dst klass should be the same and not NULL. | |
1681 // (6) src and dst should be arrays. | |
1682 // (7) src_pos + length must not exceed length of src. | |
1683 // (8) dst_pos + length must not exceed length of dst. | |
1684 // | |
1685 | |
1686 const Register src = rax; // source array oop | |
1687 const Register src_pos = rsi; | |
1688 const Register dst = rdx; // destination array oop | |
1689 const Register dst_pos = rdi; | |
1690 const Register length = rcx; // transfer count | |
1691 | |
1692 // if (src == NULL) return -1; | |
304 | 1693 __ movptr(src, SRC); // src oop |
1694 __ testptr(src, src); | |
0 | 1695 __ jccb(Assembler::zero, L_failed_0); |
1696 | |
1697 // if (src_pos < 0) return -1; | |
304 | 1698 __ movl2ptr(src_pos, SRC_POS); // src_pos |
0 | 1699 __ testl(src_pos, src_pos); |
1700 __ jccb(Assembler::negative, L_failed_0); | |
1701 | |
1702 // if (dst == NULL) return -1; | |
304 | 1703 __ movptr(dst, DST); // dst oop |
1704 __ testptr(dst, dst); | |
0 | 1705 __ jccb(Assembler::zero, L_failed_0); |
1706 | |
1707 // if (dst_pos < 0) return -1; | |
304 | 1708 __ movl2ptr(dst_pos, DST_POS); // dst_pos |
0 | 1709 __ testl(dst_pos, dst_pos); |
1710 __ jccb(Assembler::negative, L_failed_0); | |
1711 | |
1712 // if (length < 0) return -1; | |
304 | 1713 __ movl2ptr(length, LENGTH); // length |
0 | 1714 __ testl(length, length); |
1715 __ jccb(Assembler::negative, L_failed_0); | |
1716 | |
1717 // if (src->klass() == NULL) return -1; | |
1718 Address src_klass_addr(src, oopDesc::klass_offset_in_bytes()); | |
1719 Address dst_klass_addr(dst, oopDesc::klass_offset_in_bytes()); | |
1720 const Register rcx_src_klass = rcx; // array klass | |
304 | 1721 __ movptr(rcx_src_klass, Address(src, oopDesc::klass_offset_in_bytes())); |
0 | 1722 |
1723 #ifdef ASSERT | |
1724 // assert(src->klass() != NULL); | |
1725 BLOCK_COMMENT("assert klasses not null"); | |
1726 { Label L1, L2; | |
304 | 1727 __ testptr(rcx_src_klass, rcx_src_klass); |
0 | 1728 __ jccb(Assembler::notZero, L2); // it is broken if klass is NULL |
1729 __ bind(L1); | |
1730 __ stop("broken null klass"); | |
1731 __ bind(L2); | |
304 | 1732 __ cmpptr(dst_klass_addr, (int32_t)NULL_WORD); |
0 | 1733 __ jccb(Assembler::equal, L1); // this would be broken also |
1734 BLOCK_COMMENT("assert done"); | |
1735 } | |
1736 #endif //ASSERT | |
1737 | |
1738 // Load layout helper (32-bits) | |
1739 // | |
1740 // |array_tag| | header_size | element_type | |log2_element_size| | |
1741 // 32 30 24 16 8 2 0 | |
1742 // | |
1743 // array_tag: typeArray = 0x3, objArray = 0x2, non-array = 0x0 | |
1744 // | |
1745 | |
1746 int lh_offset = klassOopDesc::header_size() * HeapWordSize + | |
1747 Klass::layout_helper_offset_in_bytes(); | |
1748 Address src_klass_lh_addr(rcx_src_klass, lh_offset); | |
1749 | |
1750 // Handle objArrays completely differently... | |
1751 jint objArray_lh = Klass::array_layout_helper(T_OBJECT); | |
1752 __ cmpl(src_klass_lh_addr, objArray_lh); | |
1753 __ jcc(Assembler::equal, L_objArray); | |
1754 | |
1755 // if (src->klass() != dst->klass()) return -1; | |
304 | 1756 __ cmpptr(rcx_src_klass, dst_klass_addr); |
0 | 1757 __ jccb(Assembler::notEqual, L_failed_0); |
1758 | |
1759 const Register rcx_lh = rcx; // layout helper | |
1760 assert(rcx_lh == rcx_src_klass, "known alias"); | |
1761 __ movl(rcx_lh, src_klass_lh_addr); | |
1762 | |
1763 // if (!src->is_Array()) return -1; | |
1764 __ cmpl(rcx_lh, Klass::_lh_neutral_value); | |
1765 __ jcc(Assembler::greaterEqual, L_failed_0); // signed cmp | |
1766 | |
1767 // At this point, it is known to be a typeArray (array_tag 0x3). | |
1768 #ifdef ASSERT | |
1769 { Label L; | |
1770 __ cmpl(rcx_lh, (Klass::_lh_array_tag_type_value << Klass::_lh_array_tag_shift)); | |
1771 __ jcc(Assembler::greaterEqual, L); // signed cmp | |
1772 __ stop("must be a primitive array"); | |
1773 __ bind(L); | |
1774 } | |
1775 #endif | |
1776 | |
1777 assert_different_registers(src, src_pos, dst, dst_pos, rcx_lh); | |
1778 arraycopy_range_checks(src, src_pos, dst, dst_pos, LENGTH, L_failed); | |
1779 | |
1780 // typeArrayKlass | |
1781 // | |
1782 // src_addr = (src + array_header_in_bytes()) + (src_pos << log2elemsize); | |
1783 // dst_addr = (dst + array_header_in_bytes()) + (dst_pos << log2elemsize); | |
1784 // | |
1785 const Register rsi_offset = rsi; // array offset | |
1786 const Register src_array = src; // src array offset | |
1787 const Register dst_array = dst; // dst array offset | |
1788 const Register rdi_elsize = rdi; // log2 element size | |
1789 | |
304 | 1790 __ mov(rsi_offset, rcx_lh); |
1791 __ shrptr(rsi_offset, Klass::_lh_header_size_shift); | |
1792 __ andptr(rsi_offset, Klass::_lh_header_size_mask); // array_offset | |
1793 __ addptr(src_array, rsi_offset); // src array offset | |
1794 __ addptr(dst_array, rsi_offset); // dst array offset | |
1795 __ andptr(rcx_lh, Klass::_lh_log2_element_size_mask); // log2 elsize | |
0 | 1796 |
1797 // next registers should be set before the jump to corresponding stub | |
1798 const Register from = src; // source array address | |
1799 const Register to = dst; // destination array address | |
1800 const Register count = rcx; // elements count | |
1801 // some of them should be duplicated on stack | |
1802 #define FROM Address(rsp, 12+ 4) | |
1803 #define TO Address(rsp, 12+ 8) // Not used now | |
1804 #define COUNT Address(rsp, 12+12) // Only for oop arraycopy | |
1805 | |
1806 BLOCK_COMMENT("scale indexes to element size"); | |
304 | 1807 __ movl2ptr(rsi, SRC_POS); // src_pos |
1808 __ shlptr(rsi); // src_pos << rcx (log2 elsize) | |
0 | 1809 assert(src_array == from, ""); |
304 | 1810 __ addptr(from, rsi); // from = src_array + SRC_POS << log2 elsize |
1811 __ movl2ptr(rdi, DST_POS); // dst_pos | |
1812 __ shlptr(rdi); // dst_pos << rcx (log2 elsize) | |
0 | 1813 assert(dst_array == to, ""); |
304 | 1814 __ addptr(to, rdi); // to = dst_array + DST_POS << log2 elsize |
1815 __ movptr(FROM, from); // src_addr | |
1816 __ mov(rdi_elsize, rcx_lh); // log2 elsize | |
1817 __ movl2ptr(count, LENGTH); // elements count | |
0 | 1818 |
1819 BLOCK_COMMENT("choose copy loop based on element size"); | |
1820 __ cmpl(rdi_elsize, 0); | |
1821 | |
1822 __ jump_cc(Assembler::equal, RuntimeAddress(entry_jbyte_arraycopy)); | |
1823 __ cmpl(rdi_elsize, LogBytesPerShort); | |
1824 __ jump_cc(Assembler::equal, RuntimeAddress(entry_jshort_arraycopy)); | |
1825 __ cmpl(rdi_elsize, LogBytesPerInt); | |
1826 __ jump_cc(Assembler::equal, RuntimeAddress(entry_jint_arraycopy)); | |
1827 #ifdef ASSERT | |
1828 __ cmpl(rdi_elsize, LogBytesPerLong); | |
1829 __ jccb(Assembler::notEqual, L_failed); | |
1830 #endif | |
304 | 1831 __ pop(rdi); // Do pops here since jlong_arraycopy stub does not do it. |
1832 __ pop(rsi); | |
0 | 1833 __ jump(RuntimeAddress(entry_jlong_arraycopy)); |
1834 | |
1835 __ BIND(L_failed); | |
304 | 1836 __ xorptr(rax, rax); |
1837 __ notptr(rax); // return -1 | |
1838 __ pop(rdi); | |
1839 __ pop(rsi); | |
0 | 1840 __ leave(); // required for proper stackwalking of RuntimeStub frame |
1841 __ ret(0); | |
1842 | |
1843 // objArrayKlass | |
1844 __ BIND(L_objArray); | |
1845 // live at this point: rcx_src_klass, src[_pos], dst[_pos] | |
1846 | |
1847 Label L_plain_copy, L_checkcast_copy; | |
1848 // test array classes for subtyping | |
304 | 1849 __ cmpptr(rcx_src_klass, dst_klass_addr); // usual case is exact equality |
0 | 1850 __ jccb(Assembler::notEqual, L_checkcast_copy); |
1851 | |
1852 // Identically typed arrays can be copied without element-wise checks. | |
1853 assert_different_registers(src, src_pos, dst, dst_pos, rcx_src_klass); | |
1854 arraycopy_range_checks(src, src_pos, dst, dst_pos, LENGTH, L_failed); | |
1855 | |
1856 __ BIND(L_plain_copy); | |
304 | 1857 __ movl2ptr(count, LENGTH); // elements count |
1858 __ movl2ptr(src_pos, SRC_POS); // reload src_pos | |
1859 __ lea(from, Address(src, src_pos, Address::times_ptr, | |
1860 arrayOopDesc::base_offset_in_bytes(T_OBJECT))); // src_addr | |
1861 __ movl2ptr(dst_pos, DST_POS); // reload dst_pos | |
1862 __ lea(to, Address(dst, dst_pos, Address::times_ptr, | |
1863 arrayOopDesc::base_offset_in_bytes(T_OBJECT))); // dst_addr | |
1864 __ movptr(FROM, from); // src_addr | |
1865 __ movptr(TO, to); // dst_addr | |
0 | 1866 __ movl(COUNT, count); // count |
1867 __ jump(RuntimeAddress(entry_oop_arraycopy)); | |
1868 | |
1869 __ BIND(L_checkcast_copy); | |
1870 // live at this point: rcx_src_klass, dst[_pos], src[_pos] | |
1871 { | |
1872 // Handy offsets: | |
1873 int ek_offset = (klassOopDesc::header_size() * HeapWordSize + | |
1874 objArrayKlass::element_klass_offset_in_bytes()); | |
1875 int sco_offset = (klassOopDesc::header_size() * HeapWordSize + | |
1876 Klass::super_check_offset_offset_in_bytes()); | |
1877 | |
1878 Register rsi_dst_klass = rsi; | |
1879 Register rdi_temp = rdi; | |
1880 assert(rsi_dst_klass == src_pos, "expected alias w/ src_pos"); | |
1881 assert(rdi_temp == dst_pos, "expected alias w/ dst_pos"); | |
1882 Address dst_klass_lh_addr(rsi_dst_klass, lh_offset); | |
1883 | |
1884 // Before looking at dst.length, make sure dst is also an objArray. | |
304 | 1885 __ movptr(rsi_dst_klass, dst_klass_addr); |
0 | 1886 __ cmpl(dst_klass_lh_addr, objArray_lh); |
1887 __ jccb(Assembler::notEqual, L_failed); | |
1888 | |
1889 // It is safe to examine both src.length and dst.length. | |
304 | 1890 __ movl2ptr(src_pos, SRC_POS); // reload rsi |
0 | 1891 arraycopy_range_checks(src, src_pos, dst, dst_pos, LENGTH, L_failed); |
1892 // (Now src_pos and dst_pos are killed, but not src and dst.) | |
1893 | |
1894 // We'll need this temp (don't forget to pop it after the type check). | |
304 | 1895 __ push(rbx); |
0 | 1896 Register rbx_src_klass = rbx; |
1897 | |
304 | 1898 __ mov(rbx_src_klass, rcx_src_klass); // spill away from rcx |
1899 __ movptr(rsi_dst_klass, dst_klass_addr); | |
0 | 1900 Address super_check_offset_addr(rsi_dst_klass, sco_offset); |
1901 Label L_fail_array_check; | |
1902 generate_type_check(rbx_src_klass, | |
1903 super_check_offset_addr, dst_klass_addr, | |
1904 rdi_temp, NULL, &L_fail_array_check); | |
1905 // (On fall-through, we have passed the array type check.) | |
304 | 1906 __ pop(rbx); |
0 | 1907 __ jmp(L_plain_copy); |
1908 | |
1909 __ BIND(L_fail_array_check); | |
1910 // Reshuffle arguments so we can call checkcast_arraycopy: | |
1911 | |
1912 // match initial saves for checkcast_arraycopy | |
304 | 1913 // push(rsi); // already done; see above |
1914 // push(rdi); // already done; see above | |
1915 // push(rbx); // already done; see above | |
0 | 1916 |
1917 // Marshal outgoing arguments now, freeing registers. | |
1918 Address from_arg(rsp, 16+ 4); // from | |
1919 Address to_arg(rsp, 16+ 8); // to | |
1920 Address length_arg(rsp, 16+12); // elements count | |
1921 Address ckoff_arg(rsp, 16+16); // super_check_offset | |
1922 Address ckval_arg(rsp, 16+20); // super_klass | |
1923 | |
1924 Address SRC_POS_arg(rsp, 16+ 8); | |
1925 Address DST_POS_arg(rsp, 16+16); | |
1926 Address LENGTH_arg(rsp, 16+20); | |
1927 // push rbx, changed the incoming offsets (why not just use rbp,??) | |
1928 // assert(SRC_POS_arg.disp() == SRC_POS.disp() + 4, ""); | |
1929 | |
304 | 1930 __ movptr(rbx, Address(rsi_dst_klass, ek_offset)); |
1931 __ movl2ptr(length, LENGTH_arg); // reload elements count | |
1932 __ movl2ptr(src_pos, SRC_POS_arg); // reload src_pos | |
1933 __ movl2ptr(dst_pos, DST_POS_arg); // reload dst_pos | |
0 | 1934 |
304 | 1935 __ movptr(ckval_arg, rbx); // destination element type |
0 | 1936 __ movl(rbx, Address(rbx, sco_offset)); |
1937 __ movl(ckoff_arg, rbx); // corresponding class check offset | |
1938 | |
1939 __ movl(length_arg, length); // outgoing length argument | |
1940 | |
304 | 1941 __ lea(from, Address(src, src_pos, Address::times_ptr, |
0 | 1942 arrayOopDesc::base_offset_in_bytes(T_OBJECT))); |
304 | 1943 __ movptr(from_arg, from); |
0 | 1944 |
304 | 1945 __ lea(to, Address(dst, dst_pos, Address::times_ptr, |
0 | 1946 arrayOopDesc::base_offset_in_bytes(T_OBJECT))); |
304 | 1947 __ movptr(to_arg, to); |
0 | 1948 __ jump(RuntimeAddress(entry_checkcast_arraycopy)); |
1949 } | |
1950 | |
1951 return start; | |
1952 } | |
1953 | |
1954 void generate_arraycopy_stubs() { | |
1955 address entry; | |
1956 address entry_jbyte_arraycopy; | |
1957 address entry_jshort_arraycopy; | |
1958 address entry_jint_arraycopy; | |
1959 address entry_oop_arraycopy; | |
1960 address entry_jlong_arraycopy; | |
1961 address entry_checkcast_arraycopy; | |
1962 | |
1963 StubRoutines::_arrayof_jbyte_disjoint_arraycopy = | |
1964 generate_disjoint_copy(T_BYTE, true, Address::times_1, &entry, | |
1965 "arrayof_jbyte_disjoint_arraycopy"); | |
1966 StubRoutines::_arrayof_jbyte_arraycopy = | |
1967 generate_conjoint_copy(T_BYTE, true, Address::times_1, entry, | |
1968 NULL, "arrayof_jbyte_arraycopy"); | |
1969 StubRoutines::_jbyte_disjoint_arraycopy = | |
1970 generate_disjoint_copy(T_BYTE, false, Address::times_1, &entry, | |
1971 "jbyte_disjoint_arraycopy"); | |
1972 StubRoutines::_jbyte_arraycopy = | |
1973 generate_conjoint_copy(T_BYTE, false, Address::times_1, entry, | |
1974 &entry_jbyte_arraycopy, "jbyte_arraycopy"); | |
1975 | |
1976 StubRoutines::_arrayof_jshort_disjoint_arraycopy = | |
1977 generate_disjoint_copy(T_SHORT, true, Address::times_2, &entry, | |
1978 "arrayof_jshort_disjoint_arraycopy"); | |
1979 StubRoutines::_arrayof_jshort_arraycopy = | |
1980 generate_conjoint_copy(T_SHORT, true, Address::times_2, entry, | |
1981 NULL, "arrayof_jshort_arraycopy"); | |
1982 StubRoutines::_jshort_disjoint_arraycopy = | |
1983 generate_disjoint_copy(T_SHORT, false, Address::times_2, &entry, | |
1984 "jshort_disjoint_arraycopy"); | |
1985 StubRoutines::_jshort_arraycopy = | |
1986 generate_conjoint_copy(T_SHORT, false, Address::times_2, entry, | |
1987 &entry_jshort_arraycopy, "jshort_arraycopy"); | |
1988 | |
1989 // Next arrays are always aligned on 4 bytes at least. | |
1990 StubRoutines::_jint_disjoint_arraycopy = | |
1991 generate_disjoint_copy(T_INT, true, Address::times_4, &entry, | |
1992 "jint_disjoint_arraycopy"); | |
1993 StubRoutines::_jint_arraycopy = | |
1994 generate_conjoint_copy(T_INT, true, Address::times_4, entry, | |
1995 &entry_jint_arraycopy, "jint_arraycopy"); | |
1996 | |
1997 StubRoutines::_oop_disjoint_arraycopy = | |
304 | 1998 generate_disjoint_copy(T_OBJECT, true, Address::times_ptr, &entry, |
0 | 1999 "oop_disjoint_arraycopy"); |
2000 StubRoutines::_oop_arraycopy = | |
304 | 2001 generate_conjoint_copy(T_OBJECT, true, Address::times_ptr, entry, |
0 | 2002 &entry_oop_arraycopy, "oop_arraycopy"); |
2003 | |
2004 StubRoutines::_jlong_disjoint_arraycopy = | |
2005 generate_disjoint_long_copy(&entry, "jlong_disjoint_arraycopy"); | |
2006 StubRoutines::_jlong_arraycopy = | |
2007 generate_conjoint_long_copy(entry, &entry_jlong_arraycopy, | |
2008 "jlong_arraycopy"); | |
2009 | |
2010 StubRoutines::_arrayof_jint_disjoint_arraycopy = | |
2011 StubRoutines::_jint_disjoint_arraycopy; | |
2012 StubRoutines::_arrayof_oop_disjoint_arraycopy = | |
2013 StubRoutines::_oop_disjoint_arraycopy; | |
2014 StubRoutines::_arrayof_jlong_disjoint_arraycopy = | |
2015 StubRoutines::_jlong_disjoint_arraycopy; | |
2016 | |
2017 StubRoutines::_arrayof_jint_arraycopy = StubRoutines::_jint_arraycopy; | |
2018 StubRoutines::_arrayof_oop_arraycopy = StubRoutines::_oop_arraycopy; | |
2019 StubRoutines::_arrayof_jlong_arraycopy = StubRoutines::_jlong_arraycopy; | |
2020 | |
2021 StubRoutines::_checkcast_arraycopy = | |
2022 generate_checkcast_copy("checkcast_arraycopy", | |
2023 &entry_checkcast_arraycopy); | |
2024 | |
2025 StubRoutines::_unsafe_arraycopy = | |
2026 generate_unsafe_copy("unsafe_arraycopy", | |
2027 entry_jbyte_arraycopy, | |
2028 entry_jshort_arraycopy, | |
2029 entry_jint_arraycopy, | |
2030 entry_jlong_arraycopy); | |
2031 | |
2032 StubRoutines::_generic_arraycopy = | |
2033 generate_generic_copy("generic_arraycopy", | |
2034 entry_jbyte_arraycopy, | |
2035 entry_jshort_arraycopy, | |
2036 entry_jint_arraycopy, | |
2037 entry_oop_arraycopy, | |
2038 entry_jlong_arraycopy, | |
2039 entry_checkcast_arraycopy); | |
2040 } | |
2041 | |
1174
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2042 void generate_math_stubs() { |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2043 { |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2044 StubCodeMark mark(this, "StubRoutines", "log"); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2045 StubRoutines::_intrinsic_log = (double (*)(double)) __ pc(); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2046 |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2047 __ fld_d(Address(rsp, 4)); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2048 __ flog(); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2049 __ ret(0); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2050 } |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2051 { |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2052 StubCodeMark mark(this, "StubRoutines", "log10"); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2053 StubRoutines::_intrinsic_log10 = (double (*)(double)) __ pc(); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2054 |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2055 __ fld_d(Address(rsp, 4)); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2056 __ flog10(); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2057 __ ret(0); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2058 } |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2059 { |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2060 StubCodeMark mark(this, "StubRoutines", "sin"); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2061 StubRoutines::_intrinsic_sin = (double (*)(double)) __ pc(); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2062 |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2063 __ fld_d(Address(rsp, 4)); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2064 __ trigfunc('s'); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2065 __ ret(0); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2066 } |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2067 { |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2068 StubCodeMark mark(this, "StubRoutines", "cos"); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2069 StubRoutines::_intrinsic_cos = (double (*)(double)) __ pc(); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2070 |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2071 __ fld_d(Address(rsp, 4)); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2072 __ trigfunc('c'); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2073 __ ret(0); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2074 } |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2075 { |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2076 StubCodeMark mark(this, "StubRoutines", "tan"); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2077 StubRoutines::_intrinsic_tan = (double (*)(double)) __ pc(); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2078 |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2079 __ fld_d(Address(rsp, 4)); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2080 __ trigfunc('t'); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2081 __ ret(0); |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2082 } |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2083 |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2084 // 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:
845
diff
changeset
|
2085 // the strict version. |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2086 StubRoutines::_intrinsic_exp = SharedRuntime::dexp; |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2087 StubRoutines::_intrinsic_pow = SharedRuntime::dpow; |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2088 } |
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2089 |
0 | 2090 public: |
2091 // Information about frame layout at time of blocking runtime call. | |
2092 // Note that we only have to preserve callee-saved registers since | |
2093 // the compilers are responsible for supplying a continuation point | |
2094 // if they expect all registers to be preserved. | |
2095 enum layout { | |
2096 thread_off, // last_java_sp | |
2097 rbp_off, // callee saved register | |
2098 ret_pc, | |
2099 framesize | |
2100 }; | |
2101 | |
2102 private: | |
2103 | |
2104 #undef __ | |
2105 #define __ masm-> | |
2106 | |
2107 //------------------------------------------------------------------------------------------------------------------------ | |
2108 // Continuation point for throwing of implicit exceptions that are not handled in | |
2109 // the current activation. Fabricates an exception oop and initiates normal | |
2110 // exception dispatching in this frame. | |
2111 // | |
2112 // Previously the compiler (c2) allowed for callee save registers on Java calls. | |
2113 // This is no longer true after adapter frames were removed but could possibly | |
2114 // be brought back in the future if the interpreter code was reworked and it | |
2115 // was deemed worthwhile. The comment below was left to describe what must | |
2116 // happen here if callee saves were resurrected. As it stands now this stub | |
2117 // could actually be a vanilla BufferBlob and have now oopMap at all. | |
2118 // Since it doesn't make much difference we've chosen to leave it the | |
2119 // way it was in the callee save days and keep the comment. | |
2120 | |
2121 // If we need to preserve callee-saved values we need a callee-saved oop map and | |
2122 // therefore have to make these stubs into RuntimeStubs rather than BufferBlobs. | |
2123 // If the compiler needs all registers to be preserved between the fault | |
2124 // point and the exception handler then it must assume responsibility for that in | |
2125 // AbstractCompiler::continuation_for_implicit_null_exception or | |
2126 // continuation_for_implicit_division_by_zero_exception. All other implicit | |
2127 // exceptions (e.g., NullPointerException or AbstractMethodError on entry) are | |
2128 // either at call sites or otherwise assume that stack unwinding will be initiated, | |
2129 // so caller saved registers were assumed volatile in the compiler. | |
2130 address generate_throw_exception(const char* name, address runtime_entry, | |
2131 bool restore_saved_exception_pc) { | |
2132 | |
2133 int insts_size = 256; | |
2134 int locs_size = 32; | |
2135 | |
2136 CodeBuffer code(name, insts_size, locs_size); | |
2137 OopMapSet* oop_maps = new OopMapSet(); | |
2138 MacroAssembler* masm = new MacroAssembler(&code); | |
2139 | |
2140 address start = __ pc(); | |
2141 | |
2142 // This is an inlined and slightly modified version of call_VM | |
2143 // which has the ability to fetch the return PC out of | |
2144 // thread-local storage and also sets up last_Java_sp slightly | |
2145 // differently than the real call_VM | |
2146 Register java_thread = rbx; | |
2147 __ get_thread(java_thread); | |
2148 if (restore_saved_exception_pc) { | |
304 | 2149 __ movptr(rax, Address(java_thread, in_bytes(JavaThread::saved_exception_pc_offset()))); |
2150 __ push(rax); | |
0 | 2151 } |
2152 | |
2153 __ enter(); // required for proper stackwalking of RuntimeStub frame | |
2154 | |
2155 // pc and rbp, already pushed | |
304 | 2156 __ subptr(rsp, (framesize-2) * wordSize); // prolog |
0 | 2157 |
2158 // Frame is now completed as far as size and linkage. | |
2159 | |
2160 int frame_complete = __ pc() - start; | |
2161 | |
2162 // push java thread (becomes first argument of C function) | |
304 | 2163 __ movptr(Address(rsp, thread_off * wordSize), java_thread); |
0 | 2164 |
2165 // Set up last_Java_sp and last_Java_fp | |
2166 __ set_last_Java_frame(java_thread, rsp, rbp, NULL); | |
2167 | |
2168 // Call runtime | |
2169 BLOCK_COMMENT("call runtime_entry"); | |
2170 __ call(RuntimeAddress(runtime_entry)); | |
2171 // Generate oop map | |
2172 OopMap* map = new OopMap(framesize, 0); | |
2173 oop_maps->add_gc_map(__ pc() - start, map); | |
2174 | |
2175 // restore the thread (cannot use the pushed argument since arguments | |
2176 // may be overwritten by C code generated by an optimizing compiler); | |
2177 // however can use the register value directly if it is callee saved. | |
2178 __ get_thread(java_thread); | |
2179 | |
2180 __ reset_last_Java_frame(java_thread, true, false); | |
2181 | |
2182 __ leave(); // required for proper stackwalking of RuntimeStub frame | |
2183 | |
2184 // check for pending exceptions | |
2185 #ifdef ASSERT | |
2186 Label L; | |
304 | 2187 __ cmpptr(Address(java_thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD); |
0 | 2188 __ jcc(Assembler::notEqual, L); |
2189 __ should_not_reach_here(); | |
2190 __ bind(L); | |
2191 #endif /* ASSERT */ | |
2192 __ jump(RuntimeAddress(StubRoutines::forward_exception_entry())); | |
2193 | |
2194 | |
2195 RuntimeStub* stub = RuntimeStub::new_runtime_stub(name, &code, frame_complete, framesize, oop_maps, false); | |
2196 return stub->entry_point(); | |
2197 } | |
2198 | |
2199 | |
2200 void create_control_words() { | |
2201 // Round to nearest, 53-bit mode, exceptions masked | |
2202 StubRoutines::_fpu_cntrl_wrd_std = 0x027F; | |
2203 // Round to zero, 53-bit mode, exception mased | |
2204 StubRoutines::_fpu_cntrl_wrd_trunc = 0x0D7F; | |
2205 // Round to nearest, 24-bit mode, exceptions masked | |
2206 StubRoutines::_fpu_cntrl_wrd_24 = 0x007F; | |
2207 // Round to nearest, 64-bit mode, exceptions masked | |
2208 StubRoutines::_fpu_cntrl_wrd_64 = 0x037F; | |
2209 // Round to nearest, 64-bit mode, exceptions masked | |
2210 StubRoutines::_mxcsr_std = 0x1F80; | |
2211 // Note: the following two constants are 80-bit values | |
2212 // layout is critical for correct loading by FPU. | |
2213 // Bias for strict fp multiply/divide | |
2214 StubRoutines::_fpu_subnormal_bias1[0]= 0x00000000; // 2^(-15360) == 0x03ff 8000 0000 0000 0000 | |
2215 StubRoutines::_fpu_subnormal_bias1[1]= 0x80000000; | |
2216 StubRoutines::_fpu_subnormal_bias1[2]= 0x03ff; | |
2217 // Un-Bias for strict fp multiply/divide | |
2218 StubRoutines::_fpu_subnormal_bias2[0]= 0x00000000; // 2^(+15360) == 0x7bff 8000 0000 0000 0000 | |
2219 StubRoutines::_fpu_subnormal_bias2[1]= 0x80000000; | |
2220 StubRoutines::_fpu_subnormal_bias2[2]= 0x7bff; | |
2221 } | |
2222 | |
2223 //--------------------------------------------------------------------------- | |
2224 // Initialization | |
2225 | |
2226 void generate_initial() { | |
2227 // Generates all stubs and initializes the entry points | |
2228 | |
2229 //------------------------------------------------------------------------------------------------------------------------ | |
2230 // entry points that exist in all platforms | |
2231 // Note: This is code that could be shared among different platforms - however the benefit seems to be smaller than | |
2232 // the disadvantage of having a much more complicated generator structure. See also comment in stubRoutines.hpp. | |
2233 StubRoutines::_forward_exception_entry = generate_forward_exception(); | |
2234 | |
2235 StubRoutines::_call_stub_entry = | |
2236 generate_call_stub(StubRoutines::_call_stub_return_address); | |
2237 // is referenced by megamorphic call | |
2238 StubRoutines::_catch_exception_entry = generate_catch_exception(); | |
2239 | |
2240 // These are currently used by Solaris/Intel | |
2241 StubRoutines::_atomic_xchg_entry = generate_atomic_xchg(); | |
2242 | |
2243 StubRoutines::_handler_for_unsafe_access_entry = | |
2244 generate_handler_for_unsafe_access(); | |
2245 | |
2246 // platform dependent | |
2247 create_control_words(); | |
2248 | |
304 | 2249 StubRoutines::x86::_verify_mxcsr_entry = generate_verify_mxcsr(); |
2250 StubRoutines::x86::_verify_fpu_cntrl_wrd_entry = generate_verify_fpu_cntrl_wrd(); | |
0 | 2251 StubRoutines::_d2i_wrapper = generate_d2i_wrapper(T_INT, |
2252 CAST_FROM_FN_PTR(address, SharedRuntime::d2i)); | |
2253 StubRoutines::_d2l_wrapper = generate_d2i_wrapper(T_LONG, | |
2254 CAST_FROM_FN_PTR(address, SharedRuntime::d2l)); | |
2255 } | |
2256 | |
2257 | |
2258 void generate_all() { | |
2259 // Generates all stubs and initializes the entry points | |
2260 | |
2261 // These entry points require SharedInfo::stack0 to be set up in non-core builds | |
2262 // and need to be relocatable, so they each fabricate a RuntimeStub internally. | |
2263 StubRoutines::_throw_AbstractMethodError_entry = generate_throw_exception("AbstractMethodError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_AbstractMethodError), false); | |
16
f8236e79048a
6664627: Merge changes made only in hotspot 11 forward to jdk 7
dcubed
parents:
0
diff
changeset
|
2264 StubRoutines::_throw_IncompatibleClassChangeError_entry= generate_throw_exception("IncompatibleClassChangeError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_IncompatibleClassChangeError), false); |
0 | 2265 StubRoutines::_throw_ArithmeticException_entry = generate_throw_exception("ArithmeticException throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_ArithmeticException), true); |
2266 StubRoutines::_throw_NullPointerException_entry = generate_throw_exception("NullPointerException throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_NullPointerException), true); | |
2267 StubRoutines::_throw_NullPointerException_at_call_entry= generate_throw_exception("NullPointerException at call throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_NullPointerException_at_call), false); | |
2268 StubRoutines::_throw_StackOverflowError_entry = generate_throw_exception("StackOverflowError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError), false); | |
2269 | |
2270 //------------------------------------------------------------------------------------------------------------------------ | |
2271 // entry points that are platform specific | |
2272 | |
2273 // support for verify_oop (must happen after universe_init) | |
2274 StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop(); | |
2275 | |
2276 // arraycopy stubs used by compilers | |
2277 generate_arraycopy_stubs(); | |
710 | 2278 |
1174
ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
never
parents:
845
diff
changeset
|
2279 generate_math_stubs(); |
0 | 2280 } |
2281 | |
2282 | |
2283 public: | |
2284 StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) { | |
2285 if (all) { | |
2286 generate_all(); | |
2287 } else { | |
2288 generate_initial(); | |
2289 } | |
2290 } | |
2291 }; // end class declaration | |
2292 | |
2293 | |
2294 void StubGenerator_generate(CodeBuffer* code, bool all) { | |
2295 StubGenerator g(code, all); | |
2296 } |