src/cpu/x86/vm/interp_masm_x86_32.cpp

Print this page




 809 
 810     // zero for recursive case
 811     jcc(Assembler::zero, done);
 812 
 813     // Call the runtime routine for slow case.
 814     movptr(Address(lock_reg, BasicObjectLock::obj_offset_in_bytes()), obj_reg); // restore obj
 815     call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit), lock_reg);
 816 
 817     bind(done);
 818 
 819     restore_bcp();
 820   }
 821 }
 822 
 823 
 824 #ifndef CC_INTERP
 825 
 826 // Test ImethodDataPtr.  If it is null, continue at the specified label
 827 void InterpreterMacroAssembler::test_method_data_pointer(Register mdp, Label& zero_continue) {
 828   assert(ProfileInterpreter, "must be profiling interpreter");
 829   movptr(mdp, Address(rbp, frame::interpreter_frame_mdx_offset * wordSize));
 830   testptr(mdp, mdp);
 831   jcc(Assembler::zero, zero_continue);
 832 }
 833 
 834 
 835 // Set the method data pointer for the current bcp.
 836 void InterpreterMacroAssembler::set_method_data_pointer_for_bcp() {
 837   assert(ProfileInterpreter, "must be profiling interpreter");
 838   Label set_mdp;
 839   push(rax);
 840   push(rbx);
 841 
 842   get_method(rbx);
 843   // Test MDO to avoid the call if it is NULL.
 844   movptr(rax, Address(rbx, in_bytes(Method::method_data_offset())));
 845   testptr(rax, rax);
 846   jcc(Assembler::zero, set_mdp);
 847   // rbx,: method
 848   // rsi: bcp
 849   call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::bcp_to_di), rbx, rsi);
 850   // rax,: mdi
 851   // mdo is guaranteed to be non-zero here, we checked for it before the call.
 852   movptr(rbx, Address(rbx, in_bytes(Method::method_data_offset())));
 853   addptr(rbx, in_bytes(MethodData::data_offset()));
 854   addptr(rax, rbx);
 855   bind(set_mdp);
 856   movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), rax);
 857   pop(rbx);
 858   pop(rax);
 859 }
 860 
 861 void InterpreterMacroAssembler::verify_method_data_pointer() {
 862   assert(ProfileInterpreter, "must be profiling interpreter");
 863 #ifdef ASSERT
 864   Label verify_continue;
 865   push(rax);
 866   push(rbx);
 867   push(rcx);
 868   push(rdx);
 869   test_method_data_pointer(rcx, verify_continue); // If mdp is zero, continue
 870   get_method(rbx);
 871 
 872   // If the mdp is valid, it will point to a DataLayout header which is
 873   // consistent with the bcp.  The converse is highly probable also.
 874   load_unsigned_short(rdx, Address(rcx, in_bytes(DataLayout::bci_offset())));
 875   addptr(rdx, Address(rbx, Method::const_offset()));
 876   lea(rdx, Address(rdx, ConstMethod::codes_offset()));


 958                                                  int offset,
 959                                                  Register value,
 960                                                  Register test_value_out,
 961                                                  Label& not_equal_continue) {
 962   assert(ProfileInterpreter, "must be profiling interpreter");
 963   if (test_value_out == noreg) {
 964     cmpptr(value, Address(mdp_in, offset));
 965   } else {
 966     // Put the test value into a register, so caller can use it:
 967     movptr(test_value_out, Address(mdp_in, offset));
 968     cmpptr(test_value_out, value);
 969   }
 970   jcc(Assembler::notEqual, not_equal_continue);
 971 }
 972 
 973 
 974 void InterpreterMacroAssembler::update_mdp_by_offset(Register mdp_in, int offset_of_disp) {
 975   assert(ProfileInterpreter, "must be profiling interpreter");
 976   Address disp_address(mdp_in, offset_of_disp);
 977   addptr(mdp_in,disp_address);
 978   movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp_in);
 979 }
 980 
 981 
 982 void InterpreterMacroAssembler::update_mdp_by_offset(Register mdp_in, Register reg, int offset_of_disp) {
 983   assert(ProfileInterpreter, "must be profiling interpreter");
 984   Address disp_address(mdp_in, reg, Address::times_1, offset_of_disp);
 985   addptr(mdp_in, disp_address);
 986   movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp_in);
 987 }
 988 
 989 
 990 void InterpreterMacroAssembler::update_mdp_by_constant(Register mdp_in, int constant) {
 991   assert(ProfileInterpreter, "must be profiling interpreter");
 992   addptr(mdp_in, constant);
 993   movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp_in);
 994 }
 995 
 996 
 997 void InterpreterMacroAssembler::update_mdp_for_ret(Register return_bci) {
 998   assert(ProfileInterpreter, "must be profiling interpreter");
 999   push(return_bci);             // save/restore across call_VM
1000   call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::update_mdp_for_ret), return_bci);
1001   pop(return_bci);
1002 }
1003 
1004 
1005 void InterpreterMacroAssembler::profile_taken_branch(Register mdp, Register bumped_count) {
1006   if (ProfileInterpreter) {
1007     Label profile_continue;
1008 
1009     // If no method data exists, go to profile_continue.
1010     // Otherwise, assign to mdp
1011     test_method_data_pointer(mdp, profile_continue);
1012 
1013     // We are taking a branch.  Increment the taken count.




 809 
 810     // zero for recursive case
 811     jcc(Assembler::zero, done);
 812 
 813     // Call the runtime routine for slow case.
 814     movptr(Address(lock_reg, BasicObjectLock::obj_offset_in_bytes()), obj_reg); // restore obj
 815     call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit), lock_reg);
 816 
 817     bind(done);
 818 
 819     restore_bcp();
 820   }
 821 }
 822 
 823 
 824 #ifndef CC_INTERP
 825 
 826 // Test ImethodDataPtr.  If it is null, continue at the specified label
 827 void InterpreterMacroAssembler::test_method_data_pointer(Register mdp, Label& zero_continue) {
 828   assert(ProfileInterpreter, "must be profiling interpreter");
 829   movptr(mdp, Address(rbp, frame::interpreter_frame_mdp_offset * wordSize));
 830   testptr(mdp, mdp);
 831   jcc(Assembler::zero, zero_continue);
 832 }
 833 
 834 
 835 // Set the method data pointer for the current bcp.
 836 void InterpreterMacroAssembler::set_method_data_pointer_for_bcp() {
 837   assert(ProfileInterpreter, "must be profiling interpreter");
 838   Label set_mdp;
 839   push(rax);
 840   push(rbx);
 841 
 842   get_method(rbx);
 843   // Test MDO to avoid the call if it is NULL.
 844   movptr(rax, Address(rbx, in_bytes(Method::method_data_offset())));
 845   testptr(rax, rax);
 846   jcc(Assembler::zero, set_mdp);
 847   // rbx,: method
 848   // rsi: bcp
 849   call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::bcp_to_di), rbx, rsi);
 850   // rax,: mdi
 851   // mdo is guaranteed to be non-zero here, we checked for it before the call.
 852   movptr(rbx, Address(rbx, in_bytes(Method::method_data_offset())));
 853   addptr(rbx, in_bytes(MethodData::data_offset()));
 854   addptr(rax, rbx);
 855   bind(set_mdp);
 856   movptr(Address(rbp, frame::interpreter_frame_mdp_offset * wordSize), rax);
 857   pop(rbx);
 858   pop(rax);
 859 }
 860 
 861 void InterpreterMacroAssembler::verify_method_data_pointer() {
 862   assert(ProfileInterpreter, "must be profiling interpreter");
 863 #ifdef ASSERT
 864   Label verify_continue;
 865   push(rax);
 866   push(rbx);
 867   push(rcx);
 868   push(rdx);
 869   test_method_data_pointer(rcx, verify_continue); // If mdp is zero, continue
 870   get_method(rbx);
 871 
 872   // If the mdp is valid, it will point to a DataLayout header which is
 873   // consistent with the bcp.  The converse is highly probable also.
 874   load_unsigned_short(rdx, Address(rcx, in_bytes(DataLayout::bci_offset())));
 875   addptr(rdx, Address(rbx, Method::const_offset()));
 876   lea(rdx, Address(rdx, ConstMethod::codes_offset()));


 958                                                  int offset,
 959                                                  Register value,
 960                                                  Register test_value_out,
 961                                                  Label& not_equal_continue) {
 962   assert(ProfileInterpreter, "must be profiling interpreter");
 963   if (test_value_out == noreg) {
 964     cmpptr(value, Address(mdp_in, offset));
 965   } else {
 966     // Put the test value into a register, so caller can use it:
 967     movptr(test_value_out, Address(mdp_in, offset));
 968     cmpptr(test_value_out, value);
 969   }
 970   jcc(Assembler::notEqual, not_equal_continue);
 971 }
 972 
 973 
 974 void InterpreterMacroAssembler::update_mdp_by_offset(Register mdp_in, int offset_of_disp) {
 975   assert(ProfileInterpreter, "must be profiling interpreter");
 976   Address disp_address(mdp_in, offset_of_disp);
 977   addptr(mdp_in,disp_address);
 978   movptr(Address(rbp, frame::interpreter_frame_mdp_offset * wordSize), mdp_in);
 979 }
 980 
 981 
 982 void InterpreterMacroAssembler::update_mdp_by_offset(Register mdp_in, Register reg, int offset_of_disp) {
 983   assert(ProfileInterpreter, "must be profiling interpreter");
 984   Address disp_address(mdp_in, reg, Address::times_1, offset_of_disp);
 985   addptr(mdp_in, disp_address);
 986   movptr(Address(rbp, frame::interpreter_frame_mdp_offset * wordSize), mdp_in);
 987 }
 988 
 989 
 990 void InterpreterMacroAssembler::update_mdp_by_constant(Register mdp_in, int constant) {
 991   assert(ProfileInterpreter, "must be profiling interpreter");
 992   addptr(mdp_in, constant);
 993   movptr(Address(rbp, frame::interpreter_frame_mdp_offset * wordSize), mdp_in);
 994 }
 995 
 996 
 997 void InterpreterMacroAssembler::update_mdp_for_ret(Register return_bci) {
 998   assert(ProfileInterpreter, "must be profiling interpreter");
 999   push(return_bci);             // save/restore across call_VM
1000   call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::update_mdp_for_ret), return_bci);
1001   pop(return_bci);
1002 }
1003 
1004 
1005 void InterpreterMacroAssembler::profile_taken_branch(Register mdp, Register bumped_count) {
1006   if (ProfileInterpreter) {
1007     Label profile_continue;
1008 
1009     // If no method data exists, go to profile_continue.
1010     // Otherwise, assign to mdp
1011     test_method_data_pointer(mdp, profile_continue);
1012 
1013     // We are taking a branch.  Increment the taken count.