< prev index next >

src/cpu/s390/vm/s390.ad

Print this page
rev 12487 : 8172049: [s390] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
Reviewed-by: mdoerr


 892 
 893 #if !defined(PRODUCT)
 894 void MachEpilogNode::format(PhaseRegAlloc *ra_, outputStream *os) const {
 895   os->print_cr("epilog");
 896   os->print("\t");
 897   if (do_polling() && ra_->C->is_method_compilation()) {
 898     os->print_cr("load_from_polling_page Z_R1_scratch");
 899     os->print("\t");
 900   }
 901 }
 902 #endif
 903 
 904 void MachEpilogNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
 905   MacroAssembler _masm(&cbuf);
 906   Compile* C = ra_->C;
 907   __ verify_thread();
 908 
 909   // If this does safepoint polling, then do it here.
 910   bool need_polling = do_polling() && C->is_method_compilation();
 911 
 912   // Touch the polling page.
 913   // Part 1: get the page's address.
 914   if (need_polling) {
 915     AddressLiteral pp(os::get_polling_page());
 916     __ load_const_optimized(Z_R1_scratch, pp);
 917   }
 918 
 919   // Pop frame, restore return_pc, and all stuff needed by interpreter.
 920   // Pop frame by add insted of load (a penny saved is a penny got :-).
 921   int frame_size_in_bytes = Assembler::align((C->frame_slots() << LogBytesPerInt), frame::alignment_in_bytes);
 922   int retPC_offset        = frame_size_in_bytes + _z_abi16(return_pc);
 923   if (Displacement::is_validDisp(retPC_offset)) {
 924     __ z_lg(Z_R14, retPC_offset, Z_SP);
 925     __ add2reg(Z_SP, frame_size_in_bytes);
 926   } else {
 927     __ add2reg(Z_SP, frame_size_in_bytes);
 928     __ restore_return_pc();
 929   }
 930 
 931   // Touch the polling page,
 932   // part 2: touch the page now.



 933   if (need_polling) {


 934     // We need to mark the code position where the load from the safepoint
 935     // polling page was emitted as relocInfo::poll_return_type here.
 936     __ relocate(relocInfo::poll_return_type);
 937     __ load_from_polling_page(Z_R1_scratch);
 938   }
 939 }
 940 
 941 uint MachEpilogNode::size(PhaseRegAlloc *ra_) const {
 942   // variable size. determine dynamically.
 943   return MachNode::size(ra_);
 944 }
 945 
 946 int MachEpilogNode::reloc() const {
 947   // Return number of relocatable values contained in this instruction.
 948   return 1; // One for load_from_polling_page.
 949 }
 950 
 951 const Pipeline * MachEpilogNode::pipeline() const {
 952   return MachNode::pipeline_class();
 953 }
 954 
 955 int MachEpilogNode::safepoint_offset() const {
 956   assert(do_polling(), "no return for this epilog node");
 957   return 0;
 958 }
 959 
 960 //=============================================================================
 961 
 962 // Figure out which register class each belongs in: rc_int, rc_float, rc_stack.




 892 
 893 #if !defined(PRODUCT)
 894 void MachEpilogNode::format(PhaseRegAlloc *ra_, outputStream *os) const {
 895   os->print_cr("epilog");
 896   os->print("\t");
 897   if (do_polling() && ra_->C->is_method_compilation()) {
 898     os->print_cr("load_from_polling_page Z_R1_scratch");
 899     os->print("\t");
 900   }
 901 }
 902 #endif
 903 
 904 void MachEpilogNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
 905   MacroAssembler _masm(&cbuf);
 906   Compile* C = ra_->C;
 907   __ verify_thread();
 908 
 909   // If this does safepoint polling, then do it here.
 910   bool need_polling = do_polling() && C->is_method_compilation();
 911 







 912   // Pop frame, restore return_pc, and all stuff needed by interpreter.
 913   // Pop frame by add instead of load (a penny saved is a penny got :-).
 914   int frame_size_in_bytes = Assembler::align((C->frame_slots() << LogBytesPerInt), frame::alignment_in_bytes);
 915   int retPC_offset        = frame_size_in_bytes + _z_abi16(return_pc);
 916   if (Displacement::is_validDisp(retPC_offset)) {
 917     __ z_lg(Z_R14, retPC_offset, Z_SP);
 918     __ add2reg(Z_SP, frame_size_in_bytes);
 919   } else {
 920     __ add2reg(Z_SP, frame_size_in_bytes);
 921     __ restore_return_pc();
 922   }
 923 
 924   if (StackReservedPages > 0 && C->has_reserved_stack_access()) {
 925     __ reserved_stack_check(Z_R14);
 926   }
 927 
 928   // Touch the polling page.
 929   if (need_polling) {
 930     AddressLiteral pp(os::get_polling_page());
 931     __ load_const_optimized(Z_R1_scratch, pp);
 932     // We need to mark the code position where the load from the safepoint
 933     // polling page was emitted as relocInfo::poll_return_type here.
 934     __ relocate(relocInfo::poll_return_type);
 935     __ load_from_polling_page(Z_R1_scratch);
 936   }
 937 }
 938 
 939 uint MachEpilogNode::size(PhaseRegAlloc *ra_) const {
 940   // Variable size. determine dynamically.
 941   return MachNode::size(ra_);
 942 }
 943 
 944 int MachEpilogNode::reloc() const {
 945   // Return number of relocatable values contained in this instruction.
 946   return 1; // One for load_from_polling_page.
 947 }
 948 
 949 const Pipeline * MachEpilogNode::pipeline() const {
 950   return MachNode::pipeline_class();
 951 }
 952 
 953 int MachEpilogNode::safepoint_offset() const {
 954   assert(do_polling(), "no return for this epilog node");
 955   return 0;
 956 }
 957 
 958 //=============================================================================
 959 
 960 // Figure out which register class each belongs in: rc_int, rc_float, rc_stack.


< prev index next >