comparison src/cpu/x86/vm/x86_64.ad @ 1579:e9ff18c4ace7

Merge
author jrose
date Wed, 02 Jun 2010 22:45:42 -0700
parents c18cbe5936b8 3657cb01ffc5
children f55c4f82ab9d
comparison
equal deleted inserted replaced
1562:dfe27f03244a 1579:e9ff18c4ace7
1849 //============================================================================= 1849 //=============================================================================
1850 #ifndef PRODUCT 1850 #ifndef PRODUCT
1851 void MachUEPNode::format(PhaseRegAlloc* ra_, outputStream* st) const 1851 void MachUEPNode::format(PhaseRegAlloc* ra_, outputStream* st) const
1852 { 1852 {
1853 if (UseCompressedOops) { 1853 if (UseCompressedOops) {
1854 st->print_cr("movl rscratch1, [j_rarg0 + oopDesc::klass_offset_in_bytes() #%d]\t", oopDesc::klass_offset_in_bytes()); 1854 st->print_cr("movl rscratch1, [j_rarg0 + oopDesc::klass_offset_in_bytes()]\t# compressed klass");
1855 if (Universe::narrow_oop_shift() != 0) { 1855 if (Universe::narrow_oop_shift() != 0) {
1856 st->print_cr("leaq rscratch1, [r12_heapbase, r, Address::times_8, 0]"); 1856 st->print_cr("\tdecode_heap_oop_not_null rscratch1, rscratch1");
1857 } 1857 }
1858 st->print_cr("cmpq rax, rscratch1\t # Inline cache check"); 1858 st->print_cr("\tcmpq rax, rscratch1\t # Inline cache check");
1859 } else { 1859 } else {
1860 st->print_cr("cmpq rax, [j_rarg0 + oopDesc::klass_offset_in_bytes() #%d]\t" 1860 st->print_cr("\tcmpq rax, [j_rarg0 + oopDesc::klass_offset_in_bytes()]\t"
1861 "# Inline cache check", oopDesc::klass_offset_in_bytes()); 1861 "# Inline cache check");
1862 } 1862 }
1863 st->print_cr("\tjne SharedRuntime::_ic_miss_stub"); 1863 st->print_cr("\tjne SharedRuntime::_ic_miss_stub");
1864 st->print_cr("\tnop"); 1864 st->print_cr("\tnop\t# nops to align entry point");
1865 if (!OptoBreakpoint) {
1866 st->print_cr("\tnop");
1867 }
1868 } 1865 }
1869 #endif 1866 #endif
1870 1867
1871 void MachUEPNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const 1868 void MachUEPNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const
1872 { 1869 {
1873 MacroAssembler masm(&cbuf); 1870 MacroAssembler masm(&cbuf);
1874 #ifdef ASSERT
1875 uint code_size = cbuf.code_size(); 1871 uint code_size = cbuf.code_size();
1876 #endif
1877 if (UseCompressedOops) { 1872 if (UseCompressedOops) {
1878 masm.load_klass(rscratch1, j_rarg0); 1873 masm.load_klass(rscratch1, j_rarg0);
1879 masm.cmpptr(rax, rscratch1); 1874 masm.cmpptr(rax, rscratch1);
1880 } else { 1875 } else {
1881 masm.cmpptr(rax, Address(j_rarg0, oopDesc::klass_offset_in_bytes())); 1876 masm.cmpptr(rax, Address(j_rarg0, oopDesc::klass_offset_in_bytes()));
1882 } 1877 }
1883 1878
1884 masm.jump_cc(Assembler::notEqual, RuntimeAddress(SharedRuntime::get_ic_miss_stub())); 1879 masm.jump_cc(Assembler::notEqual, RuntimeAddress(SharedRuntime::get_ic_miss_stub()));
1885 1880
1886 /* WARNING these NOPs are critical so that verified entry point is properly 1881 /* WARNING these NOPs are critical so that verified entry point is properly
1887 aligned for patching by NativeJump::patch_verified_entry() */ 1882 4 bytes aligned for patching by NativeJump::patch_verified_entry() */
1888 int nops_cnt = 1; 1883 int nops_cnt = 4 - ((cbuf.code_size() - code_size) & 0x3);
1889 if (!OptoBreakpoint) { 1884 if (OptoBreakpoint) {
1890 // Leave space for int3 1885 // Leave space for int3
1891 nops_cnt += 1; 1886 nops_cnt -= 1;
1892 } 1887 }
1893 if (UseCompressedOops) { 1888 nops_cnt &= 0x3; // Do not add nops if code is aligned.
1894 // ??? divisible by 4 is aligned? 1889 if (nops_cnt > 0)
1895 nops_cnt += 1; 1890 masm.nop(nops_cnt);
1896 }
1897 masm.nop(nops_cnt);
1898
1899 assert(cbuf.code_size() - code_size == size(ra_),
1900 "checking code size of inline cache node");
1901 } 1891 }
1902 1892
1903 uint MachUEPNode::size(PhaseRegAlloc* ra_) const 1893 uint MachUEPNode::size(PhaseRegAlloc* ra_) const
1904 { 1894 {
1905 if (UseCompressedOops) { 1895 return MachNode::size(ra_); // too many variables; just compute it
1906 if (Universe::narrow_oop_shift() == 0) { 1896 // the hard way
1907 return OptoBreakpoint ? 15 : 16;
1908 } else {
1909 return OptoBreakpoint ? 19 : 20;
1910 }
1911 } else {
1912 return OptoBreakpoint ? 11 : 12;
1913 }
1914 } 1897 }
1915 1898
1916 1899
1917 //============================================================================= 1900 //=============================================================================
1918 uint size_exception_handler() 1901 uint size_exception_handler()
2051 2034
2052 // Should the Matcher clone shifts on addressing modes, expecting them 2035 // Should the Matcher clone shifts on addressing modes, expecting them
2053 // to be subsumed into complex addressing expressions or compute them 2036 // to be subsumed into complex addressing expressions or compute them
2054 // into registers? True for Intel but false for most RISCs 2037 // into registers? True for Intel but false for most RISCs
2055 const bool Matcher::clone_shift_expressions = true; 2038 const bool Matcher::clone_shift_expressions = true;
2039
2040 bool Matcher::narrow_oop_use_complex_address() {
2041 assert(UseCompressedOops, "only for compressed oops code");
2042 return (LogMinObjAlignmentInBytes <= 3);
2043 }
2056 2044
2057 // Is it better to copy float constants, or load them directly from 2045 // Is it better to copy float constants, or load them directly from
2058 // memory? Intel can load a float constant from a direct address, 2046 // memory? Intel can load a float constant from a direct address,
2059 // requiring no extra registers. Most RISCs will have to materialize 2047 // requiring no extra registers. Most RISCs will have to materialize
2060 // an address into a register first, so they would do better to copy 2048 // an address into a register first, so they would do better to copy
2633 enc_class preserve_SP %{ 2621 enc_class preserve_SP %{
2634 debug_only(int off0 = cbuf.code_size()); 2622 debug_only(int off0 = cbuf.code_size());
2635 MacroAssembler _masm(&cbuf); 2623 MacroAssembler _masm(&cbuf);
2636 // RBP is preserved across all calls, even compiled calls. 2624 // RBP is preserved across all calls, even compiled calls.
2637 // Use it to preserve RSP in places where the callee might change the SP. 2625 // Use it to preserve RSP in places where the callee might change the SP.
2638 __ movptr(rbp, rsp); 2626 __ movptr(rbp_mh_SP_save, rsp);
2639 debug_only(int off1 = cbuf.code_size()); 2627 debug_only(int off1 = cbuf.code_size());
2640 assert(off1 - off0 == preserve_SP_size(), "correct size prediction"); 2628 assert(off1 - off0 == preserve_SP_size(), "correct size prediction");
2641 %} 2629 %}
2642 2630
2643 enc_class restore_SP %{ 2631 enc_class restore_SP %{
2644 MacroAssembler _masm(&cbuf); 2632 MacroAssembler _masm(&cbuf);
2645 __ movptr(rsp, rbp); 2633 __ movptr(rsp, rbp_mh_SP_save);
2646 %} 2634 %}
2647 2635
2648 enc_class Java_Static_Call(method meth) 2636 enc_class Java_Static_Call(method meth)
2649 %{ 2637 %{
2650 // JAVA STATIC CALL 2638 // JAVA STATIC CALL
5125 5113
5126 // Indirect Narrow Oop Plus Offset Operand 5114 // Indirect Narrow Oop Plus Offset Operand
5127 // Note: x86 architecture doesn't support "scale * index + offset" without a base 5115 // Note: x86 architecture doesn't support "scale * index + offset" without a base
5128 // we can't free r12 even with Universe::narrow_oop_base() == NULL. 5116 // we can't free r12 even with Universe::narrow_oop_base() == NULL.
5129 operand indCompressedOopOffset(rRegN reg, immL32 off) %{ 5117 operand indCompressedOopOffset(rRegN reg, immL32 off) %{
5130 predicate(UseCompressedOops && (Universe::narrow_oop_shift() != 0)); 5118 predicate(UseCompressedOops && (Universe::narrow_oop_shift() == Address::times_8));
5131 constraint(ALLOC_IN_RC(ptr_reg)); 5119 constraint(ALLOC_IN_RC(ptr_reg));
5132 match(AddP (DecodeN reg) off); 5120 match(AddP (DecodeN reg) off);
5133 5121
5134 op_cost(10); 5122 op_cost(10);
5135 format %{"[R12 + $reg << 3 + $off] (compressed oop addressing)" %} 5123 format %{"[R12 + $reg << 3 + $off] (compressed oop addressing)" %}
7740 __ decode_heap_oop(d); 7728 __ decode_heap_oop(d);
7741 %} 7729 %}
7742 ins_pipe(ialu_reg_long); 7730 ins_pipe(ialu_reg_long);
7743 %} 7731 %}
7744 7732
7745 instruct decodeHeapOop_not_null(rRegP dst, rRegN src) %{ 7733 instruct decodeHeapOop_not_null(rRegP dst, rRegN src, rFlagsReg cr) %{
7746 predicate(n->bottom_type()->is_oopptr()->ptr() == TypePtr::NotNull || 7734 predicate(n->bottom_type()->is_oopptr()->ptr() == TypePtr::NotNull ||
7747 n->bottom_type()->is_oopptr()->ptr() == TypePtr::Constant); 7735 n->bottom_type()->is_oopptr()->ptr() == TypePtr::Constant);
7748 match(Set dst (DecodeN src)); 7736 match(Set dst (DecodeN src));
7737 effect(KILL cr);
7749 format %{ "decode_heap_oop_not_null $dst,$src" %} 7738 format %{ "decode_heap_oop_not_null $dst,$src" %}
7750 ins_encode %{ 7739 ins_encode %{
7751 Register s = $src$$Register; 7740 Register s = $src$$Register;
7752 Register d = $dst$$Register; 7741 Register d = $dst$$Register;
7753 if (s != d) { 7742 if (s != d) {
12602 %} 12591 %}
12603 12592
12604 // Call Java Static Instruction (method handle version) 12593 // Call Java Static Instruction (method handle version)
12605 // Note: If this code changes, the corresponding ret_addr_offset() and 12594 // Note: If this code changes, the corresponding ret_addr_offset() and
12606 // compute_padding() functions will have to be adjusted. 12595 // compute_padding() functions will have to be adjusted.
12607 instruct CallStaticJavaHandle(method meth, rbp_RegP rbp) %{ 12596 instruct CallStaticJavaHandle(method meth, rbp_RegP rbp_mh_SP_save) %{
12608 match(CallStaticJava); 12597 match(CallStaticJava);
12609 predicate(((CallStaticJavaNode*) n)->is_method_handle_invoke()); 12598 predicate(((CallStaticJavaNode*) n)->is_method_handle_invoke());
12610 effect(USE meth); 12599 effect(USE meth);
12611 // RBP is saved by all callees (for interpreter stack correction). 12600 // RBP is saved by all callees (for interpreter stack correction).
12612 // We use it here for a similar purpose, in {preserve,restore}_SP. 12601 // We use it here for a similar purpose, in {preserve,restore}_SP.