859 // careful, because some VM calls (such as call site linkage) can
860 // use several kilobytes of stack. But the stack safety zone should
861 // account for that. See bugs 4446381, 4468289, 4497237.
862 if (C->need_stack_bang(bangsize) && UseStackBanging) {
863 __ generate_stack_overflow_check(bangsize);
864 }
865
866 assert(Immediate::is_uimm32((long)framesize), "to do: choose suitable types!");
867 __ save_return_pc();
868
869 // The z/Architecture abi is already accounted for in `framesize' via the
870 // 'out_preserve_stack_slots' declaration.
871 __ push_frame((unsigned int)framesize/*includes JIT ABI*/);
872
873 if (C->has_mach_constant_base_node()) {
874 // NOTE: We set the table base offset here because users might be
875 // emitted before MachConstantBaseNode.
876 Compile::ConstantTable& constant_table = C->constant_table();
877 constant_table.set_table_base_offset(constant_table.calculate_table_base_offset());
878 }
879 }
880
881 uint MachPrologNode::size(PhaseRegAlloc *ra_) const {
882 // Variable size. Determine dynamically.
883 return MachNode::size(ra_);
884 }
885
886 int MachPrologNode::reloc() const {
887 // Return number of relocatable values contained in this instruction.
888 return 1; // One reloc entry for load_const(toc).
889 }
890
891 //=============================================================================
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 int frame_size_in_bytes = Assembler::align((C->frame_slots() << LogBytesPerInt), frame::alignment_in_bytes);
914 __ pop_frame_restore_retPC(frame_size_in_bytes);
915
916 if (StackReservedPages > 0 && C->has_reserved_stack_access()) {
917 __ reserved_stack_check(Z_R14);
918 }
919
920 // Touch the polling page.
921 if (need_polling) {
922 if (SafepointMechanism::uses_thread_local_poll()) {
923 __ z_lg(Z_R1_scratch, Address(Z_thread, Thread::polling_page_offset()));
924 } else {
925 AddressLiteral pp(os::get_polling_page());
926 __ load_const_optimized(Z_R1_scratch, pp);
|
859 // careful, because some VM calls (such as call site linkage) can
860 // use several kilobytes of stack. But the stack safety zone should
861 // account for that. See bugs 4446381, 4468289, 4497237.
862 if (C->need_stack_bang(bangsize) && UseStackBanging) {
863 __ generate_stack_overflow_check(bangsize);
864 }
865
866 assert(Immediate::is_uimm32((long)framesize), "to do: choose suitable types!");
867 __ save_return_pc();
868
869 // The z/Architecture abi is already accounted for in `framesize' via the
870 // 'out_preserve_stack_slots' declaration.
871 __ push_frame((unsigned int)framesize/*includes JIT ABI*/);
872
873 if (C->has_mach_constant_base_node()) {
874 // NOTE: We set the table base offset here because users might be
875 // emitted before MachConstantBaseNode.
876 Compile::ConstantTable& constant_table = C->constant_table();
877 constant_table.set_table_base_offset(constant_table.calculate_table_base_offset());
878 }
879
880 #ifndef PRODUCT
881 ciMethod *currMethod = C->method();
882 if (currMethod && currMethod->has_option("crashOnEntry")) {
883 __ z_illtrap();
884 }
885 #endif
886 }
887
888 uint MachPrologNode::size(PhaseRegAlloc *ra_) const {
889 // Variable size. Determine dynamically.
890 return MachNode::size(ra_);
891 }
892
893 int MachPrologNode::reloc() const {
894 // Return number of relocatable values contained in this instruction.
895 return 1; // One reloc entry for load_const(toc).
896 }
897
898 //=============================================================================
899
900 #if !defined(PRODUCT)
901 void MachEpilogNode::format(PhaseRegAlloc *ra_, outputStream *os) const {
902 os->print_cr("epilog");
903 os->print("\t");
904 if (do_polling() && ra_->C->is_method_compilation()) {
905 os->print_cr("load_from_polling_page Z_R1_scratch");
906 os->print("\t");
907 }
908 }
909 #endif
910
911 void MachEpilogNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
912 MacroAssembler _masm(&cbuf);
913 Compile* C = ra_->C;
914
915 #ifndef PRODUCT
916 ciMethod *currMethod = C->method();
917 if (currMethod && currMethod->has_option("crashOnExit")) {
918 __ z_illtrap();
919 }
920 #endif
921
922 __ verify_thread();
923
924 // If this does safepoint polling, then do it here.
925 bool need_polling = do_polling() && C->is_method_compilation();
926
927 // Pop frame, restore return_pc, and all stuff needed by interpreter.
928 int frame_size_in_bytes = Assembler::align((C->frame_slots() << LogBytesPerInt), frame::alignment_in_bytes);
929 __ pop_frame_restore_retPC(frame_size_in_bytes);
930
931 if (StackReservedPages > 0 && C->has_reserved_stack_access()) {
932 __ reserved_stack_check(Z_R14);
933 }
934
935 // Touch the polling page.
936 if (need_polling) {
937 if (SafepointMechanism::uses_thread_local_poll()) {
938 __ z_lg(Z_R1_scratch, Address(Z_thread, Thread::polling_page_offset()));
939 } else {
940 AddressLiteral pp(os::get_polling_page());
941 __ load_const_optimized(Z_R1_scratch, pp);
|