src/cpu/x86/vm/c1_Runtime1_x86.cpp

Print this page


   1 /*
   2  * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  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,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


1650 #else
1651         __ cmpl(queue_index, 0);
1652 #endif
1653         __ jcc(Assembler::equal, runtime);
1654 #ifdef _LP64
1655         __ subq(tmp, wordSize);
1656         __ movl(queue_index, tmp);
1657         __ addq(tmp, buffer);
1658 #else
1659         __ subl(queue_index, wordSize);
1660         __ movl(tmp, buffer);
1661         __ addl(tmp, queue_index);
1662 #endif
1663 
1664         // prev_val (rax)
1665         f.load_argument(0, pre_val);
1666         __ movptr(Address(tmp, 0), pre_val);
1667         __ jmp(done);
1668 
1669         __ bind(runtime);
1670         __ push(rcx);
1671 #ifdef _LP64
1672         __ push(r8);
1673         __ push(r9);
1674         __ push(r10);
1675         __ push(r11);
1676 #  ifndef _WIN64
1677         __ push(rdi);
1678         __ push(rsi);
1679 #  endif
1680 #endif
1681         // load the pre-value
1682         f.load_argument(0, rcx);
1683         __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), rcx, thread);
1684 #ifdef _LP64
1685 #  ifndef _WIN64
1686         __ pop(rsi);
1687         __ pop(rdi);
1688 #  endif
1689         __ pop(r11);
1690         __ pop(r10);
1691         __ pop(r9);
1692         __ pop(r8);
1693 #endif
1694         __ pop(rcx);
1695         __ bind(done);
1696 
1697         __ pop(rdx);
1698         __ pop(rax);
1699       }
1700       break;
1701 
1702     case g1_post_barrier_slow_id:
1703       {
1704         StubFrame f(sasm, "g1_post_barrier", dont_gc_arguments);
1705 
1706 
1707         // arg0: store_address
1708         Address store_addr(rbp, 2*BytesPerWord);
1709 
1710         BarrierSet* bs = Universe::heap()->barrier_set();
1711         CardTableModRefBS* ct = (CardTableModRefBS*)bs;
1712         assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
1713 
1714         Label done;


1756         __ subl(queue_index, wordSize);
1757 
1758         const Register buffer_addr = rbx;
1759         __ push(rbx);
1760 
1761         __ movptr(buffer_addr, buffer);
1762 
1763 #ifdef _LP64
1764         __ movslq(rscratch1, queue_index);
1765         __ addptr(buffer_addr, rscratch1);
1766 #else
1767         __ addptr(buffer_addr, queue_index);
1768 #endif
1769         __ movptr(Address(buffer_addr, 0), card_addr);
1770 
1771         __ pop(rbx);
1772         __ jmp(done);
1773 
1774         __ bind(runtime);
1775         __ push(rdx);
1776 #ifdef _LP64
1777         __ push(r8);
1778         __ push(r9);
1779         __ push(r10);
1780         __ push(r11);
1781 #  ifndef _WIN64
1782         __ push(rdi);
1783         __ push(rsi);
1784 #  endif
1785 #endif
1786         __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread);
1787 #ifdef _LP64
1788 #  ifndef _WIN64
1789         __ pop(rsi);
1790         __ pop(rdi);
1791 #  endif
1792         __ pop(r11);
1793         __ pop(r10);
1794         __ pop(r9);
1795         __ pop(r8);
1796 #endif
1797         __ pop(rdx);
1798         __ bind(done);
1799 
1800         __ pop(rcx);
1801         __ pop(rax);
1802 
1803       }
1804       break;
1805 #endif // INCLUDE_ALL_GCS
1806 
1807     case predicate_failed_trap_id:
1808       {
1809         StubFrame f(sasm, "predicate_failed_trap", dont_gc_arguments);
1810 
1811         OopMap* map = save_live_registers(sasm, 1);
1812 
1813         int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, predicate_failed_trap));
1814         oop_maps = new OopMapSet();
1815         oop_maps->add_gc_map(call_offset, map);
1816         restore_live_registers(sasm);


   1 /*
   2  * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  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,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


1650 #else
1651         __ cmpl(queue_index, 0);
1652 #endif
1653         __ jcc(Assembler::equal, runtime);
1654 #ifdef _LP64
1655         __ subq(tmp, wordSize);
1656         __ movl(queue_index, tmp);
1657         __ addq(tmp, buffer);
1658 #else
1659         __ subl(queue_index, wordSize);
1660         __ movl(tmp, buffer);
1661         __ addl(tmp, queue_index);
1662 #endif
1663 
1664         // prev_val (rax)
1665         f.load_argument(0, pre_val);
1666         __ movptr(Address(tmp, 0), pre_val);
1667         __ jmp(done);
1668 
1669         __ bind(runtime);
1670 
1671         save_live_registers(sasm, 3);
1672 








1673         // load the pre-value
1674         f.load_argument(0, rcx);
1675         __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), rcx, thread);
1676 
1677         restore_live_registers(sasm);
1678 








1679         __ bind(done);
1680 
1681         __ pop(rdx);
1682         __ pop(rax);
1683       }
1684       break;
1685 
1686     case g1_post_barrier_slow_id:
1687       {
1688         StubFrame f(sasm, "g1_post_barrier", dont_gc_arguments);
1689 
1690 
1691         // arg0: store_address
1692         Address store_addr(rbp, 2*BytesPerWord);
1693 
1694         BarrierSet* bs = Universe::heap()->barrier_set();
1695         CardTableModRefBS* ct = (CardTableModRefBS*)bs;
1696         assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
1697 
1698         Label done;


1740         __ subl(queue_index, wordSize);
1741 
1742         const Register buffer_addr = rbx;
1743         __ push(rbx);
1744 
1745         __ movptr(buffer_addr, buffer);
1746 
1747 #ifdef _LP64
1748         __ movslq(rscratch1, queue_index);
1749         __ addptr(buffer_addr, rscratch1);
1750 #else
1751         __ addptr(buffer_addr, queue_index);
1752 #endif
1753         __ movptr(Address(buffer_addr, 0), card_addr);
1754 
1755         __ pop(rbx);
1756         __ jmp(done);
1757 
1758         __ bind(runtime);
1759         __ push(rdx);
1760 
1761         save_live_registers(sasm, 3);
1762 







1763         __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread);
1764 
1765         restore_live_registers(sasm);
1766 







1767         __ pop(rdx);
1768         __ bind(done);
1769 
1770         __ pop(rcx);
1771         __ pop(rax);
1772 
1773       }
1774       break;
1775 #endif // INCLUDE_ALL_GCS
1776 
1777     case predicate_failed_trap_id:
1778       {
1779         StubFrame f(sasm, "predicate_failed_trap", dont_gc_arguments);
1780 
1781         OopMap* map = save_live_registers(sasm, 1);
1782 
1783         int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, predicate_failed_trap));
1784         oop_maps = new OopMapSet();
1785         oop_maps->add_gc_map(call_offset, map);
1786         restore_live_registers(sasm);