< prev index next >

src/hotspot/cpu/x86/x86_64.ad

Print this page
rev 51802 : [mq]: crash_C2_method.patch


 894 }
 895 #endif
 896 
 897 void MachPrologNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
 898   Compile* C = ra_->C;
 899   MacroAssembler _masm(&cbuf);
 900 
 901   int framesize = C->frame_size_in_bytes();
 902   int bangsize = C->bang_size_in_bytes();
 903 
 904   __ verified_entry(framesize, C->need_stack_bang(bangsize)?bangsize:0, false);
 905 
 906   C->set_frame_complete(cbuf.insts_size());
 907 
 908   if (C->has_mach_constant_base_node()) {
 909     // NOTE: We set the table base offset here because users might be
 910     // emitted before MachConstantBaseNode.
 911     Compile::ConstantTable& constant_table = C->constant_table();
 912     constant_table.set_table_base_offset(constant_table.calculate_table_base_offset());
 913   }








 914 }
 915 
 916 uint MachPrologNode::size(PhaseRegAlloc* ra_) const
 917 {
 918   return MachNode::size(ra_); // too many variables; just compute it
 919                               // the hard way
 920 }
 921 
 922 int MachPrologNode::reloc() const
 923 {
 924   return 0; // a large enough number
 925 }
 926 
 927 //=============================================================================
 928 #ifndef PRODUCT
 929 void MachEpilogNode::format(PhaseRegAlloc* ra_, outputStream* st) const
 930 {
 931   Compile* C = ra_->C;
 932   if (generate_vzeroupper(C)) {
 933     st->print("vzeroupper");


 951     if (SafepointMechanism::uses_thread_local_poll()) {
 952       st->print_cr("movq   rscratch1, poll_offset[r15_thread] #polling_page_address\n\t"
 953                    "testl  rax, [rscratch1]\t"
 954                    "# Safepoint: poll for GC");
 955     } else if (Assembler::is_polling_page_far()) {
 956       st->print_cr("movq   rscratch1, #polling_page_address\n\t"
 957                    "testl  rax, [rscratch1]\t"
 958                    "# Safepoint: poll for GC");
 959     } else {
 960       st->print_cr("testl  rax, [rip + #offset_to_poll_page]\t"
 961                    "# Safepoint: poll for GC");
 962     }
 963   }
 964 }
 965 #endif
 966 
 967 void MachEpilogNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const
 968 {
 969   Compile* C = ra_->C;
 970   MacroAssembler _masm(&cbuf);








 971 
 972   if (generate_vzeroupper(C)) {
 973     // Clear upper bits of YMM registers when current compiled code uses
 974     // wide vectors to avoid AVX <-> SSE transition penalty during call.
 975     __ vzeroupper();
 976   }
 977 
 978   int framesize = C->frame_size_in_bytes();
 979   assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned");
 980   // Remove word for return adr already pushed
 981   // and RBP
 982   framesize -= 2*wordSize;
 983 
 984   // Note that VerifyStackAtCalls' Majik cookie does not change the frame size popped here
 985 
 986   if (framesize) {
 987     emit_opcode(cbuf, Assembler::REX_W);
 988     if (framesize < 0x80) {
 989       emit_opcode(cbuf, 0x83); // addq rsp, #framesize
 990       emit_rm(cbuf, 0x3, 0x00, RSP_enc);




 894 }
 895 #endif
 896 
 897 void MachPrologNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
 898   Compile* C = ra_->C;
 899   MacroAssembler _masm(&cbuf);
 900 
 901   int framesize = C->frame_size_in_bytes();
 902   int bangsize = C->bang_size_in_bytes();
 903 
 904   __ verified_entry(framesize, C->need_stack_bang(bangsize)?bangsize:0, false);
 905 
 906   C->set_frame_complete(cbuf.insts_size());
 907 
 908   if (C->has_mach_constant_base_node()) {
 909     // NOTE: We set the table base offset here because users might be
 910     // emitted before MachConstantBaseNode.
 911     Compile::ConstantTable& constant_table = C->constant_table();
 912     constant_table.set_table_base_offset(constant_table.calculate_table_base_offset());
 913   }
 914 
 915 #ifndef PRODUCT
 916   ciMethod *currMethod = C->method();
 917   if (currMethod && currMethod->has_option("crashOnEntry")) {
 918     // aaa instruction not valid in 64-bit mode, leads to crash
 919     emit_opcode(cbuf, 0x37);
 920   }
 921 #endif 
 922 }
 923 
 924 uint MachPrologNode::size(PhaseRegAlloc* ra_) const
 925 {
 926   return MachNode::size(ra_); // too many variables; just compute it
 927                               // the hard way
 928 }
 929 
 930 int MachPrologNode::reloc() const
 931 {
 932   return 0; // a large enough number
 933 }
 934 
 935 //=============================================================================
 936 #ifndef PRODUCT
 937 void MachEpilogNode::format(PhaseRegAlloc* ra_, outputStream* st) const
 938 {
 939   Compile* C = ra_->C;
 940   if (generate_vzeroupper(C)) {
 941     st->print("vzeroupper");


 959     if (SafepointMechanism::uses_thread_local_poll()) {
 960       st->print_cr("movq   rscratch1, poll_offset[r15_thread] #polling_page_address\n\t"
 961                    "testl  rax, [rscratch1]\t"
 962                    "# Safepoint: poll for GC");
 963     } else if (Assembler::is_polling_page_far()) {
 964       st->print_cr("movq   rscratch1, #polling_page_address\n\t"
 965                    "testl  rax, [rscratch1]\t"
 966                    "# Safepoint: poll for GC");
 967     } else {
 968       st->print_cr("testl  rax, [rip + #offset_to_poll_page]\t"
 969                    "# Safepoint: poll for GC");
 970     }
 971   }
 972 }
 973 #endif
 974 
 975 void MachEpilogNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const
 976 {
 977   Compile* C = ra_->C;
 978   MacroAssembler _masm(&cbuf);
 979 
 980 #ifndef PRODUCT
 981   ciMethod *currMethod = C->method();
 982   if (currMethod && currMethod->has_option("crashOnExit")) {
 983     // aaa instruction not valid in 64-bit mode, leads to crash
 984     emit_opcode(cbuf, 0x37);
 985   }
 986 #endif
 987 
 988   if (generate_vzeroupper(C)) {
 989     // Clear upper bits of YMM registers when current compiled code uses
 990     // wide vectors to avoid AVX <-> SSE transition penalty during call.
 991     __ vzeroupper();
 992   }
 993 
 994   int framesize = C->frame_size_in_bytes();
 995   assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned");
 996   // Remove word for return adr already pushed
 997   // and RBP
 998   framesize -= 2*wordSize;
 999 
1000   // Note that VerifyStackAtCalls' Majik cookie does not change the frame size popped here
1001 
1002   if (framesize) {
1003     emit_opcode(cbuf, Assembler::REX_W);
1004     if (framesize < 0x80) {
1005       emit_opcode(cbuf, 0x83); // addq rsp, #framesize
1006       emit_rm(cbuf, 0x3, 0x00, RSP_enc);


< prev index next >