654 // synchronize method 655 const Address access_flags(rbx, Method::access_flags_offset()); 656 const Address monitor_block_top( 657 rbp, 658 frame::interpreter_frame_monitor_block_top_offset * wordSize); 659 const int entry_size = frame::interpreter_frame_monitor_size() * wordSize; 660 661 #ifdef ASSERT 662 { 663 Label L; 664 __ movl(rax, access_flags); 665 __ testl(rax, JVM_ACC_SYNCHRONIZED); 666 __ jcc(Assembler::notZero, L); 667 __ stop("method doesn't need synchronization"); 668 __ bind(L); 669 } 670 #endif // ASSERT 671 672 // get synchronization object 673 { 674 Label done; 675 __ movl(rax, access_flags); 676 __ testl(rax, JVM_ACC_STATIC); 677 // get receiver (assume this is frequent case) 678 __ movptr(rax, Address(rlocals, Interpreter::local_offset_in_bytes(0))); 679 __ jcc(Assembler::zero, done); 680 __ load_mirror(rax, rbx); 681 682 #ifdef ASSERT 683 { 684 Label L; 685 __ testptr(rax, rax); 686 __ jcc(Assembler::notZero, L); 687 __ stop("synchronization object is NULL"); 688 __ bind(L); 689 } 690 #endif // ASSERT 691 692 __ bind(done); 693 } 694 695 // add space for monitor & lock 696 __ subptr(rsp, entry_size); // add space for a monitor entry 697 __ movptr(monitor_block_top, rsp); // set new monitor block top 698 // store object 699 __ movptr(Address(rsp, BasicObjectLock::obj_offset_in_bytes()), rax); 700 const Register lockreg = NOT_LP64(rdx) LP64_ONLY(c_rarg1); 701 __ movptr(lockreg, rsp); // object address 702 __ lock_object(lockreg); 703 } 704 705 // Generate a fixed interpreter frame. This is identical setup for 706 // interpreted methods and for native methods hence the shared code. 707 // 708 // Args: 709 // rax: return address 710 // rbx: Method* 711 // r14/rdi: pointer to locals | 654 // synchronize method 655 const Address access_flags(rbx, Method::access_flags_offset()); 656 const Address monitor_block_top( 657 rbp, 658 frame::interpreter_frame_monitor_block_top_offset * wordSize); 659 const int entry_size = frame::interpreter_frame_monitor_size() * wordSize; 660 661 #ifdef ASSERT 662 { 663 Label L; 664 __ movl(rax, access_flags); 665 __ testl(rax, JVM_ACC_SYNCHRONIZED); 666 __ jcc(Assembler::notZero, L); 667 __ stop("method doesn't need synchronization"); 668 __ bind(L); 669 } 670 #endif // ASSERT 671 672 // get synchronization object 673 { 674 Label check_value_recv, done; 675 __ movl(rax, access_flags); 676 __ testl(rax, JVM_ACC_STATIC); 677 // get receiver (assume this is frequent case) 678 __ movptr(rax, Address(rlocals, Interpreter::local_offset_in_bytes(0))); 679 __ jcc(Assembler::zero, (EnableValhalla) ? check_value_recv : done); 680 __ load_mirror(rax, rbx); 681 682 #ifdef ASSERT 683 { 684 Label L; 685 __ testptr(rax, rax); 686 __ jcc(Assembler::notZero, L); 687 __ stop("synchronization object is NULL"); 688 __ bind(L); 689 } 690 #endif // ASSERT 691 __ jmp(done); 692 if (EnableValhalla) { 693 __ bind(check_value_recv); 694 __ test_oop_is_not_value(rax, rbx, done); 695 __ call_VM(noreg, CAST_FROM_FN_PTR(address, 696 InterpreterRuntime::throw_illegal_monitor_state_exception)); 697 __ should_not_reach_here(); 698 } 699 __ bind(done); 700 } 701 702 // add space for monitor & lock 703 __ subptr(rsp, entry_size); // add space for a monitor entry 704 __ movptr(monitor_block_top, rsp); // set new monitor block top 705 // store object 706 __ movptr(Address(rsp, BasicObjectLock::obj_offset_in_bytes()), rax); 707 const Register lockreg = NOT_LP64(rdx) LP64_ONLY(c_rarg1); 708 __ movptr(lockreg, rsp); // object address 709 __ lock_object(lockreg); 710 } 711 712 // Generate a fixed interpreter frame. This is identical setup for 713 // interpreted methods and for native methods hence the shared code. 714 // 715 // Args: 716 // rax: return address 717 // rbx: Method* 718 // r14/rdi: pointer to locals |