changeset 6418 | 6671edbd230e |
parent 6272 | 94a20ad0e9de |
child 6753 | 74ad1f54eab7 |
6417:82e8f98f22d8 | 6418:6671edbd230e |
---|---|
617 st->print("INT3"); |
617 st->print("INT3"); |
618 } |
618 } |
619 #endif |
619 #endif |
620 |
620 |
621 // EMIT_RM() |
621 // EMIT_RM() |
622 void emit_rm(CodeBuffer &cbuf, int f1, int f2, int f3) |
622 void emit_rm(CodeBuffer &cbuf, int f1, int f2, int f3) { |
623 { |
|
624 unsigned char c = (unsigned char) ((f1 << 6) | (f2 << 3) | f3); |
623 unsigned char c = (unsigned char) ((f1 << 6) | (f2 << 3) | f3); |
625 *(cbuf.code_end()) = c; |
624 cbuf.insts()->emit_int8(c); |
626 cbuf.set_code_end(cbuf.code_end() + 1); |
|
627 } |
625 } |
628 |
626 |
629 // EMIT_CC() |
627 // EMIT_CC() |
630 void emit_cc(CodeBuffer &cbuf, int f1, int f2) |
628 void emit_cc(CodeBuffer &cbuf, int f1, int f2) { |
631 { |
|
632 unsigned char c = (unsigned char) (f1 | f2); |
629 unsigned char c = (unsigned char) (f1 | f2); |
633 *(cbuf.code_end()) = c; |
630 cbuf.insts()->emit_int8(c); |
634 cbuf.set_code_end(cbuf.code_end() + 1); |
|
635 } |
631 } |
636 |
632 |
637 // EMIT_OPCODE() |
633 // EMIT_OPCODE() |
638 void emit_opcode(CodeBuffer &cbuf, int code) |
634 void emit_opcode(CodeBuffer &cbuf, int code) { |
639 { |
635 cbuf.insts()->emit_int8((unsigned char) code); |
640 *(cbuf.code_end()) = (unsigned char) code; |
|
641 cbuf.set_code_end(cbuf.code_end() + 1); |
|
642 } |
636 } |
643 |
637 |
644 // EMIT_OPCODE() w/ relocation information |
638 // EMIT_OPCODE() w/ relocation information |
645 void emit_opcode(CodeBuffer &cbuf, |
639 void emit_opcode(CodeBuffer &cbuf, |
646 int code, relocInfo::relocType reloc, int offset, int format) |
640 int code, relocInfo::relocType reloc, int offset, int format) |
647 { |
641 { |
648 cbuf.relocate(cbuf.inst_mark() + offset, reloc, format); |
642 cbuf.relocate(cbuf.insts_mark() + offset, reloc, format); |
649 emit_opcode(cbuf, code); |
643 emit_opcode(cbuf, code); |
650 } |
644 } |
651 |
645 |
652 // EMIT_D8() |
646 // EMIT_D8() |
653 void emit_d8(CodeBuffer &cbuf, int d8) |
647 void emit_d8(CodeBuffer &cbuf, int d8) { |
654 { |
648 cbuf.insts()->emit_int8((unsigned char) d8); |
655 *(cbuf.code_end()) = (unsigned char) d8; |
|
656 cbuf.set_code_end(cbuf.code_end() + 1); |
|
657 } |
649 } |
658 |
650 |
659 // EMIT_D16() |
651 // EMIT_D16() |
660 void emit_d16(CodeBuffer &cbuf, int d16) |
652 void emit_d16(CodeBuffer &cbuf, int d16) { |
661 { |
653 cbuf.insts()->emit_int16(d16); |
662 *((short *)(cbuf.code_end())) = d16; |
|
663 cbuf.set_code_end(cbuf.code_end() + 2); |
|
664 } |
654 } |
665 |
655 |
666 // EMIT_D32() |
656 // EMIT_D32() |
667 void emit_d32(CodeBuffer &cbuf, int d32) |
657 void emit_d32(CodeBuffer &cbuf, int d32) { |
668 { |
658 cbuf.insts()->emit_int32(d32); |
669 *((int *)(cbuf.code_end())) = d32; |
|
670 cbuf.set_code_end(cbuf.code_end() + 4); |
|
671 } |
659 } |
672 |
660 |
673 // EMIT_D64() |
661 // EMIT_D64() |
674 void emit_d64(CodeBuffer &cbuf, int64_t d64) |
662 void emit_d64(CodeBuffer &cbuf, int64_t d64) { |
675 { |
663 cbuf.insts()->emit_int64(d64); |
676 *((int64_t*) (cbuf.code_end())) = d64; |
|
677 cbuf.set_code_end(cbuf.code_end() + 8); |
|
678 } |
664 } |
679 |
665 |
680 // emit 32 bit value and construct relocation entry from relocInfo::relocType |
666 // emit 32 bit value and construct relocation entry from relocInfo::relocType |
681 void emit_d32_reloc(CodeBuffer& cbuf, |
667 void emit_d32_reloc(CodeBuffer& cbuf, |
682 int d32, |
668 int d32, |
683 relocInfo::relocType reloc, |
669 relocInfo::relocType reloc, |
684 int format) |
670 int format) |
685 { |
671 { |
686 assert(reloc != relocInfo::external_word_type, "use 2-arg emit_d32_reloc"); |
672 assert(reloc != relocInfo::external_word_type, "use 2-arg emit_d32_reloc"); |
687 cbuf.relocate(cbuf.inst_mark(), reloc, format); |
673 cbuf.relocate(cbuf.insts_mark(), reloc, format); |
688 |
674 cbuf.insts()->emit_int32(d32); |
689 *((int*) (cbuf.code_end())) = d32; |
|
690 cbuf.set_code_end(cbuf.code_end() + 4); |
|
691 } |
675 } |
692 |
676 |
693 // emit 32 bit value and construct relocation entry from RelocationHolder |
677 // emit 32 bit value and construct relocation entry from RelocationHolder |
694 void emit_d32_reloc(CodeBuffer& cbuf, |
678 void emit_d32_reloc(CodeBuffer& cbuf, int d32, RelocationHolder const& rspec, int format) { |
695 int d32, |
|
696 RelocationHolder const& rspec, |
|
697 int format) |
|
698 { |
|
699 #ifdef ASSERT |
679 #ifdef ASSERT |
700 if (rspec.reloc()->type() == relocInfo::oop_type && |
680 if (rspec.reloc()->type() == relocInfo::oop_type && |
701 d32 != 0 && d32 != (intptr_t) Universe::non_oop_word()) { |
681 d32 != 0 && d32 != (intptr_t) Universe::non_oop_word()) { |
702 assert(oop((intptr_t)d32)->is_oop() && (ScavengeRootsInCode || !oop((intptr_t)d32)->is_scavengable()), "cannot embed scavengable oops in code"); |
682 assert(oop((intptr_t)d32)->is_oop() && (ScavengeRootsInCode || !oop((intptr_t)d32)->is_scavengable()), "cannot embed scavengable oops in code"); |
703 } |
683 } |
704 #endif |
684 #endif |
705 cbuf.relocate(cbuf.inst_mark(), rspec, format); |
685 cbuf.relocate(cbuf.insts_mark(), rspec, format); |
706 |
686 cbuf.insts()->emit_int32(d32); |
707 *((int* )(cbuf.code_end())) = d32; |
|
708 cbuf.set_code_end(cbuf.code_end() + 4); |
|
709 } |
687 } |
710 |
688 |
711 void emit_d32_reloc(CodeBuffer& cbuf, address addr) { |
689 void emit_d32_reloc(CodeBuffer& cbuf, address addr) { |
712 address next_ip = cbuf.code_end() + 4; |
690 address next_ip = cbuf.insts_end() + 4; |
713 emit_d32_reloc(cbuf, (int) (addr - next_ip), |
691 emit_d32_reloc(cbuf, (int) (addr - next_ip), |
714 external_word_Relocation::spec(addr), |
692 external_word_Relocation::spec(addr), |
715 RELOC_DISP32); |
693 RELOC_DISP32); |
716 } |
694 } |
717 |
695 |
718 |
696 |
719 // emit 64 bit value and construct relocation entry from relocInfo::relocType |
697 // emit 64 bit value and construct relocation entry from relocInfo::relocType |
720 void emit_d64_reloc(CodeBuffer& cbuf, |
698 void emit_d64_reloc(CodeBuffer& cbuf, int64_t d64, relocInfo::relocType reloc, int format) { |
721 int64_t d64, |
699 cbuf.relocate(cbuf.insts_mark(), reloc, format); |
722 relocInfo::relocType reloc, |
700 cbuf.insts()->emit_int64(d64); |
723 int format) |
|
724 { |
|
725 cbuf.relocate(cbuf.inst_mark(), reloc, format); |
|
726 |
|
727 *((int64_t*) (cbuf.code_end())) = d64; |
|
728 cbuf.set_code_end(cbuf.code_end() + 8); |
|
729 } |
701 } |
730 |
702 |
731 // emit 64 bit value and construct relocation entry from RelocationHolder |
703 // emit 64 bit value and construct relocation entry from RelocationHolder |
732 void emit_d64_reloc(CodeBuffer& cbuf, |
704 void emit_d64_reloc(CodeBuffer& cbuf, int64_t d64, RelocationHolder const& rspec, int format) { |
733 int64_t d64, |
|
734 RelocationHolder const& rspec, |
|
735 int format) |
|
736 { |
|
737 #ifdef ASSERT |
705 #ifdef ASSERT |
738 if (rspec.reloc()->type() == relocInfo::oop_type && |
706 if (rspec.reloc()->type() == relocInfo::oop_type && |
739 d64 != 0 && d64 != (int64_t) Universe::non_oop_word()) { |
707 d64 != 0 && d64 != (int64_t) Universe::non_oop_word()) { |
740 assert(oop(d64)->is_oop() && (ScavengeRootsInCode || !oop(d64)->is_scavengable()), |
708 assert(oop(d64)->is_oop() && (ScavengeRootsInCode || !oop(d64)->is_scavengable()), |
741 "cannot embed scavengable oops in code"); |
709 "cannot embed scavengable oops in code"); |
742 } |
710 } |
743 #endif |
711 #endif |
744 cbuf.relocate(cbuf.inst_mark(), rspec, format); |
712 cbuf.relocate(cbuf.insts_mark(), rspec, format); |
745 |
713 cbuf.insts()->emit_int64(d64); |
746 *((int64_t*) (cbuf.code_end())) = d64; |
|
747 cbuf.set_code_end(cbuf.code_end() + 8); |
|
748 } |
714 } |
749 |
715 |
750 // Access stack slot for load or store |
716 // Access stack slot for load or store |
751 void store_to_stackslot(CodeBuffer &cbuf, int opcode, int rm_field, int disp) |
717 void store_to_stackslot(CodeBuffer &cbuf, int opcode, int rm_field, int disp) |
752 { |
718 { |
964 emit_rm(cbuf, 0x3, 0x05, RSP_enc); |
930 emit_rm(cbuf, 0x3, 0x05, RSP_enc); |
965 emit_d32(cbuf, framesize); |
931 emit_d32(cbuf, framesize); |
966 } |
932 } |
967 } |
933 } |
968 |
934 |
969 C->set_frame_complete(cbuf.code_end() - cbuf.code_begin()); |
935 C->set_frame_complete(cbuf.insts_size()); |
970 |
936 |
971 #ifdef ASSERT |
937 #ifdef ASSERT |
972 if (VerifyStackAtCalls) { |
938 if (VerifyStackAtCalls) { |
973 Label L; |
939 Label L; |
974 MacroAssembler masm(&cbuf); |
940 MacroAssembler masm(&cbuf); |
1048 emit_opcode(cbuf, 0x58 | RBP_enc); |
1014 emit_opcode(cbuf, 0x58 | RBP_enc); |
1049 |
1015 |
1050 if (do_polling() && C->is_method_compilation()) { |
1016 if (do_polling() && C->is_method_compilation()) { |
1051 // testl %rax, off(%rip) // Opcode + ModRM + Disp32 == 6 bytes |
1017 // testl %rax, off(%rip) // Opcode + ModRM + Disp32 == 6 bytes |
1052 // XXX reg_mem doesn't support RIP-relative addressing yet |
1018 // XXX reg_mem doesn't support RIP-relative addressing yet |
1053 cbuf.set_inst_mark(); |
1019 cbuf.set_insts_mark(); |
1054 cbuf.relocate(cbuf.inst_mark(), relocInfo::poll_return_type, 0); // XXX |
1020 cbuf.relocate(cbuf.insts_mark(), relocInfo::poll_return_type, 0); // XXX |
1055 emit_opcode(cbuf, 0x85); // testl |
1021 emit_opcode(cbuf, 0x85); // testl |
1056 emit_rm(cbuf, 0x0, RAX_enc, 0x5); // 00 rax 101 == 0x5 |
1022 emit_rm(cbuf, 0x0, RAX_enc, 0x5); // 00 rax 101 == 0x5 |
1057 // cbuf.inst_mark() is beginning of instruction |
1023 // cbuf.insts_mark() is beginning of instruction |
1058 emit_d32_reloc(cbuf, os::get_polling_page()); |
1024 emit_d32_reloc(cbuf, os::get_polling_page()); |
1059 // relocInfo::poll_return_type, |
1025 // relocInfo::poll_return_type, |
1060 } |
1026 } |
1061 } |
1027 } |
1062 |
1028 |
1812 // Stub is fixed up when the corresponding call is converted from |
1778 // Stub is fixed up when the corresponding call is converted from |
1813 // calling compiled code to calling interpreted code. |
1779 // calling compiled code to calling interpreted code. |
1814 // movq rbx, 0 |
1780 // movq rbx, 0 |
1815 // jmp -5 # to self |
1781 // jmp -5 # to self |
1816 |
1782 |
1817 address mark = cbuf.inst_mark(); // get mark within main instrs section |
1783 address mark = cbuf.insts_mark(); // get mark within main instrs section |
1818 |
1784 |
1819 // Note that the code buffer's inst_mark is always relative to insts. |
1785 // Note that the code buffer's insts_mark is always relative to insts. |
1820 // That's why we must use the macroassembler to generate a stub. |
1786 // That's why we must use the macroassembler to generate a stub. |
1821 MacroAssembler _masm(&cbuf); |
1787 MacroAssembler _masm(&cbuf); |
1822 |
1788 |
1823 address base = |
1789 address base = |
1824 __ start_a_stub(Compile::MAX_stubs_size); |
1790 __ start_a_stub(Compile::MAX_stubs_size); |
1828 // static stub relocation also tags the methodOop in the code-stream. |
1794 // static stub relocation also tags the methodOop in the code-stream. |
1829 __ movoop(rbx, (jobject) NULL); // method is zapped till fixup time |
1795 __ movoop(rbx, (jobject) NULL); // method is zapped till fixup time |
1830 // This is recognized as unresolved by relocs/nativeinst/ic code |
1796 // This is recognized as unresolved by relocs/nativeinst/ic code |
1831 __ jump(RuntimeAddress(__ pc())); |
1797 __ jump(RuntimeAddress(__ pc())); |
1832 |
1798 |
1833 // Update current stubs pointer and restore code_end. |
1799 // Update current stubs pointer and restore insts_end. |
1834 __ end_a_stub(); |
1800 __ end_a_stub(); |
1835 } |
1801 } |
1836 |
1802 |
1837 // size of call stub, compiled java to interpretor |
1803 // size of call stub, compiled java to interpretor |
1838 uint size_java_to_interp() |
1804 uint size_java_to_interp() |
1866 #endif |
1832 #endif |
1867 |
1833 |
1868 void MachUEPNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const |
1834 void MachUEPNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const |
1869 { |
1835 { |
1870 MacroAssembler masm(&cbuf); |
1836 MacroAssembler masm(&cbuf); |
1871 uint code_size = cbuf.code_size(); |
1837 uint insts_size = cbuf.insts_size(); |
1872 if (UseCompressedOops) { |
1838 if (UseCompressedOops) { |
1873 masm.load_klass(rscratch1, j_rarg0); |
1839 masm.load_klass(rscratch1, j_rarg0); |
1874 masm.cmpptr(rax, rscratch1); |
1840 masm.cmpptr(rax, rscratch1); |
1875 } else { |
1841 } else { |
1876 masm.cmpptr(rax, Address(j_rarg0, oopDesc::klass_offset_in_bytes())); |
1842 masm.cmpptr(rax, Address(j_rarg0, oopDesc::klass_offset_in_bytes())); |
1878 |
1844 |
1879 masm.jump_cc(Assembler::notEqual, RuntimeAddress(SharedRuntime::get_ic_miss_stub())); |
1845 masm.jump_cc(Assembler::notEqual, RuntimeAddress(SharedRuntime::get_ic_miss_stub())); |
1880 |
1846 |
1881 /* WARNING these NOPs are critical so that verified entry point is properly |
1847 /* WARNING these NOPs are critical so that verified entry point is properly |
1882 4 bytes aligned for patching by NativeJump::patch_verified_entry() */ |
1848 4 bytes aligned for patching by NativeJump::patch_verified_entry() */ |
1883 int nops_cnt = 4 - ((cbuf.code_size() - code_size) & 0x3); |
1849 int nops_cnt = 4 - ((cbuf.insts_size() - insts_size) & 0x3); |
1884 if (OptoBreakpoint) { |
1850 if (OptoBreakpoint) { |
1885 // Leave space for int3 |
1851 // Leave space for int3 |
1886 nops_cnt -= 1; |
1852 nops_cnt -= 1; |
1887 } |
1853 } |
1888 nops_cnt &= 0x3; // Do not add nops if code is aligned. |
1854 nops_cnt &= 0x3; // Do not add nops if code is aligned. |
1908 |
1874 |
1909 // Emit exception handler code. |
1875 // Emit exception handler code. |
1910 int emit_exception_handler(CodeBuffer& cbuf) |
1876 int emit_exception_handler(CodeBuffer& cbuf) |
1911 { |
1877 { |
1912 |
1878 |
1913 // Note that the code buffer's inst_mark is always relative to insts. |
1879 // Note that the code buffer's insts_mark is always relative to insts. |
1914 // That's why we must use the macroassembler to generate a handler. |
1880 // That's why we must use the macroassembler to generate a handler. |
1915 MacroAssembler _masm(&cbuf); |
1881 MacroAssembler _masm(&cbuf); |
1916 address base = |
1882 address base = |
1917 __ start_a_stub(size_exception_handler()); |
1883 __ start_a_stub(size_exception_handler()); |
1918 if (base == NULL) return 0; // CodeBuffer::expand failed |
1884 if (base == NULL) return 0; // CodeBuffer::expand failed |
1919 int offset = __ offset(); |
1885 int offset = __ offset(); |
1920 __ jump(RuntimeAddress(OptoRuntime::exception_blob()->instructions_begin())); |
1886 __ jump(RuntimeAddress(OptoRuntime::exception_blob()->entry_point())); |
1921 assert(__ offset() - offset <= (int) size_exception_handler(), "overflow"); |
1887 assert(__ offset() - offset <= (int) size_exception_handler(), "overflow"); |
1922 __ end_a_stub(); |
1888 __ end_a_stub(); |
1923 return offset; |
1889 return offset; |
1924 } |
1890 } |
1925 |
1891 |
1931 |
1897 |
1932 // Emit deopt handler code. |
1898 // Emit deopt handler code. |
1933 int emit_deopt_handler(CodeBuffer& cbuf) |
1899 int emit_deopt_handler(CodeBuffer& cbuf) |
1934 { |
1900 { |
1935 |
1901 |
1936 // Note that the code buffer's inst_mark is always relative to insts. |
1902 // Note that the code buffer's insts_mark is always relative to insts. |
1937 // That's why we must use the macroassembler to generate a handler. |
1903 // That's why we must use the macroassembler to generate a handler. |
1938 MacroAssembler _masm(&cbuf); |
1904 MacroAssembler _masm(&cbuf); |
1939 address base = |
1905 address base = |
1940 __ start_a_stub(size_deopt_handler()); |
1906 __ start_a_stub(size_deopt_handler()); |
1941 if (base == NULL) return 0; // CodeBuffer::expand failed |
1907 if (base == NULL) return 0; // CodeBuffer::expand failed |
1960 int mark = cbuf.insts()->mark_off(); |
1926 int mark = cbuf.insts()->mark_off(); |
1961 MacroAssembler _masm(&cbuf); |
1927 MacroAssembler _masm(&cbuf); |
1962 address double_address = __ double_constant(x); |
1928 address double_address = __ double_constant(x); |
1963 cbuf.insts()->set_mark_off(mark); // preserve mark across masm shift |
1929 cbuf.insts()->set_mark_off(mark); // preserve mark across masm shift |
1964 emit_d32_reloc(cbuf, |
1930 emit_d32_reloc(cbuf, |
1965 (int) (double_address - cbuf.code_end() - 4), |
1931 (int) (double_address - cbuf.insts_end() - 4), |
1966 internal_word_Relocation::spec(double_address), |
1932 internal_word_Relocation::spec(double_address), |
1967 RELOC_DISP32); |
1933 RELOC_DISP32); |
1968 } |
1934 } |
1969 |
1935 |
1970 static void emit_float_constant(CodeBuffer& cbuf, float x) { |
1936 static void emit_float_constant(CodeBuffer& cbuf, float x) { |
1971 int mark = cbuf.insts()->mark_off(); |
1937 int mark = cbuf.insts()->mark_off(); |
1972 MacroAssembler _masm(&cbuf); |
1938 MacroAssembler _masm(&cbuf); |
1973 address float_address = __ float_constant(x); |
1939 address float_address = __ float_constant(x); |
1974 cbuf.insts()->set_mark_off(mark); // preserve mark across masm shift |
1940 cbuf.insts()->set_mark_off(mark); // preserve mark across masm shift |
1975 emit_d32_reloc(cbuf, |
1941 emit_d32_reloc(cbuf, |
1976 (int) (float_address - cbuf.code_end() - 4), |
1942 (int) (float_address - cbuf.insts_end() - 4), |
1977 internal_word_Relocation::spec(float_address), |
1943 internal_word_Relocation::spec(float_address), |
1978 RELOC_DISP32); |
1944 RELOC_DISP32); |
1979 } |
1945 } |
1980 |
1946 |
1981 |
1947 |
2479 |
2445 |
2480 enc_class Lbl(label labl) |
2446 enc_class Lbl(label labl) |
2481 %{ |
2447 %{ |
2482 // JMP, CALL |
2448 // JMP, CALL |
2483 Label* l = $labl$$label; |
2449 Label* l = $labl$$label; |
2484 emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0); |
2450 emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0); |
2485 %} |
2451 %} |
2486 |
2452 |
2487 enc_class LblShort(label labl) |
2453 enc_class LblShort(label labl) |
2488 %{ |
2454 %{ |
2489 // JMP, CALL |
2455 // JMP, CALL |
2490 Label* l = $labl$$label; |
2456 Label* l = $labl$$label; |
2491 int disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0; |
2457 int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0; |
2492 assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp"); |
2458 assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp"); |
2493 emit_d8(cbuf, disp); |
2459 emit_d8(cbuf, disp); |
2494 %} |
2460 %} |
2495 |
2461 |
2496 enc_class opc2_reg(rRegI dst) |
2462 enc_class opc2_reg(rRegI dst) |
2515 %{ |
2481 %{ |
2516 // JCC |
2482 // JCC |
2517 Label* l = $labl$$label; |
2483 Label* l = $labl$$label; |
2518 $$$emit8$primary; |
2484 $$$emit8$primary; |
2519 emit_cc(cbuf, $secondary, $cop$$cmpcode); |
2485 emit_cc(cbuf, $secondary, $cop$$cmpcode); |
2520 emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0); |
2486 emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0); |
2521 %} |
2487 %} |
2522 |
2488 |
2523 enc_class JccShort (cmpOp cop, label labl) |
2489 enc_class JccShort (cmpOp cop, label labl) |
2524 %{ |
2490 %{ |
2525 // JCC |
2491 // JCC |
2526 Label *l = $labl$$label; |
2492 Label *l = $labl$$label; |
2527 emit_cc(cbuf, $primary, $cop$$cmpcode); |
2493 emit_cc(cbuf, $primary, $cop$$cmpcode); |
2528 int disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0; |
2494 int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0; |
2529 assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp"); |
2495 assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp"); |
2530 emit_d8(cbuf, disp); |
2496 emit_d8(cbuf, disp); |
2531 %} |
2497 %} |
2532 |
2498 |
2533 enc_class enc_cmov(cmpOp cop) |
2499 enc_class enc_cmov(cmpOp cop) |
2607 |
2573 |
2608 enc_class Java_To_Interpreter(method meth) |
2574 enc_class Java_To_Interpreter(method meth) |
2609 %{ |
2575 %{ |
2610 // CALL Java_To_Interpreter |
2576 // CALL Java_To_Interpreter |
2611 // This is the instruction starting address for relocation info. |
2577 // This is the instruction starting address for relocation info. |
2612 cbuf.set_inst_mark(); |
2578 cbuf.set_insts_mark(); |
2613 $$$emit8$primary; |
2579 $$$emit8$primary; |
2614 // CALL directly to the runtime |
2580 // CALL directly to the runtime |
2615 emit_d32_reloc(cbuf, |
2581 emit_d32_reloc(cbuf, |
2616 (int) ($meth$$method - ((intptr_t) cbuf.code_end()) - 4), |
2582 (int) ($meth$$method - ((intptr_t) cbuf.insts_end()) - 4), |
2617 runtime_call_Relocation::spec(), |
2583 runtime_call_Relocation::spec(), |
2618 RELOC_DISP32); |
2584 RELOC_DISP32); |
2619 %} |
2585 %} |
2620 |
2586 |
2621 enc_class preserve_SP %{ |
2587 enc_class preserve_SP %{ |
2622 debug_only(int off0 = cbuf.code_size()); |
2588 debug_only(int off0 = cbuf.insts_size()); |
2623 MacroAssembler _masm(&cbuf); |
2589 MacroAssembler _masm(&cbuf); |
2624 // RBP is preserved across all calls, even compiled calls. |
2590 // RBP is preserved across all calls, even compiled calls. |
2625 // Use it to preserve RSP in places where the callee might change the SP. |
2591 // Use it to preserve RSP in places where the callee might change the SP. |
2626 __ movptr(rbp_mh_SP_save, rsp); |
2592 __ movptr(rbp_mh_SP_save, rsp); |
2627 debug_only(int off1 = cbuf.code_size()); |
2593 debug_only(int off1 = cbuf.insts_size()); |
2628 assert(off1 - off0 == preserve_SP_size(), "correct size prediction"); |
2594 assert(off1 - off0 == preserve_SP_size(), "correct size prediction"); |
2629 %} |
2595 %} |
2630 |
2596 |
2631 enc_class restore_SP %{ |
2597 enc_class restore_SP %{ |
2632 MacroAssembler _masm(&cbuf); |
2598 MacroAssembler _masm(&cbuf); |
2636 enc_class Java_Static_Call(method meth) |
2602 enc_class Java_Static_Call(method meth) |
2637 %{ |
2603 %{ |
2638 // JAVA STATIC CALL |
2604 // JAVA STATIC CALL |
2639 // CALL to fixup routine. Fixup routine uses ScopeDesc info to |
2605 // CALL to fixup routine. Fixup routine uses ScopeDesc info to |
2640 // determine who we intended to call. |
2606 // determine who we intended to call. |
2641 cbuf.set_inst_mark(); |
2607 cbuf.set_insts_mark(); |
2642 $$$emit8$primary; |
2608 $$$emit8$primary; |
2643 |
2609 |
2644 if (!_method) { |
2610 if (!_method) { |
2645 emit_d32_reloc(cbuf, |
2611 emit_d32_reloc(cbuf, |
2646 (int) ($meth$$method - ((intptr_t) cbuf.code_end()) - 4), |
2612 (int) ($meth$$method - ((intptr_t) cbuf.insts_end()) - 4), |
2647 runtime_call_Relocation::spec(), |
2613 runtime_call_Relocation::spec(), |
2648 RELOC_DISP32); |
2614 RELOC_DISP32); |
2649 } else if (_optimized_virtual) { |
2615 } else if (_optimized_virtual) { |
2650 emit_d32_reloc(cbuf, |
2616 emit_d32_reloc(cbuf, |
2651 (int) ($meth$$method - ((intptr_t) cbuf.code_end()) - 4), |
2617 (int) ($meth$$method - ((intptr_t) cbuf.insts_end()) - 4), |
2652 opt_virtual_call_Relocation::spec(), |
2618 opt_virtual_call_Relocation::spec(), |
2653 RELOC_DISP32); |
2619 RELOC_DISP32); |
2654 } else { |
2620 } else { |
2655 emit_d32_reloc(cbuf, |
2621 emit_d32_reloc(cbuf, |
2656 (int) ($meth$$method - ((intptr_t) cbuf.code_end()) - 4), |
2622 (int) ($meth$$method - ((intptr_t) cbuf.insts_end()) - 4), |
2657 static_call_Relocation::spec(), |
2623 static_call_Relocation::spec(), |
2658 RELOC_DISP32); |
2624 RELOC_DISP32); |
2659 } |
2625 } |
2660 if (_method) { |
2626 if (_method) { |
2661 // Emit stub for static call |
2627 // Emit stub for static call |
2667 %{ |
2633 %{ |
2668 // JAVA DYNAMIC CALL |
2634 // JAVA DYNAMIC CALL |
2669 // !!!!! |
2635 // !!!!! |
2670 // Generate "movq rax, -1", placeholder instruction to load oop-info |
2636 // Generate "movq rax, -1", placeholder instruction to load oop-info |
2671 // emit_call_dynamic_prologue( cbuf ); |
2637 // emit_call_dynamic_prologue( cbuf ); |
2672 cbuf.set_inst_mark(); |
2638 cbuf.set_insts_mark(); |
2673 |
2639 |
2674 // movq rax, -1 |
2640 // movq rax, -1 |
2675 emit_opcode(cbuf, Assembler::REX_W); |
2641 emit_opcode(cbuf, Assembler::REX_W); |
2676 emit_opcode(cbuf, 0xB8 | RAX_enc); |
2642 emit_opcode(cbuf, 0xB8 | RAX_enc); |
2677 emit_d64_reloc(cbuf, |
2643 emit_d64_reloc(cbuf, |
2678 (int64_t) Universe::non_oop_word(), |
2644 (int64_t) Universe::non_oop_word(), |
2679 oop_Relocation::spec_for_immediate(), RELOC_IMM64); |
2645 oop_Relocation::spec_for_immediate(), RELOC_IMM64); |
2680 address virtual_call_oop_addr = cbuf.inst_mark(); |
2646 address virtual_call_oop_addr = cbuf.insts_mark(); |
2681 // CALL to fixup routine. Fixup routine uses ScopeDesc info to determine |
2647 // CALL to fixup routine. Fixup routine uses ScopeDesc info to determine |
2682 // who we intended to call. |
2648 // who we intended to call. |
2683 cbuf.set_inst_mark(); |
2649 cbuf.set_insts_mark(); |
2684 $$$emit8$primary; |
2650 $$$emit8$primary; |
2685 emit_d32_reloc(cbuf, |
2651 emit_d32_reloc(cbuf, |
2686 (int) ($meth$$method - ((intptr_t) cbuf.code_end()) - 4), |
2652 (int) ($meth$$method - ((intptr_t) cbuf.insts_end()) - 4), |
2687 virtual_call_Relocation::spec(virtual_call_oop_addr), |
2653 virtual_call_Relocation::spec(virtual_call_oop_addr), |
2688 RELOC_DISP32); |
2654 RELOC_DISP32); |
2689 %} |
2655 %} |
2690 |
2656 |
2691 enc_class Java_Compiled_Call(method meth) |
2657 enc_class Java_Compiled_Call(method meth) |
2695 |
2661 |
2696 // XXX XXX offset is 128 is 1.5 NON-PRODUCT !!! |
2662 // XXX XXX offset is 128 is 1.5 NON-PRODUCT !!! |
2697 // assert(-0x80 <= disp && disp < 0x80, "compiled_code_offset isn't small"); |
2663 // assert(-0x80 <= disp && disp < 0x80, "compiled_code_offset isn't small"); |
2698 |
2664 |
2699 // callq *disp(%rax) |
2665 // callq *disp(%rax) |
2700 cbuf.set_inst_mark(); |
2666 cbuf.set_insts_mark(); |
2701 $$$emit8$primary; |
2667 $$$emit8$primary; |
2702 if (disp < 0x80) { |
2668 if (disp < 0x80) { |
2703 emit_rm(cbuf, 0x01, $secondary, RAX_enc); // R/M byte |
2669 emit_rm(cbuf, 0x01, $secondary, RAX_enc); // R/M byte |
2704 emit_d8(cbuf, disp); // Displacement |
2670 emit_d8(cbuf, disp); // Displacement |
2705 } else { |
2671 } else { |
3727 %} |
3693 %} |
3728 |
3694 |
3729 |
3695 |
3730 enc_class enc_rethrow() |
3696 enc_class enc_rethrow() |
3731 %{ |
3697 %{ |
3732 cbuf.set_inst_mark(); |
3698 cbuf.set_insts_mark(); |
3733 emit_opcode(cbuf, 0xE9); // jmp entry |
3699 emit_opcode(cbuf, 0xE9); // jmp entry |
3734 emit_d32_reloc(cbuf, |
3700 emit_d32_reloc(cbuf, |
3735 (int) (OptoRuntime::rethrow_stub() - cbuf.code_end() - 4), |
3701 (int) (OptoRuntime::rethrow_stub() - cbuf.insts_end() - 4), |
3736 runtime_call_Relocation::spec(), |
3702 runtime_call_Relocation::spec(), |
3737 RELOC_DISP32); |
3703 RELOC_DISP32); |
3738 %} |
3704 %} |
3739 |
3705 |
3740 enc_class absF_encoding(regF dst) |
3706 enc_class absF_encoding(regF dst) |
3741 %{ |
3707 %{ |
3742 int dstenc = $dst$$reg; |
3708 int dstenc = $dst$$reg; |
3743 address signmask_address = (address) StubRoutines::x86::float_sign_mask(); |
3709 address signmask_address = (address) StubRoutines::x86::float_sign_mask(); |
3744 |
3710 |
3745 cbuf.set_inst_mark(); |
3711 cbuf.set_insts_mark(); |
3746 if (dstenc >= 8) { |
3712 if (dstenc >= 8) { |
3747 emit_opcode(cbuf, Assembler::REX_R); |
3713 emit_opcode(cbuf, Assembler::REX_R); |
3748 dstenc -= 8; |
3714 dstenc -= 8; |
3749 } |
3715 } |
3750 // XXX reg_mem doesn't support RIP-relative addressing yet |
3716 // XXX reg_mem doesn't support RIP-relative addressing yet |
3757 enc_class absD_encoding(regD dst) |
3723 enc_class absD_encoding(regD dst) |
3758 %{ |
3724 %{ |
3759 int dstenc = $dst$$reg; |
3725 int dstenc = $dst$$reg; |
3760 address signmask_address = (address) StubRoutines::x86::double_sign_mask(); |
3726 address signmask_address = (address) StubRoutines::x86::double_sign_mask(); |
3761 |
3727 |
3762 cbuf.set_inst_mark(); |
3728 cbuf.set_insts_mark(); |
3763 emit_opcode(cbuf, 0x66); |
3729 emit_opcode(cbuf, 0x66); |
3764 if (dstenc >= 8) { |
3730 if (dstenc >= 8) { |
3765 emit_opcode(cbuf, Assembler::REX_R); |
3731 emit_opcode(cbuf, Assembler::REX_R); |
3766 dstenc -= 8; |
3732 dstenc -= 8; |
3767 } |
3733 } |
3775 enc_class negF_encoding(regF dst) |
3741 enc_class negF_encoding(regF dst) |
3776 %{ |
3742 %{ |
3777 int dstenc = $dst$$reg; |
3743 int dstenc = $dst$$reg; |
3778 address signflip_address = (address) StubRoutines::x86::float_sign_flip(); |
3744 address signflip_address = (address) StubRoutines::x86::float_sign_flip(); |
3779 |
3745 |
3780 cbuf.set_inst_mark(); |
3746 cbuf.set_insts_mark(); |
3781 if (dstenc >= 8) { |
3747 if (dstenc >= 8) { |
3782 emit_opcode(cbuf, Assembler::REX_R); |
3748 emit_opcode(cbuf, Assembler::REX_R); |
3783 dstenc -= 8; |
3749 dstenc -= 8; |
3784 } |
3750 } |
3785 // XXX reg_mem doesn't support RIP-relative addressing yet |
3751 // XXX reg_mem doesn't support RIP-relative addressing yet |
3792 enc_class negD_encoding(regD dst) |
3758 enc_class negD_encoding(regD dst) |
3793 %{ |
3759 %{ |
3794 int dstenc = $dst$$reg; |
3760 int dstenc = $dst$$reg; |
3795 address signflip_address = (address) StubRoutines::x86::double_sign_flip(); |
3761 address signflip_address = (address) StubRoutines::x86::double_sign_flip(); |
3796 |
3762 |
3797 cbuf.set_inst_mark(); |
3763 cbuf.set_insts_mark(); |
3798 emit_opcode(cbuf, 0x66); |
3764 emit_opcode(cbuf, 0x66); |
3799 if (dstenc >= 8) { |
3765 if (dstenc >= 8) { |
3800 emit_opcode(cbuf, Assembler::REX_R); |
3766 emit_opcode(cbuf, Assembler::REX_R); |
3801 dstenc -= 8; |
3767 dstenc -= 8; |
3802 } |
3768 } |
3844 emit_opcode(cbuf, 0x0F); |
3810 emit_opcode(cbuf, 0x0F); |
3845 emit_opcode(cbuf, 0x11); |
3811 emit_opcode(cbuf, 0x11); |
3846 encode_RegMem(cbuf, srcenc, RSP_enc, 0x4, 0, 0, false); // 2 bytes |
3812 encode_RegMem(cbuf, srcenc, RSP_enc, 0x4, 0, 0, false); // 2 bytes |
3847 |
3813 |
3848 // call f2i_fixup |
3814 // call f2i_fixup |
3849 cbuf.set_inst_mark(); |
3815 cbuf.set_insts_mark(); |
3850 emit_opcode(cbuf, 0xE8); |
3816 emit_opcode(cbuf, 0xE8); |
3851 emit_d32_reloc(cbuf, |
3817 emit_d32_reloc(cbuf, |
3852 (int) |
3818 (int) |
3853 (StubRoutines::x86::f2i_fixup() - cbuf.code_end() - 4), |
3819 (StubRoutines::x86::f2i_fixup() - cbuf.insts_end() - 4), |
3854 runtime_call_Relocation::spec(), |
3820 runtime_call_Relocation::spec(), |
3855 RELOC_DISP32); |
3821 RELOC_DISP32); |
3856 |
3822 |
3857 // popq $dst |
3823 // popq $dst |
3858 if (dstenc >= 8) { |
3824 if (dstenc >= 8) { |
3868 int dstenc = $dst$$reg; |
3834 int dstenc = $dst$$reg; |
3869 int srcenc = $src$$reg; |
3835 int srcenc = $src$$reg; |
3870 address const_address = (address) StubRoutines::x86::double_sign_flip(); |
3836 address const_address = (address) StubRoutines::x86::double_sign_flip(); |
3871 |
3837 |
3872 // cmpq $dst, [0x8000000000000000] |
3838 // cmpq $dst, [0x8000000000000000] |
3873 cbuf.set_inst_mark(); |
3839 cbuf.set_insts_mark(); |
3874 emit_opcode(cbuf, dstenc < 8 ? Assembler::REX_W : Assembler::REX_WR); |
3840 emit_opcode(cbuf, dstenc < 8 ? Assembler::REX_W : Assembler::REX_WR); |
3875 emit_opcode(cbuf, 0x39); |
3841 emit_opcode(cbuf, 0x39); |
3876 // XXX reg_mem doesn't support RIP-relative addressing yet |
3842 // XXX reg_mem doesn't support RIP-relative addressing yet |
3877 emit_rm(cbuf, 0x0, dstenc & 7, 0x5); // 00 reg 101 |
3843 emit_rm(cbuf, 0x0, dstenc & 7, 0x5); // 00 reg 101 |
3878 emit_d32_reloc(cbuf, const_address); |
3844 emit_d32_reloc(cbuf, const_address); |
3902 emit_opcode(cbuf, 0x0F); |
3868 emit_opcode(cbuf, 0x0F); |
3903 emit_opcode(cbuf, 0x11); |
3869 emit_opcode(cbuf, 0x11); |
3904 encode_RegMem(cbuf, srcenc, RSP_enc, 0x4, 0, 0, false); // 2 bytes |
3870 encode_RegMem(cbuf, srcenc, RSP_enc, 0x4, 0, 0, false); // 2 bytes |
3905 |
3871 |
3906 // call f2l_fixup |
3872 // call f2l_fixup |
3907 cbuf.set_inst_mark(); |
3873 cbuf.set_insts_mark(); |
3908 emit_opcode(cbuf, 0xE8); |
3874 emit_opcode(cbuf, 0xE8); |
3909 emit_d32_reloc(cbuf, |
3875 emit_d32_reloc(cbuf, |
3910 (int) |
3876 (int) |
3911 (StubRoutines::x86::f2l_fixup() - cbuf.code_end() - 4), |
3877 (StubRoutines::x86::f2l_fixup() - cbuf.insts_end() - 4), |
3912 runtime_call_Relocation::spec(), |
3878 runtime_call_Relocation::spec(), |
3913 RELOC_DISP32); |
3879 RELOC_DISP32); |
3914 |
3880 |
3915 // popq $dst |
3881 // popq $dst |
3916 if (dstenc >= 8) { |
3882 if (dstenc >= 8) { |
3958 emit_opcode(cbuf, 0x0F); |
3924 emit_opcode(cbuf, 0x0F); |
3959 emit_opcode(cbuf, 0x11); |
3925 emit_opcode(cbuf, 0x11); |
3960 encode_RegMem(cbuf, srcenc, RSP_enc, 0x4, 0, 0, false); // 2 bytes |
3926 encode_RegMem(cbuf, srcenc, RSP_enc, 0x4, 0, 0, false); // 2 bytes |
3961 |
3927 |
3962 // call d2i_fixup |
3928 // call d2i_fixup |
3963 cbuf.set_inst_mark(); |
3929 cbuf.set_insts_mark(); |
3964 emit_opcode(cbuf, 0xE8); |
3930 emit_opcode(cbuf, 0xE8); |
3965 emit_d32_reloc(cbuf, |
3931 emit_d32_reloc(cbuf, |
3966 (int) |
3932 (int) |
3967 (StubRoutines::x86::d2i_fixup() - cbuf.code_end() - 4), |
3933 (StubRoutines::x86::d2i_fixup() - cbuf.insts_end() - 4), |
3968 runtime_call_Relocation::spec(), |
3934 runtime_call_Relocation::spec(), |
3969 RELOC_DISP32); |
3935 RELOC_DISP32); |
3970 |
3936 |
3971 // popq $dst |
3937 // popq $dst |
3972 if (dstenc >= 8) { |
3938 if (dstenc >= 8) { |
3982 int dstenc = $dst$$reg; |
3948 int dstenc = $dst$$reg; |
3983 int srcenc = $src$$reg; |
3949 int srcenc = $src$$reg; |
3984 address const_address = (address) StubRoutines::x86::double_sign_flip(); |
3950 address const_address = (address) StubRoutines::x86::double_sign_flip(); |
3985 |
3951 |
3986 // cmpq $dst, [0x8000000000000000] |
3952 // cmpq $dst, [0x8000000000000000] |
3987 cbuf.set_inst_mark(); |
3953 cbuf.set_insts_mark(); |
3988 emit_opcode(cbuf, dstenc < 8 ? Assembler::REX_W : Assembler::REX_WR); |
3954 emit_opcode(cbuf, dstenc < 8 ? Assembler::REX_W : Assembler::REX_WR); |
3989 emit_opcode(cbuf, 0x39); |
3955 emit_opcode(cbuf, 0x39); |
3990 // XXX reg_mem doesn't support RIP-relative addressing yet |
3956 // XXX reg_mem doesn't support RIP-relative addressing yet |
3991 emit_rm(cbuf, 0x0, dstenc & 7, 0x5); // 00 reg 101 |
3957 emit_rm(cbuf, 0x0, dstenc & 7, 0x5); // 00 reg 101 |
3992 emit_d32_reloc(cbuf, const_address); |
3958 emit_d32_reloc(cbuf, const_address); |
4016 emit_opcode(cbuf, 0x0F); |
3982 emit_opcode(cbuf, 0x0F); |
4017 emit_opcode(cbuf, 0x11); |
3983 emit_opcode(cbuf, 0x11); |
4018 encode_RegMem(cbuf, srcenc, RSP_enc, 0x4, 0, 0, false); // 2 bytes |
3984 encode_RegMem(cbuf, srcenc, RSP_enc, 0x4, 0, 0, false); // 2 bytes |
4019 |
3985 |
4020 // call d2l_fixup |
3986 // call d2l_fixup |
4021 cbuf.set_inst_mark(); |
3987 cbuf.set_insts_mark(); |
4022 emit_opcode(cbuf, 0xE8); |
3988 emit_opcode(cbuf, 0xE8); |
4023 emit_d32_reloc(cbuf, |
3989 emit_d32_reloc(cbuf, |
4024 (int) |
3990 (int) |
4025 (StubRoutines::x86::d2l_fixup() - cbuf.code_end() - 4), |
3991 (StubRoutines::x86::d2l_fixup() - cbuf.insts_end() - 4), |
4026 runtime_call_Relocation::spec(), |
3992 runtime_call_Relocation::spec(), |
4027 RELOC_DISP32); |
3993 RELOC_DISP32); |
4028 |
3994 |
4029 // popq $dst |
3995 // popq $dst |
4030 if (dstenc >= 8) { |
3996 if (dstenc >= 8) { |
4040 // RFLAGS in the process. |
4006 // RFLAGS in the process. |
4041 enc_class enc_safepoint_poll |
4007 enc_class enc_safepoint_poll |
4042 %{ |
4008 %{ |
4043 // testl %rax, off(%rip) // Opcode + ModRM + Disp32 == 6 bytes |
4009 // testl %rax, off(%rip) // Opcode + ModRM + Disp32 == 6 bytes |
4044 // XXX reg_mem doesn't support RIP-relative addressing yet |
4010 // XXX reg_mem doesn't support RIP-relative addressing yet |
4045 cbuf.set_inst_mark(); |
4011 cbuf.set_insts_mark(); |
4046 cbuf.relocate(cbuf.inst_mark(), relocInfo::poll_type, 0); // XXX |
4012 cbuf.relocate(cbuf.insts_mark(), relocInfo::poll_type, 0); // XXX |
4047 emit_opcode(cbuf, 0x85); // testl |
4013 emit_opcode(cbuf, 0x85); // testl |
4048 emit_rm(cbuf, 0x0, RAX_enc, 0x5); // 00 rax 101 == 0x5 |
4014 emit_rm(cbuf, 0x0, RAX_enc, 0x5); // 00 rax 101 == 0x5 |
4049 // cbuf.inst_mark() is beginning of instruction |
4015 // cbuf.insts_mark() is beginning of instruction |
4050 emit_d32_reloc(cbuf, os::get_polling_page()); |
4016 emit_d32_reloc(cbuf, os::get_polling_page()); |
4051 // relocInfo::poll_type, |
4017 // relocInfo::poll_type, |
4052 %} |
4018 %} |
4053 %} |
4019 %} |
4054 |
4020 |
12302 $$$emit8$primary; |
12268 $$$emit8$primary; |
12303 emit_cc(cbuf, $secondary, Assembler::parity); |
12269 emit_cc(cbuf, $secondary, Assembler::parity); |
12304 int parity_disp = -1; |
12270 int parity_disp = -1; |
12305 if ($cop$$cmpcode == Assembler::notEqual) { |
12271 if ($cop$$cmpcode == Assembler::notEqual) { |
12306 // the two jumps 6 bytes apart so the jump distances are too |
12272 // the two jumps 6 bytes apart so the jump distances are too |
12307 parity_disp = l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0; |
12273 parity_disp = l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0; |
12308 } else if ($cop$$cmpcode == Assembler::equal) { |
12274 } else if ($cop$$cmpcode == Assembler::equal) { |
12309 parity_disp = 6; |
12275 parity_disp = 6; |
12310 } else { |
12276 } else { |
12311 ShouldNotReachHere(); |
12277 ShouldNotReachHere(); |
12312 } |
12278 } |
12313 emit_d32(cbuf, parity_disp); |
12279 emit_d32(cbuf, parity_disp); |
12314 $$$emit8$primary; |
12280 $$$emit8$primary; |
12315 emit_cc(cbuf, $secondary, $cop$$cmpcode); |
12281 emit_cc(cbuf, $secondary, $cop$$cmpcode); |
12316 int disp = l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0; |
12282 int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0; |
12317 emit_d32(cbuf, disp); |
12283 emit_d32(cbuf, disp); |
12318 %} |
12284 %} |
12319 ins_pipe(pipe_jcc); |
12285 ins_pipe(pipe_jcc); |
12320 ins_pc_relative(1); |
12286 ins_pc_relative(1); |
12321 %} |
12287 %} |
12506 ins_encode %{ |
12472 ins_encode %{ |
12507 Label* l = $labl$$label; |
12473 Label* l = $labl$$label; |
12508 emit_cc(cbuf, $primary, Assembler::parity); |
12474 emit_cc(cbuf, $primary, Assembler::parity); |
12509 int parity_disp = -1; |
12475 int parity_disp = -1; |
12510 if ($cop$$cmpcode == Assembler::notEqual) { |
12476 if ($cop$$cmpcode == Assembler::notEqual) { |
12511 parity_disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0; |
12477 parity_disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0; |
12512 } else if ($cop$$cmpcode == Assembler::equal) { |
12478 } else if ($cop$$cmpcode == Assembler::equal) { |
12513 parity_disp = 2; |
12479 parity_disp = 2; |
12514 } else { |
12480 } else { |
12515 ShouldNotReachHere(); |
12481 ShouldNotReachHere(); |
12516 } |
12482 } |
12517 emit_d8(cbuf, parity_disp); |
12483 emit_d8(cbuf, parity_disp); |
12518 emit_cc(cbuf, $primary, $cop$$cmpcode); |
12484 emit_cc(cbuf, $primary, $cop$$cmpcode); |
12519 int disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0; |
12485 int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0; |
12520 emit_d8(cbuf, disp); |
12486 emit_d8(cbuf, disp); |
12521 assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp"); |
12487 assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp"); |
12522 assert(-128 <= parity_disp && parity_disp <= 127, "Displacement too large for short jmp"); |
12488 assert(-128 <= parity_disp && parity_disp <= 127, "Displacement too large for short jmp"); |
12523 %} |
12489 %} |
12524 ins_pipe(pipe_jcc); |
12490 ins_pipe(pipe_jcc); |