Mercurial > hg > graal-jvmci-8
comparison src/cpu/sparc/vm/sharedRuntime_sparc.cpp @ 3839:3d42f82cd811
7063628: Use cbcond on T4
Summary: Add new short branch instruction to Hotspot sparc assembler.
Reviewed-by: never, twisti, jrose
author | kvn |
---|---|
date | Thu, 21 Jul 2011 11:25:07 -0700 |
parents | cba7b5c2d53f |
children | 6729bbc1fcd6 |
comparison
equal
deleted
inserted
replaced
3838:6a991dcb52bb | 3839:3d42f82cd811 |
---|---|
598 | 598 |
599 // Patch the callers callsite with entry to compiled code if it exists. | 599 // Patch the callers callsite with entry to compiled code if it exists. |
600 void AdapterGenerator::patch_callers_callsite() { | 600 void AdapterGenerator::patch_callers_callsite() { |
601 Label L; | 601 Label L; |
602 __ ld_ptr(G5_method, in_bytes(methodOopDesc::code_offset()), G3_scratch); | 602 __ ld_ptr(G5_method, in_bytes(methodOopDesc::code_offset()), G3_scratch); |
603 __ br_null(G3_scratch, false, __ pt, L); | 603 __ br_null(G3_scratch, false, Assembler::pt, L); |
604 // Schedule the branch target address early. | 604 // Schedule the branch target address early. |
605 __ delayed()->ld_ptr(G5_method, in_bytes(methodOopDesc::interpreter_entry_offset()), G3_scratch); | 605 __ delayed()->ld_ptr(G5_method, in_bytes(methodOopDesc::interpreter_entry_offset()), G3_scratch); |
606 // Call into the VM to patch the caller, then jump to compiled callee | 606 // Call into the VM to patch the caller, then jump to compiled callee |
607 __ save_frame(4); // Args in compiled layout; do not blow them | 607 __ save_frame(4); // Args in compiled layout; do not blow them |
608 | 608 |
1125 __ save_frame(0); | 1125 __ save_frame(0); |
1126 __ mov(G0, L0); | 1126 __ mov(G0, L0); |
1127 Label loop; | 1127 Label loop; |
1128 __ bind(loop); | 1128 __ bind(loop); |
1129 __ sub(L0, 1, L0); | 1129 __ sub(L0, 1, L0); |
1130 __ br_null(L0, false, Assembler::pt, loop); | 1130 __ br_null_short(L0, Assembler::pt, loop); |
1131 __ delayed()->nop(); | |
1132 | 1131 |
1133 __ restore(); | 1132 __ restore(); |
1134 } | 1133 } |
1135 | 1134 |
1136 | 1135 |
1200 // Method might have been compiled since the call site was patched to | 1199 // Method might have been compiled since the call site was patched to |
1201 // interpreted if that is the case treat it as a miss so we can get | 1200 // interpreted if that is the case treat it as a miss so we can get |
1202 // the call site corrected. | 1201 // the call site corrected. |
1203 __ ld_ptr(G5_method, in_bytes(methodOopDesc::code_offset()), G3_scratch); | 1202 __ ld_ptr(G5_method, in_bytes(methodOopDesc::code_offset()), G3_scratch); |
1204 __ bind(ok2); | 1203 __ bind(ok2); |
1205 __ br_null(G3_scratch, false, __ pt, skip_fixup); | 1204 __ br_null(G3_scratch, false, Assembler::pt, skip_fixup); |
1206 __ delayed()->ld_ptr(G5_method, in_bytes(methodOopDesc::interpreter_entry_offset()), G3_scratch); | 1205 __ delayed()->ld_ptr(G5_method, in_bytes(methodOopDesc::interpreter_entry_offset()), G3_scratch); |
1207 __ jump_to(ic_miss, G3_scratch); | 1206 __ jump_to(ic_miss, G3_scratch); |
1208 __ delayed()->nop(); | 1207 __ delayed()->nop(); |
1209 | 1208 |
1210 } | 1209 } |
1777 Label L; | 1776 Label L; |
1778 const Register temp_reg = G3_scratch; | 1777 const Register temp_reg = G3_scratch; |
1779 AddressLiteral ic_miss(SharedRuntime::get_ic_miss_stub()); | 1778 AddressLiteral ic_miss(SharedRuntime::get_ic_miss_stub()); |
1780 __ verify_oop(O0); | 1779 __ verify_oop(O0); |
1781 __ load_klass(O0, temp_reg); | 1780 __ load_klass(O0, temp_reg); |
1782 __ cmp(temp_reg, G5_inline_cache_reg); | 1781 __ cmp_and_brx_short(temp_reg, G5_inline_cache_reg, Assembler::equal, Assembler::pt, L); |
1783 __ brx(Assembler::equal, true, Assembler::pt, L); | |
1784 __ delayed()->nop(); | |
1785 | 1782 |
1786 __ jump_to(ic_miss, temp_reg); | 1783 __ jump_to(ic_miss, temp_reg); |
1787 __ delayed()->nop(); | 1784 __ delayed()->nop(); |
1788 __ align(CodeEntryAlignment); | 1785 __ align(CodeEntryAlignment); |
1789 __ bind(L); | 1786 __ bind(L); |
2180 __ reset_last_Java_frame(); | 2177 __ reset_last_Java_frame(); |
2181 | 2178 |
2182 #ifdef ASSERT | 2179 #ifdef ASSERT |
2183 { Label L; | 2180 { Label L; |
2184 __ ld_ptr(G2_thread, in_bytes(Thread::pending_exception_offset()), O0); | 2181 __ ld_ptr(G2_thread, in_bytes(Thread::pending_exception_offset()), O0); |
2185 __ br_null(O0, false, Assembler::pt, L); | 2182 __ br_null_short(O0, Assembler::pt, L); |
2186 __ delayed()->nop(); | |
2187 __ stop("no pending exception allowed on exit from IR::monitorenter"); | 2183 __ stop("no pending exception allowed on exit from IR::monitorenter"); |
2188 __ bind(L); | 2184 __ bind(L); |
2189 } | 2185 } |
2190 #endif | 2186 #endif |
2191 __ bind(done); | 2187 __ bind(done); |
2296 | 2292 |
2297 Label L; | 2293 Label L; |
2298 Address suspend_state(G2_thread, JavaThread::suspend_flags_offset()); | 2294 Address suspend_state(G2_thread, JavaThread::suspend_flags_offset()); |
2299 __ br(Assembler::notEqual, false, Assembler::pn, L); | 2295 __ br(Assembler::notEqual, false, Assembler::pn, L); |
2300 __ delayed()->ld(suspend_state, G3_scratch); | 2296 __ delayed()->ld(suspend_state, G3_scratch); |
2301 __ cmp(G3_scratch, 0); | 2297 __ cmp_and_br_short(G3_scratch, 0, Assembler::equal, Assembler::pt, no_block); |
2302 __ br(Assembler::equal, false, Assembler::pt, no_block); | |
2303 __ delayed()->nop(); | |
2304 __ bind(L); | 2298 __ bind(L); |
2305 | 2299 |
2306 // Block. Save any potential method result value before the operation and | 2300 // Block. Save any potential method result value before the operation and |
2307 // use a leaf call to leave the last_Java_frame setup undisturbed. Doing this | 2301 // use a leaf call to leave the last_Java_frame setup undisturbed. Doing this |
2308 // lets us share the oopMap we used when we went native rather the create | 2302 // lets us share the oopMap we used when we went native rather the create |
2326 __ st(G3_scratch, G2_thread, JavaThread::thread_state_offset()); | 2320 __ st(G3_scratch, G2_thread, JavaThread::thread_state_offset()); |
2327 | 2321 |
2328 | 2322 |
2329 Label no_reguard; | 2323 Label no_reguard; |
2330 __ ld(G2_thread, JavaThread::stack_guard_state_offset(), G3_scratch); | 2324 __ ld(G2_thread, JavaThread::stack_guard_state_offset(), G3_scratch); |
2331 __ cmp(G3_scratch, JavaThread::stack_guard_yellow_disabled); | 2325 __ cmp_and_br_short(G3_scratch, JavaThread::stack_guard_yellow_disabled, Assembler::notEqual, Assembler::pt, no_reguard); |
2332 __ br(Assembler::notEqual, false, Assembler::pt, no_reguard); | |
2333 __ delayed()->nop(); | |
2334 | 2326 |
2335 save_native_result(masm, ret_type, stack_slots); | 2327 save_native_result(masm, ret_type, stack_slots); |
2336 __ call(CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages)); | 2328 __ call(CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages)); |
2337 __ delayed()->nop(); | 2329 __ delayed()->nop(); |
2338 | 2330 |
2380 __ restore_thread(L7_thread_cache); // restore G2_thread | 2372 __ restore_thread(L7_thread_cache); // restore G2_thread |
2381 | 2373 |
2382 #ifdef ASSERT | 2374 #ifdef ASSERT |
2383 { Label L; | 2375 { Label L; |
2384 __ ld_ptr(G2_thread, in_bytes(Thread::pending_exception_offset()), O0); | 2376 __ ld_ptr(G2_thread, in_bytes(Thread::pending_exception_offset()), O0); |
2385 __ br_null(O0, false, Assembler::pt, L); | 2377 __ br_null_short(O0, Assembler::pt, L); |
2386 __ delayed()->nop(); | |
2387 __ stop("no pending exception allowed on exit from IR::monitorexit"); | 2378 __ stop("no pending exception allowed on exit from IR::monitorexit"); |
2388 __ bind(L); | 2379 __ bind(L); |
2389 } | 2380 } |
2390 #endif | 2381 #endif |
2391 restore_native_result(masm, ret_type, stack_slots); | 2382 restore_native_result(masm, ret_type, stack_slots); |
2637 Label L; | 2628 Label L; |
2638 const Register temp_reg = G3_scratch; | 2629 const Register temp_reg = G3_scratch; |
2639 AddressLiteral ic_miss(SharedRuntime::get_ic_miss_stub()); | 2630 AddressLiteral ic_miss(SharedRuntime::get_ic_miss_stub()); |
2640 __ verify_oop(O0); | 2631 __ verify_oop(O0); |
2641 __ ld_ptr(O0, oopDesc::klass_offset_in_bytes(), temp_reg); | 2632 __ ld_ptr(O0, oopDesc::klass_offset_in_bytes(), temp_reg); |
2642 __ cmp(temp_reg, G5_inline_cache_reg); | 2633 __ cmp_and_brx_short(temp_reg, G5_inline_cache_reg, Assembler::equal, Assembler::pt, L); |
2643 __ brx(Assembler::equal, true, Assembler::pt, L); | |
2644 __ delayed()->nop(); | |
2645 | 2634 |
2646 __ jump_to(ic_miss, temp_reg); | 2635 __ jump_to(ic_miss, temp_reg); |
2647 __ delayed()->nop(); | 2636 __ delayed()->nop(); |
2648 __ align(CodeEntryAlignment); | 2637 __ align(CodeEntryAlignment); |
2649 __ bind(L); | 2638 __ bind(L); |
3141 | 3130 |
3142 // allocate a new frame, filling the registers | 3131 // allocate a new frame, filling the registers |
3143 | 3132 |
3144 gen_new_frame(masm, deopt); // allocate an interpreter frame | 3133 gen_new_frame(masm, deopt); // allocate an interpreter frame |
3145 | 3134 |
3146 __ tst(O4array_size); | 3135 __ cmp_zero_and_br(Assembler::notZero, O4array_size, loop); |
3147 __ br(Assembler::notZero, false, Assembler::pn, loop); | |
3148 __ delayed()->add(O3array, wordSize, O3array); | 3136 __ delayed()->add(O3array, wordSize, O3array); |
3149 __ ld_ptr(G3pcs, 0, O7); // load final frame new pc | 3137 __ ld_ptr(G3pcs, 0, O7); // load final frame new pc |
3150 | 3138 |
3151 } | 3139 } |
3152 | 3140 |
3219 // On entry we have been called by the deoptimized nmethod with a call that | 3207 // On entry we have been called by the deoptimized nmethod with a call that |
3220 // replaced the original call (or safepoint polling location) so the deoptimizing | 3208 // replaced the original call (or safepoint polling location) so the deoptimizing |
3221 // pc is now in O7. Return values are still in the expected places | 3209 // pc is now in O7. Return values are still in the expected places |
3222 | 3210 |
3223 map = RegisterSaver::save_live_registers(masm, 0, &frame_size_words); | 3211 map = RegisterSaver::save_live_registers(masm, 0, &frame_size_words); |
3224 __ ba(false, cont); | 3212 __ ba(cont); |
3225 __ delayed()->mov(Deoptimization::Unpack_deopt, L0deopt_mode); | 3213 __ delayed()->mov(Deoptimization::Unpack_deopt, L0deopt_mode); |
3226 | 3214 |
3227 int exception_offset = __ offset() - start; | 3215 int exception_offset = __ offset() - start; |
3228 | 3216 |
3229 // restore G2, the trampoline destroyed it | 3217 // restore G2, the trampoline destroyed it |
3254 #ifdef ASSERT | 3242 #ifdef ASSERT |
3255 { | 3243 { |
3256 // verify that there is really an exception oop in exception_oop | 3244 // verify that there is really an exception oop in exception_oop |
3257 Label has_exception; | 3245 Label has_exception; |
3258 __ ld_ptr(G2_thread, JavaThread::exception_oop_offset(), Oexception); | 3246 __ ld_ptr(G2_thread, JavaThread::exception_oop_offset(), Oexception); |
3259 __ br_notnull(Oexception, false, Assembler::pt, has_exception); | 3247 __ br_notnull_short(Oexception, Assembler::pt, has_exception); |
3260 __ delayed()-> nop(); | |
3261 __ stop("no exception in thread"); | 3248 __ stop("no exception in thread"); |
3262 __ bind(has_exception); | 3249 __ bind(has_exception); |
3263 | 3250 |
3264 // verify that there is no pending exception | 3251 // verify that there is no pending exception |
3265 Label no_pending_exception; | 3252 Label no_pending_exception; |
3266 Address exception_addr(G2_thread, Thread::pending_exception_offset()); | 3253 Address exception_addr(G2_thread, Thread::pending_exception_offset()); |
3267 __ ld_ptr(exception_addr, Oexception); | 3254 __ ld_ptr(exception_addr, Oexception); |
3268 __ br_null(Oexception, false, Assembler::pt, no_pending_exception); | 3255 __ br_null_short(Oexception, Assembler::pt, no_pending_exception); |
3269 __ delayed()->nop(); | |
3270 __ stop("must not have pending exception here"); | 3256 __ stop("must not have pending exception here"); |
3271 __ bind(no_pending_exception); | 3257 __ bind(no_pending_exception); |
3272 } | 3258 } |
3273 #endif | 3259 #endif |
3274 | 3260 |
3275 __ ba(false, cont); | 3261 __ ba(cont); |
3276 __ delayed()->mov(Deoptimization::Unpack_exception, L0deopt_mode);; | 3262 __ delayed()->mov(Deoptimization::Unpack_exception, L0deopt_mode);; |
3277 | 3263 |
3278 // | 3264 // |
3279 // Reexecute entry, similar to c2 uncommon trap | 3265 // Reexecute entry, similar to c2 uncommon trap |
3280 // | 3266 // |
3311 __ mov(O0, O2UnrollBlock->after_save()); | 3297 __ mov(O0, O2UnrollBlock->after_save()); |
3312 | 3298 |
3313 RegisterSaver::restore_result_registers(masm); | 3299 RegisterSaver::restore_result_registers(masm); |
3314 | 3300 |
3315 Label noException; | 3301 Label noException; |
3316 __ cmp(G4deopt_mode, Deoptimization::Unpack_exception); // Was exception pending? | 3302 __ cmp_and_br_short(G4deopt_mode, Deoptimization::Unpack_exception, Assembler::notEqual, Assembler::pt, noException); |
3317 __ br(Assembler::notEqual, false, Assembler::pt, noException); | |
3318 __ delayed()->nop(); | |
3319 | 3303 |
3320 // Move the pending exception from exception_oop to Oexception so | 3304 // Move the pending exception from exception_oop to Oexception so |
3321 // the pending exception will be picked up the interpreter. | 3305 // the pending exception will be picked up the interpreter. |
3322 __ ld_ptr(G2_thread, in_bytes(JavaThread::exception_oop_offset()), Oexception); | 3306 __ ld_ptr(G2_thread, in_bytes(JavaThread::exception_oop_offset()), Oexception); |
3323 __ st_ptr(G0, G2_thread, in_bytes(JavaThread::exception_oop_offset())); | 3307 __ st_ptr(G0, G2_thread, in_bytes(JavaThread::exception_oop_offset())); |
3357 | 3341 |
3358 #if !defined(_LP64) && defined(COMPILER2) | 3342 #if !defined(_LP64) && defined(COMPILER2) |
3359 // In 32 bit, C2 returns longs in G1 so restore the saved G1 into | 3343 // In 32 bit, C2 returns longs in G1 so restore the saved G1 into |
3360 // I0/I1 if the return value is long. | 3344 // I0/I1 if the return value is long. |
3361 Label not_long; | 3345 Label not_long; |
3362 __ cmp(O0,T_LONG); | 3346 __ cmp_and_br_short(O0,T_LONG, Assembler::notEqual, Assembler::pt, not_long); |
3363 __ br(Assembler::notEqual, false, Assembler::pt, not_long); | |
3364 __ delayed()->nop(); | |
3365 __ ldd(saved_Greturn1_addr,I0); | 3347 __ ldd(saved_Greturn1_addr,I0); |
3366 __ bind(not_long); | 3348 __ bind(not_long); |
3367 #endif | 3349 #endif |
3368 __ ret(); | 3350 __ ret(); |
3369 __ delayed()->restore(); | 3351 __ delayed()->restore(); |
3532 | 3514 |
3533 // Check for exceptions | 3515 // Check for exceptions |
3534 Label pending; | 3516 Label pending; |
3535 | 3517 |
3536 __ ld_ptr(G2_thread, in_bytes(Thread::pending_exception_offset()), O1); | 3518 __ ld_ptr(G2_thread, in_bytes(Thread::pending_exception_offset()), O1); |
3537 __ tst(O1); | 3519 __ br_notnull_short(O1, Assembler::pn, pending); |
3538 __ brx(Assembler::notEqual, true, Assembler::pn, pending); | |
3539 __ delayed()->nop(); | |
3540 | 3520 |
3541 RegisterSaver::restore_live_registers(masm); | 3521 RegisterSaver::restore_live_registers(masm); |
3542 | 3522 |
3543 // We are back the the original state on entry and ready to go. | 3523 // We are back the the original state on entry and ready to go. |
3544 | 3524 |
3621 | 3601 |
3622 // Check for exceptions | 3602 // Check for exceptions |
3623 Label pending; | 3603 Label pending; |
3624 | 3604 |
3625 __ ld_ptr(G2_thread, in_bytes(Thread::pending_exception_offset()), O1); | 3605 __ ld_ptr(G2_thread, in_bytes(Thread::pending_exception_offset()), O1); |
3626 __ tst(O1); | 3606 __ br_notnull_short(O1, Assembler::pn, pending); |
3627 __ brx(Assembler::notEqual, true, Assembler::pn, pending); | |
3628 __ delayed()->nop(); | |
3629 | 3607 |
3630 // get the returned methodOop | 3608 // get the returned methodOop |
3631 | 3609 |
3632 __ get_vm_result(G5_method); | 3610 __ get_vm_result(G5_method); |
3633 __ stx(G5_method, SP, RegisterSaver::G5_offset()+STACK_BIAS); | 3611 __ stx(G5_method, SP, RegisterSaver::G5_offset()+STACK_BIAS); |