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.
|
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 // Part 1: get the page's address.
930 if (need_polling) {
931 AddressLiteral pp(os::get_polling_page());
932 __ load_const_optimized(Z_R1_scratch, pp);
933 }
934
935 // Touch the polling page,
936 // part 2: touch the page now.
937 if (need_polling) {
938 // We need to mark the code position where the load from the safepoint
939 // polling page was emitted as relocInfo::poll_return_type here.
940 __ relocate(relocInfo::poll_return_type);
941 __ load_from_polling_page(Z_R1_scratch);
942 }
943 }
944
945 uint MachEpilogNode::size(PhaseRegAlloc *ra_) const {
946 // variable size. determine dynamically.
947 return MachNode::size(ra_);
948 }
949
950 int MachEpilogNode::reloc() const {
951 // Return number of relocatable values contained in this instruction.
952 return 1; // One for load_from_polling_page.
|