comparison src/cpu/x86/vm/c1_Runtime1_x86.cpp @ 1930:2d26b0046e0d

Merge.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Tue, 30 Nov 2010 14:53:30 +0100
parents 8cfe3537a0d3 d5d065957597
children 00bc9eaf0e24
comparison
equal deleted inserted replaced
1484:6b7001391c97 1930:2d26b0046e0d
1 /* 1 /*
2 * Copyright 1999-2010 Sun Microsystems, Inc. All Rights Reserved. 2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
14 * 14 *
15 * You should have received a copy of the GNU General Public License version 15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation, 16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 * 18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * CA 95054 USA or visit www.sun.com if you need additional information or 20 * or visit www.oracle.com if you need additional information or have any
21 * have any questions. 21 * questions.
22 * 22 *
23 */ 23 */
24 24
25 #include "incls/_precompiled.incl" 25 #include "incls/_precompiled.incl"
26 #include "incls/_c1_Runtime1_x86.cpp.incl" 26 #include "incls/_c1_Runtime1_x86.cpp.incl"
868 __ pop(exception_pc); 868 __ pop(exception_pc);
869 869
870 // Restore SP from BP if the exception PC is a MethodHandle call site. 870 // Restore SP from BP if the exception PC is a MethodHandle call site.
871 NOT_LP64(__ get_thread(thread);) 871 NOT_LP64(__ get_thread(thread);)
872 __ cmpl(Address(thread, JavaThread::is_method_handle_return_offset()), 0); 872 __ cmpl(Address(thread, JavaThread::is_method_handle_return_offset()), 0);
873 __ cmovptr(Assembler::notEqual, rsp, rbp); 873 __ cmovptr(Assembler::notEqual, rsp, rbp_mh_SP_save);
874 874
875 // continue at exception handler (return address removed) 875 // continue at exception handler (return address removed)
876 // note: do *not* remove arguments when unwinding the 876 // note: do *not* remove arguments when unwinding the
877 // activation since the caller assumes having 877 // activation since the caller assumes having
878 // all arguments on the stack when entering the 878 // all arguments on the stack when entering the
1160 // rax,: new instance 1160 // rax,: new instance
1161 } 1161 }
1162 1162
1163 break; 1163 break;
1164 1164
1165 #ifdef TIERED
1166 case counter_overflow_id: 1165 case counter_overflow_id:
1167 { 1166 {
1168 Register bci = rax; 1167 Register bci = rax, method = rbx;
1169 __ enter(); 1168 __ enter();
1170 OopMap* map = save_live_registers(sasm, 2); 1169 OopMap* map = save_live_registers(sasm, 3);
1171 // Retrieve bci 1170 // Retrieve bci
1172 __ movl(bci, Address(rbp, 2*BytesPerWord)); 1171 __ movl(bci, Address(rbp, 2*BytesPerWord));
1173 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, counter_overflow), bci); 1172 // And a pointer to the methodOop
1173 __ movptr(method, Address(rbp, 3*BytesPerWord));
1174 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, counter_overflow), bci, method);
1174 oop_maps = new OopMapSet(); 1175 oop_maps = new OopMapSet();
1175 oop_maps->add_gc_map(call_offset, map); 1176 oop_maps->add_gc_map(call_offset, map);
1176 restore_live_registers(sasm); 1177 restore_live_registers(sasm);
1177 __ leave(); 1178 __ leave();
1178 __ ret(0); 1179 __ ret(0);
1179 } 1180 }
1180 break; 1181 break;
1181 #endif // TIERED
1182 1182
1183 case new_type_array_id: 1183 case new_type_array_id:
1184 case new_object_array_id: 1184 case new_object_array_id:
1185 { 1185 {
1186 Register length = rbx; // Incoming 1186 Register length = rbx; // Incoming
1681 __ movptr(rax, (int)id); 1681 __ movptr(rax, (int)id);
1682 __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), rax); 1682 __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), rax);
1683 __ should_not_reach_here(); 1683 __ should_not_reach_here();
1684 break; 1684 break;
1685 } 1685 }
1686
1687 __ push(rax); 1686 __ push(rax);
1688 __ push(rdx); 1687 __ push(rdx);
1689 1688
1690 const Register pre_val = rax; 1689 const Register pre_val = rax;
1691 const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread); 1690 const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
1705 Label done; 1704 Label done;
1706 Label runtime; 1705 Label runtime;
1707 1706
1708 // Can we store original value in the thread's buffer? 1707 // Can we store original value in the thread's buffer?
1709 1708
1710 LP64_ONLY(__ movslq(tmp, queue_index);) 1709 #ifdef _LP64
1711 #ifdef _LP64 1710 __ movslq(tmp, queue_index);
1712 __ cmpq(tmp, 0); 1711 __ cmpq(tmp, 0);
1713 #else 1712 #else
1714 __ cmpl(queue_index, 0); 1713 __ cmpl(queue_index, 0);
1715 #endif 1714 #endif
1716 __ jcc(Assembler::equal, runtime); 1715 __ jcc(Assembler::equal, runtime);
1728 f.load_argument(0, pre_val); 1727 f.load_argument(0, pre_val);
1729 __ movptr(Address(tmp, 0), pre_val); 1728 __ movptr(Address(tmp, 0), pre_val);
1730 __ jmp(done); 1729 __ jmp(done);
1731 1730
1732 __ bind(runtime); 1731 __ bind(runtime);
1732 __ push(rcx);
1733 #ifdef _LP64
1734 __ push(r8);
1735 __ push(r9);
1736 __ push(r10);
1737 __ push(r11);
1738 # ifndef _WIN64
1739 __ push(rdi);
1740 __ push(rsi);
1741 # endif
1742 #endif
1733 // load the pre-value 1743 // load the pre-value
1734 __ push(rcx);
1735 f.load_argument(0, rcx); 1744 f.load_argument(0, rcx);
1736 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), rcx, thread); 1745 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), rcx, thread);
1746 #ifdef _LP64
1747 # ifndef _WIN64
1748 __ pop(rsi);
1749 __ pop(rdi);
1750 # endif
1751 __ pop(r11);
1752 __ pop(r10);
1753 __ pop(r9);
1754 __ pop(r8);
1755 #endif
1737 __ pop(rcx); 1756 __ pop(rcx);
1738
1739 __ bind(done); 1757 __ bind(done);
1758
1740 __ pop(rdx); 1759 __ pop(rdx);
1741 __ pop(rax); 1760 __ pop(rax);
1742 } 1761 }
1743 break; 1762 break;
1744 1763
1764 PtrQueue::byte_offset_of_index())); 1783 PtrQueue::byte_offset_of_index()));
1765 Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() + 1784 Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
1766 PtrQueue::byte_offset_of_buf())); 1785 PtrQueue::byte_offset_of_buf()));
1767 1786
1768 __ push(rax); 1787 __ push(rax);
1769 __ push(rdx); 1788 __ push(rcx);
1770 1789
1771 NOT_LP64(__ get_thread(thread);) 1790 NOT_LP64(__ get_thread(thread);)
1772 ExternalAddress cardtable((address)ct->byte_map_base); 1791 ExternalAddress cardtable((address)ct->byte_map_base);
1773 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); 1792 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
1774 1793
1775 const Register card_addr = rdx; 1794 const Register card_addr = rcx;
1776 #ifdef _LP64 1795 #ifdef _LP64
1777 const Register tmp = rscratch1; 1796 const Register tmp = rscratch1;
1778 f.load_argument(0, card_addr); 1797 f.load_argument(0, card_addr);
1779 __ shrq(card_addr, CardTableModRefBS::card_shift); 1798 __ shrq(card_addr, CardTableModRefBS::card_shift);
1780 __ lea(tmp, cardtable); 1799 __ lea(tmp, cardtable);
1781 // get the address of the card 1800 // get the address of the card
1782 __ addq(card_addr, tmp); 1801 __ addq(card_addr, tmp);
1783 #else 1802 #else
1784 const Register card_index = rdx; 1803 const Register card_index = rcx;
1785 f.load_argument(0, card_index); 1804 f.load_argument(0, card_index);
1786 __ shrl(card_index, CardTableModRefBS::card_shift); 1805 __ shrl(card_index, CardTableModRefBS::card_shift);
1787 1806
1788 Address index(noreg, card_index, Address::times_1); 1807 Address index(noreg, card_index, Address::times_1);
1789 __ leal(card_addr, __ as_Address(ArrayAddress(cardtable, index))); 1808 __ leal(card_addr, __ as_Address(ArrayAddress(cardtable, index)));
1816 1835
1817 __ pop(rbx); 1836 __ pop(rbx);
1818 __ jmp(done); 1837 __ jmp(done);
1819 1838
1820 __ bind(runtime); 1839 __ bind(runtime);
1821 NOT_LP64(__ push(rcx);) 1840 __ push(rdx);
1822 //__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread); 1841 #ifdef _LP64
1823 NOT_LP64(__ pop(rcx);) 1842 __ push(r8);
1824 1843 __ push(r9);
1844 __ push(r10);
1845 __ push(r11);
1846 # ifndef _WIN64
1847 __ push(rdi);
1848 __ push(rsi);
1849 # endif
1850 #endif
1851 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread);
1852 #ifdef _LP64
1853 # ifndef _WIN64
1854 __ pop(rsi);
1855 __ pop(rdi);
1856 # endif
1857 __ pop(r11);
1858 __ pop(r10);
1859 __ pop(r9);
1860 __ pop(r8);
1861 #endif
1862 __ pop(rdx);
1825 __ bind(done); 1863 __ bind(done);
1826 __ pop(rdx); 1864
1865 __ pop(rcx);
1827 __ pop(rax); 1866 __ pop(rax);
1828 1867
1829 } 1868 }
1830 break; 1869 break;
1831 #endif // !SERIALGC 1870 #endif // !SERIALGC
2043 } 2082 }
2044 return oop_maps; 2083 return oop_maps;
2045 } 2084 }
2046 2085
2047 #undef __ 2086 #undef __
2087
2088 const char *Runtime1::pd_name_for_address(address entry) {
2089 return "<unknown function>";
2090 }