< prev index next >

src/hotspot/cpu/x86/x86_64.ad

Print this page




 881     }
 882   }
 883 
 884   if (VerifyStackAtCalls) {
 885     st->print("\n\t");
 886     framesize -= wordSize;
 887     st->print("movq    [rsp + #%d], 0xbadb100d\t# Majik cookie for stack depth check",framesize);
 888 #ifdef ASSERT
 889     st->print("\n\t");
 890     st->print("# stack alignment check");
 891 #endif
 892   }
 893   st->cr();
 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


 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);
 991       emit_d8(cbuf, framesize);
 992     } else {
 993       emit_opcode(cbuf, 0x81); // addq rsp, #framesize
 994       emit_rm(cbuf, 0x3, 0x00, RSP_enc);
 995       emit_d32(cbuf, framesize);
 996     }
 997   }
 998 
 999   // popq rbp
1000   emit_opcode(cbuf, 0x58 | RBP_enc);
1001 
1002   if (StackReservedPages > 0 && C->has_reserved_stack_access()) {
1003     __ reserved_stack_check();
1004   }
1005 
1006   if (do_polling() && C->is_method_compilation()) {
1007     MacroAssembler _masm(&cbuf);
1008     if (SafepointMechanism::uses_thread_local_poll()) {
1009       __ movq(rscratch1, Address(r15_thread, Thread::polling_page_offset()));
1010       __ relocate(relocInfo::poll_return_type);
1011       __ testl(rax, Address(rscratch1, 0));
1012     } else {
1013       AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_return_type);
1014       if (Assembler::is_polling_page_far()) {
1015         __ lea(rscratch1, polling_page);
1016         __ relocate(relocInfo::poll_return_type);
1017         __ testl(rax, Address(rscratch1, 0));
1018       } else {
1019         __ testl(rax, polling_page);
1020       }


1549   int reg = ra_->get_encode(this);
1550   if (offset >= 0x80) {
1551     emit_opcode(cbuf, reg < 8 ? Assembler::REX_W : Assembler::REX_WR);
1552     emit_opcode(cbuf, 0x8D); // LEA  reg,[SP+offset]
1553     emit_rm(cbuf, 0x2, reg & 7, 0x04);
1554     emit_rm(cbuf, 0x0, 0x04, RSP_enc);
1555     emit_d32(cbuf, offset);
1556   } else {
1557     emit_opcode(cbuf, reg < 8 ? Assembler::REX_W : Assembler::REX_WR);
1558     emit_opcode(cbuf, 0x8D); // LEA  reg,[SP+offset]
1559     emit_rm(cbuf, 0x1, reg & 7, 0x04);
1560     emit_rm(cbuf, 0x0, 0x04, RSP_enc);
1561     emit_d8(cbuf, offset);
1562   }
1563 }
1564 
1565 uint BoxLockNode::size(PhaseRegAlloc *ra_) const
1566 {
1567   int offset = ra_->reg2offset(in_RegMask(0).find_first_elem());
1568   return (offset < 0x80) ? 5 : 8; // REX






















1569 }
1570 
1571 //=============================================================================
1572 #ifndef PRODUCT
1573 void MachUEPNode::format(PhaseRegAlloc* ra_, outputStream* st) const
1574 {
1575   if (UseCompressedClassPointers) {
1576     st->print_cr("movl    rscratch1, [j_rarg0 + oopDesc::klass_offset_in_bytes()]\t# compressed klass");
1577     st->print_cr("\tdecode_klass_not_null rscratch1, rscratch1");
1578     st->print_cr("\tcmpq    rax, rscratch1\t # Inline cache check");
1579   } else {
1580     st->print_cr("\tcmpq    rax, [j_rarg0 + oopDesc::klass_offset_in_bytes()]\t"
1581                  "# Inline cache check");
1582   }
1583   st->print_cr("\tjne     SharedRuntime::_ic_miss_stub");
1584   st->print_cr("\tnop\t# nops to align entry point");
1585 }
1586 #endif
1587 
1588 void MachUEPNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const




 881     }
 882   }
 883 
 884   if (VerifyStackAtCalls) {
 885     st->print("\n\t");
 886     framesize -= wordSize;
 887     st->print("movq    [rsp + #%d], 0xbadb100d\t# Majik cookie for stack depth check",framesize);
 888 #ifdef ASSERT
 889     st->print("\n\t");
 890     st->print("# stack alignment check");
 891 #endif
 892   }
 893   st->cr();
 894 }
 895 #endif
 896 
 897 void MachPrologNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
 898   Compile* C = ra_->C;
 899   MacroAssembler _masm(&cbuf);
 900 
 901   __ verified_entry(C);
 902   __ bind(*_verified_entry);


 903 
 904   C->set_frame_complete(cbuf.insts_size());
 905 
 906   if (C->has_mach_constant_base_node()) {
 907     // NOTE: We set the table base offset here because users might be
 908     // emitted before MachConstantBaseNode.
 909     Compile::ConstantTable& constant_table = C->constant_table();
 910     constant_table.set_table_base_offset(constant_table.calculate_table_base_offset());
 911   }
 912 }
 913 
 914 uint MachPrologNode::size(PhaseRegAlloc* ra_) const
 915 {
 916   return MachNode::size(ra_); // too many variables; just compute it
 917                               // the hard way
 918 }
 919 
 920 int MachPrologNode::reloc() const
 921 {
 922   return 0; // a large enough number


 956                    "# Safepoint: poll for GC");
 957     } else {
 958       st->print_cr("testl  rax, [rip + #offset_to_poll_page]\t"
 959                    "# Safepoint: poll for GC");
 960     }
 961   }
 962 }
 963 #endif
 964 
 965 void MachEpilogNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const
 966 {
 967   Compile* C = ra_->C;
 968   MacroAssembler _masm(&cbuf);
 969 
 970   if (generate_vzeroupper(C)) {
 971     // Clear upper bits of YMM registers when current compiled code uses
 972     // wide vectors to avoid AVX <-> SSE transition penalty during call.
 973     __ vzeroupper();
 974   }
 975 
 976   __ restore_stack(C);



















 977 


 978 
 979   if (StackReservedPages > 0 && C->has_reserved_stack_access()) {
 980     __ reserved_stack_check();
 981   }
 982 
 983   if (do_polling() && C->is_method_compilation()) {
 984     MacroAssembler _masm(&cbuf);
 985     if (SafepointMechanism::uses_thread_local_poll()) {
 986       __ movq(rscratch1, Address(r15_thread, Thread::polling_page_offset()));
 987       __ relocate(relocInfo::poll_return_type);
 988       __ testl(rax, Address(rscratch1, 0));
 989     } else {
 990       AddressLiteral polling_page(os::get_polling_page(), relocInfo::poll_return_type);
 991       if (Assembler::is_polling_page_far()) {
 992         __ lea(rscratch1, polling_page);
 993         __ relocate(relocInfo::poll_return_type);
 994         __ testl(rax, Address(rscratch1, 0));
 995       } else {
 996         __ testl(rax, polling_page);
 997       }


1526   int reg = ra_->get_encode(this);
1527   if (offset >= 0x80) {
1528     emit_opcode(cbuf, reg < 8 ? Assembler::REX_W : Assembler::REX_WR);
1529     emit_opcode(cbuf, 0x8D); // LEA  reg,[SP+offset]
1530     emit_rm(cbuf, 0x2, reg & 7, 0x04);
1531     emit_rm(cbuf, 0x0, 0x04, RSP_enc);
1532     emit_d32(cbuf, offset);
1533   } else {
1534     emit_opcode(cbuf, reg < 8 ? Assembler::REX_W : Assembler::REX_WR);
1535     emit_opcode(cbuf, 0x8D); // LEA  reg,[SP+offset]
1536     emit_rm(cbuf, 0x1, reg & 7, 0x04);
1537     emit_rm(cbuf, 0x0, 0x04, RSP_enc);
1538     emit_d8(cbuf, offset);
1539   }
1540 }
1541 
1542 uint BoxLockNode::size(PhaseRegAlloc *ra_) const
1543 {
1544   int offset = ra_->reg2offset(in_RegMask(0).find_first_elem());
1545   return (offset < 0x80) ? 5 : 8; // REX
1546 }
1547 
1548 //=============================================================================
1549 #ifndef PRODUCT
1550 void MachVVEPNode::format(PhaseRegAlloc* ra_, outputStream* st) const
1551 {
1552   st->print_cr("MachVVEPNode");
1553 }
1554 #endif
1555 
1556 void MachVVEPNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const
1557 {
1558   // Unpack all value type args passed as oop and then jump to
1559   // the verified entry point (skipping the unverified entry).
1560   MacroAssembler masm(&cbuf);
1561   masm.unpack_value_args(ra_->C);
1562   masm.jmp(*_verified_entry);
1563 }
1564 
1565 uint MachVVEPNode::size(PhaseRegAlloc* ra_) const
1566 {
1567   return MachNode::size(ra_); // too many variables; just compute it the hard way
1568 }
1569 
1570 //=============================================================================
1571 #ifndef PRODUCT
1572 void MachUEPNode::format(PhaseRegAlloc* ra_, outputStream* st) const
1573 {
1574   if (UseCompressedClassPointers) {
1575     st->print_cr("movl    rscratch1, [j_rarg0 + oopDesc::klass_offset_in_bytes()]\t# compressed klass");
1576     st->print_cr("\tdecode_klass_not_null rscratch1, rscratch1");
1577     st->print_cr("\tcmpq    rax, rscratch1\t # Inline cache check");
1578   } else {
1579     st->print_cr("\tcmpq    rax, [j_rarg0 + oopDesc::klass_offset_in_bytes()]\t"
1580                  "# Inline cache check");
1581   }
1582   st->print_cr("\tjne     SharedRuntime::_ic_miss_stub");
1583   st->print_cr("\tnop\t# nops to align entry point");
1584 }
1585 #endif
1586 
1587 void MachUEPNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const


< prev index next >