src/cpu/sparc/vm/macroAssembler_sparc.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8074457 Sdiff src/cpu/sparc/vm

src/cpu/sparc/vm/macroAssembler_sparc.cpp

Print this page




 384   inc(L4, 3 * BytesPerInstWord); // skip rdpc + inc + st_ptr to point L4 at call  st_ptr(L4, L3, 0);
 385 #endif
 386   call(CAST_FROM_FN_PTR(address, reinitialize_thread), relocInfo::runtime_call_type);
 387   delayed()->nop();
 388   mov(L0, G1);
 389   mov(L1, G5_method);
 390   mov(L2, G3);
 391   mov(L5, G4);
 392   restore(O0, 0, G2_thread);
 393 }
 394 
 395 static Thread* verify_thread_subroutine(Thread* gthread_value) {
 396   Thread* correct_value = Thread::current();
 397   guarantee(gthread_value == correct_value, "G2_thread value must be the thread");
 398   return correct_value;
 399 }
 400 
 401 void MacroAssembler::verify_thread() {
 402   if (VerifyThread) {
 403     // NOTE: this chops off the heads of the 64-bit O registers.
 404 #ifdef CC_INTERP
 405     save_frame(0);
 406 #else
 407     // make sure G2_thread contains the right value
 408     save_frame_and_mov(0, Lmethod, Lmethod);   // to avoid clobbering O0 (and propagate Lmethod for -Xprof)
 409     mov(G1, L1);                // avoid clobbering G1
 410     // G2 saved below
 411     mov(G3, L3);                // avoid clobbering G3
 412     mov(G4, L4);                // avoid clobbering G4
 413     mov(G5_method, L5);         // avoid clobbering G5_method
 414 #endif /* CC_INTERP */
 415 #if defined(COMPILER2) && !defined(_LP64)
 416     // Save & restore possible 64-bit Long arguments in G-regs
 417     srlx(G1,32,L0);
 418     srlx(G4,32,L6);
 419 #endif
 420     call(CAST_FROM_FN_PTR(address,verify_thread_subroutine), relocInfo::runtime_call_type);
 421     delayed()->mov(G2_thread, O0);
 422 
 423     mov(L1, G1);                // Restore G1
 424     // G2 restored below
 425     mov(L3, G3);                // restore G3
 426     mov(L4, G4);                // restore G4
 427     mov(L5, G5_method);         // restore G5_method
 428 #if defined(COMPILER2) && !defined(_LP64)
 429     // Save & restore possible 64-bit Long arguments in G-regs
 430     sllx(L0,32,G2);             // Move old high G1 bits high in G2
 431     srl(G1, 0,G1);              // Clear current high G1 bits
 432     or3 (G1,G2,G1);             // Recover 64-bit G1
 433     sllx(L6,32,G2);             // Move old high G4 bits high in G2
 434     srl(G4, 0,G4);              // Clear current high G4 bits


 513   STOP("Stack Not Biased in set_last_Java_frame");
 514   bind(StackOk);
 515 #endif // ASSERT
 516   assert( last_java_sp != G4_scratch, "bad register usage in set_last_Java_frame");
 517   add( last_java_sp, STACK_BIAS, G4_scratch );
 518   st_ptr(G4_scratch, G2_thread, JavaThread::last_Java_sp_offset());
 519 #else
 520   st_ptr(last_java_sp, G2_thread, JavaThread::last_Java_sp_offset());
 521 #endif // _LP64
 522 }
 523 
 524 void MacroAssembler::reset_last_Java_frame(void) {
 525   assert_not_delayed();
 526 
 527   Address sp_addr(G2_thread, JavaThread::last_Java_sp_offset());
 528   Address pc_addr(G2_thread, JavaThread::frame_anchor_offset() + JavaFrameAnchor::last_Java_pc_offset());
 529   Address flags  (G2_thread, JavaThread::frame_anchor_offset() + JavaFrameAnchor::flags_offset());
 530 
 531 #ifdef ASSERT
 532   // check that it WAS previously set
 533 #ifdef CC_INTERP
 534     save_frame(0);
 535 #else
 536     save_frame_and_mov(0, Lmethod, Lmethod);     // Propagate Lmethod to helper frame for -Xprof
 537 #endif /* CC_INTERP */
 538     ld_ptr(sp_addr, L0);
 539     tst(L0);
 540     breakpoint_trap(Assembler::zero, Assembler::ptr_cc);
 541     restore();
 542 #endif // ASSERT
 543 
 544   st_ptr(G0, sp_addr);
 545   // Always return last_Java_pc to zero
 546   st_ptr(G0, pc_addr);
 547   // Always null flags after return to Java
 548   st(G0, flags);
 549 }
 550 
 551 
 552 void MacroAssembler::call_VM_base(
 553   Register        oop_result,
 554   Register        thread_cache,
 555   Register        last_java_sp,
 556   address         entry_point,
 557   int             number_of_arguments,


 737 }
 738 
 739 
 740 void MacroAssembler::get_vm_result_2(Register metadata_result) {
 741   verify_thread();
 742   Address vm_result_addr_2(G2_thread, JavaThread::vm_result_2_offset());
 743   ld_ptr(vm_result_addr_2, metadata_result);
 744   st_ptr(G0, vm_result_addr_2);
 745 }
 746 
 747 
 748 // We require that C code which does not return a value in vm_result will
 749 // leave it undisturbed.
 750 void MacroAssembler::set_vm_result(Register oop_result) {
 751   verify_thread();
 752   Address vm_result_addr(G2_thread, JavaThread::vm_result_offset());
 753   verify_oop(oop_result);
 754 
 755 # ifdef ASSERT
 756     // Check that we are not overwriting any other oop.
 757 #ifdef CC_INTERP
 758     save_frame(0);
 759 #else
 760     save_frame_and_mov(0, Lmethod, Lmethod);     // Propagate Lmethod for -Xprof
 761 #endif /* CC_INTERP */
 762     ld_ptr(vm_result_addr, L0);
 763     tst(L0);
 764     restore();
 765     breakpoint_trap(notZero, Assembler::ptr_cc);
 766     // }
 767 # endif
 768 
 769   st_ptr(oop_result, vm_result_addr);
 770 }
 771 
 772 
 773 void MacroAssembler::ic_call(address entry, bool emit_delay) {
 774   RelocationHolder rspec = virtual_call_Relocation::spec(pc());
 775   patchable_set((intptr_t)Universe::non_oop_word(), G5_inline_cache_reg);
 776   relocate(rspec);
 777   call(entry, relocInfo::none);
 778   if (emit_delay) {
 779     delayed()->nop();
 780   }
 781 }




 384   inc(L4, 3 * BytesPerInstWord); // skip rdpc + inc + st_ptr to point L4 at call  st_ptr(L4, L3, 0);
 385 #endif
 386   call(CAST_FROM_FN_PTR(address, reinitialize_thread), relocInfo::runtime_call_type);
 387   delayed()->nop();
 388   mov(L0, G1);
 389   mov(L1, G5_method);
 390   mov(L2, G3);
 391   mov(L5, G4);
 392   restore(O0, 0, G2_thread);
 393 }
 394 
 395 static Thread* verify_thread_subroutine(Thread* gthread_value) {
 396   Thread* correct_value = Thread::current();
 397   guarantee(gthread_value == correct_value, "G2_thread value must be the thread");
 398   return correct_value;
 399 }
 400 
 401 void MacroAssembler::verify_thread() {
 402   if (VerifyThread) {
 403     // NOTE: this chops off the heads of the 64-bit O registers.



 404     // make sure G2_thread contains the right value
 405     save_frame_and_mov(0, Lmethod, Lmethod);   // to avoid clobbering O0 (and propagate Lmethod for -Xprof)
 406     mov(G1, L1);                // avoid clobbering G1
 407     // G2 saved below
 408     mov(G3, L3);                // avoid clobbering G3
 409     mov(G4, L4);                // avoid clobbering G4
 410     mov(G5_method, L5);         // avoid clobbering G5_method

 411 #if defined(COMPILER2) && !defined(_LP64)
 412     // Save & restore possible 64-bit Long arguments in G-regs
 413     srlx(G1,32,L0);
 414     srlx(G4,32,L6);
 415 #endif
 416     call(CAST_FROM_FN_PTR(address,verify_thread_subroutine), relocInfo::runtime_call_type);
 417     delayed()->mov(G2_thread, O0);
 418 
 419     mov(L1, G1);                // Restore G1
 420     // G2 restored below
 421     mov(L3, G3);                // restore G3
 422     mov(L4, G4);                // restore G4
 423     mov(L5, G5_method);         // restore G5_method
 424 #if defined(COMPILER2) && !defined(_LP64)
 425     // Save & restore possible 64-bit Long arguments in G-regs
 426     sllx(L0,32,G2);             // Move old high G1 bits high in G2
 427     srl(G1, 0,G1);              // Clear current high G1 bits
 428     or3 (G1,G2,G1);             // Recover 64-bit G1
 429     sllx(L6,32,G2);             // Move old high G4 bits high in G2
 430     srl(G4, 0,G4);              // Clear current high G4 bits


 509   STOP("Stack Not Biased in set_last_Java_frame");
 510   bind(StackOk);
 511 #endif // ASSERT
 512   assert( last_java_sp != G4_scratch, "bad register usage in set_last_Java_frame");
 513   add( last_java_sp, STACK_BIAS, G4_scratch );
 514   st_ptr(G4_scratch, G2_thread, JavaThread::last_Java_sp_offset());
 515 #else
 516   st_ptr(last_java_sp, G2_thread, JavaThread::last_Java_sp_offset());
 517 #endif // _LP64
 518 }
 519 
 520 void MacroAssembler::reset_last_Java_frame(void) {
 521   assert_not_delayed();
 522 
 523   Address sp_addr(G2_thread, JavaThread::last_Java_sp_offset());
 524   Address pc_addr(G2_thread, JavaThread::frame_anchor_offset() + JavaFrameAnchor::last_Java_pc_offset());
 525   Address flags  (G2_thread, JavaThread::frame_anchor_offset() + JavaFrameAnchor::flags_offset());
 526 
 527 #ifdef ASSERT
 528   // check that it WAS previously set



 529     save_frame_and_mov(0, Lmethod, Lmethod);     // Propagate Lmethod to helper frame for -Xprof

 530     ld_ptr(sp_addr, L0);
 531     tst(L0);
 532     breakpoint_trap(Assembler::zero, Assembler::ptr_cc);
 533     restore();
 534 #endif // ASSERT
 535 
 536   st_ptr(G0, sp_addr);
 537   // Always return last_Java_pc to zero
 538   st_ptr(G0, pc_addr);
 539   // Always null flags after return to Java
 540   st(G0, flags);
 541 }
 542 
 543 
 544 void MacroAssembler::call_VM_base(
 545   Register        oop_result,
 546   Register        thread_cache,
 547   Register        last_java_sp,
 548   address         entry_point,
 549   int             number_of_arguments,


 729 }
 730 
 731 
 732 void MacroAssembler::get_vm_result_2(Register metadata_result) {
 733   verify_thread();
 734   Address vm_result_addr_2(G2_thread, JavaThread::vm_result_2_offset());
 735   ld_ptr(vm_result_addr_2, metadata_result);
 736   st_ptr(G0, vm_result_addr_2);
 737 }
 738 
 739 
 740 // We require that C code which does not return a value in vm_result will
 741 // leave it undisturbed.
 742 void MacroAssembler::set_vm_result(Register oop_result) {
 743   verify_thread();
 744   Address vm_result_addr(G2_thread, JavaThread::vm_result_offset());
 745   verify_oop(oop_result);
 746 
 747 # ifdef ASSERT
 748     // Check that we are not overwriting any other oop.



 749     save_frame_and_mov(0, Lmethod, Lmethod);     // Propagate Lmethod for -Xprof

 750     ld_ptr(vm_result_addr, L0);
 751     tst(L0);
 752     restore();
 753     breakpoint_trap(notZero, Assembler::ptr_cc);
 754     // }
 755 # endif
 756 
 757   st_ptr(oop_result, vm_result_addr);
 758 }
 759 
 760 
 761 void MacroAssembler::ic_call(address entry, bool emit_delay) {
 762   RelocationHolder rspec = virtual_call_Relocation::spec(pc());
 763   patchable_set((intptr_t)Universe::non_oop_word(), G5_inline_cache_reg);
 764   relocate(rspec);
 765   call(entry, relocInfo::none);
 766   if (emit_delay) {
 767     delayed()->nop();
 768   }
 769 }


src/cpu/sparc/vm/macroAssembler_sparc.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File