1624 {
1625 StubFrame f(sasm, "g1_pre_barrier", dont_gc_arguments);
1626 // arg0 : previous value of memory
1627
1628 BarrierSet* bs = Universe::heap()->barrier_set();
1629 if (bs->kind() != BarrierSet::G1SATBCTLogging) {
1630 __ movptr(rax, (int)id);
1631 __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), rax);
1632 __ should_not_reach_here();
1633 break;
1634 }
1635 __ push(rax);
1636 __ push(rdx);
1637
1638 const Register pre_val = rax;
1639 const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
1640 const Register tmp = rdx;
1641
1642 NOT_LP64(__ get_thread(thread);)
1643
1644 Address in_progress(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
1645 PtrQueue::byte_offset_of_active()));
1646
1647 Address queue_index(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
1648 PtrQueue::byte_offset_of_index()));
1649 Address buffer(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
1650 PtrQueue::byte_offset_of_buf()));
1651
1652
1653 Label done;
1654 Label runtime;
1655
1656 // Can we store original value in the thread's buffer?
1657
1658 #ifdef _LP64
1659 __ movslq(tmp, queue_index);
1660 __ cmpq(tmp, 0);
1661 #else
1662 __ cmpl(queue_index, 0);
1663 #endif
1664 __ jcc(Assembler::equal, runtime);
1665 #ifdef _LP64
1666 __ subq(tmp, wordSize);
1667 __ movl(queue_index, tmp);
1668 __ addq(tmp, buffer);
1669 #else
1670 __ subl(queue_index, wordSize);
1671 __ movl(tmp, buffer);
1672 __ addl(tmp, queue_index);
1673 #endif
1674
1675 // prev_val (rax)
1676 f.load_argument(0, pre_val);
1677 __ movptr(Address(tmp, 0), pre_val);
1678 __ jmp(done);
1679
1680 __ bind(runtime);
1681 __ push(rcx);
1682 #ifdef _LP64
1683 __ push(r8);
1684 __ push(r9);
1685 __ push(r10);
1686 __ push(r11);
1687 # ifndef _WIN64
1688 __ push(rdi);
1689 __ push(rsi);
1690 # endif
1691 #endif
1692 // load the pre-value
1693 f.load_argument(0, rcx);
1706 __ bind(done);
1707
1708 __ pop(rdx);
1709 __ pop(rax);
1710 }
1711 break;
1712
1713 case g1_post_barrier_slow_id:
1714 {
1715 StubFrame f(sasm, "g1_post_barrier", dont_gc_arguments);
1716
1717
1718 // arg0: store_address
1719 Address store_addr(rbp, 2*BytesPerWord);
1720
1721 CardTableModRefBS* ct =
1722 barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
1723 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
1724
1725 Label done;
1726 Label runtime;
1727
1728 // At this point we know new_value is non-NULL and the new_value crosses regions.
1729 // Must check to see if card is already dirty
1730
1731 const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
1732
1733 Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
1734 PtrQueue::byte_offset_of_index()));
1735 Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
1736 PtrQueue::byte_offset_of_buf()));
1737
1738 __ push(rax);
1739 __ push(rcx);
1740
1741 const Register cardtable = rax;
1742 const Register card_addr = rcx;
1743
1744 f.load_argument(0, card_addr);
1745 __ shrptr(card_addr, CardTableModRefBS::card_shift);
1746 // Do not use ExternalAddress to load 'byte_map_base', since 'byte_map_base' is NOT
1747 // a valid address and therefore is not properly handled by the relocation code.
1748 __ movptr(cardtable, (intptr_t)ct->byte_map_base);
1749 __ addptr(card_addr, cardtable);
1750
1751 NOT_LP64(__ get_thread(thread);)
1752
1753 __ cmpb(Address(card_addr, 0), (int)G1SATBCardTableModRefBS::g1_young_card_val());
1754 __ jcc(Assembler::equal, done);
1755
1756 __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad));
1757 __ cmpb(Address(card_addr, 0), (int)CardTableModRefBS::dirty_card_val());
1758 __ jcc(Assembler::equal, done);
1759
1760 // storing region crossing non-NULL, card is clean.
1761 // dirty card and log.
1762
1763 __ movb(Address(card_addr, 0), (int)CardTableModRefBS::dirty_card_val());
1764
1765 __ cmpl(queue_index, 0);
1766 __ jcc(Assembler::equal, runtime);
1767 __ subl(queue_index, wordSize);
1768
1769 const Register buffer_addr = rbx;
1770 __ push(rbx);
1771
1772 __ movptr(buffer_addr, buffer);
1773
1774 #ifdef _LP64
1775 __ movslq(rscratch1, queue_index);
1776 __ addptr(buffer_addr, rscratch1);
1777 #else
1778 __ addptr(buffer_addr, queue_index);
1779 #endif
1780 __ movptr(Address(buffer_addr, 0), card_addr);
1781
1782 __ pop(rbx);
1783 __ jmp(done);
1784
1785 __ bind(runtime);
1786 __ push(rdx);
1787 #ifdef _LP64
1788 __ push(r8);
1789 __ push(r9);
1790 __ push(r10);
1791 __ push(r11);
1792 # ifndef _WIN64
1793 __ push(rdi);
1794 __ push(rsi);
1795 # endif
1796 #endif
1797 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread);
1798 #ifdef _LP64
1799 # ifndef _WIN64
1800 __ pop(rsi);
1801 __ pop(rdi);
1802 # endif
1803 __ pop(r11);
1804 __ pop(r10);
1805 __ pop(r9);
1806 __ pop(r8);
1807 #endif
1808 __ pop(rdx);
1809 __ bind(done);
1810
1811 __ pop(rcx);
1812 __ pop(rax);
1813
1814 }
1815 break;
1816 #endif // INCLUDE_ALL_GCS
1817
1818 case predicate_failed_trap_id:
1819 {
1820 StubFrame f(sasm, "predicate_failed_trap", dont_gc_arguments);
1821
1822 OopMap* map = save_live_registers(sasm, 1);
1823
1824 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, predicate_failed_trap));
1825 oop_maps = new OopMapSet();
1826 oop_maps->add_gc_map(call_offset, map);
1827 restore_live_registers(sasm);
1828 __ leave();
1829 DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob();
1830 assert(deopt_blob != NULL, "deoptimization blob must have been created");
1831
1832 __ jump(RuntimeAddress(deopt_blob->unpack_with_reexecution()));
1833 }
|
1624 {
1625 StubFrame f(sasm, "g1_pre_barrier", dont_gc_arguments);
1626 // arg0 : previous value of memory
1627
1628 BarrierSet* bs = Universe::heap()->barrier_set();
1629 if (bs->kind() != BarrierSet::G1SATBCTLogging) {
1630 __ movptr(rax, (int)id);
1631 __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), rax);
1632 __ should_not_reach_here();
1633 break;
1634 }
1635 __ push(rax);
1636 __ push(rdx);
1637
1638 const Register pre_val = rax;
1639 const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
1640 const Register tmp = rdx;
1641
1642 NOT_LP64(__ get_thread(thread);)
1643
1644 Address queue_index(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
1645 PtrQueue::byte_offset_of_index()));
1646 Address buffer(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
1647 PtrQueue::byte_offset_of_buf()));
1648
1649 Label done;
1650 Label runtime;
1651
1652 // Can we store original value in the thread's buffer?
1653
1654 __ movptr(tmp, queue_index);
1655 __ testptr(tmp, tmp);
1656 __ jcc(Assembler::zero, runtime);
1657 __ subptr(tmp, wordSize);
1658 __ movptr(queue_index, tmp);
1659 __ addptr(tmp, buffer);
1660
1661 // prev_val (rax)
1662 f.load_argument(0, pre_val);
1663 __ movptr(Address(tmp, 0), pre_val);
1664 __ jmp(done);
1665
1666 __ bind(runtime);
1667 __ push(rcx);
1668 #ifdef _LP64
1669 __ push(r8);
1670 __ push(r9);
1671 __ push(r10);
1672 __ push(r11);
1673 # ifndef _WIN64
1674 __ push(rdi);
1675 __ push(rsi);
1676 # endif
1677 #endif
1678 // load the pre-value
1679 f.load_argument(0, rcx);
1692 __ bind(done);
1693
1694 __ pop(rdx);
1695 __ pop(rax);
1696 }
1697 break;
1698
1699 case g1_post_barrier_slow_id:
1700 {
1701 StubFrame f(sasm, "g1_post_barrier", dont_gc_arguments);
1702
1703
1704 // arg0: store_address
1705 Address store_addr(rbp, 2*BytesPerWord);
1706
1707 CardTableModRefBS* ct =
1708 barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
1709 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
1710
1711 Label done;
1712 Label enqueued;
1713 Label runtime;
1714
1715 // At this point we know new_value is non-NULL and the new_value crosses regions.
1716 // Must check to see if card is already dirty
1717
1718 const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
1719
1720 Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
1721 PtrQueue::byte_offset_of_index()));
1722 Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
1723 PtrQueue::byte_offset_of_buf()));
1724
1725 __ push(rax);
1726 __ push(rcx);
1727
1728 const Register cardtable = rax;
1729 const Register card_addr = rcx;
1730
1731 f.load_argument(0, card_addr);
1732 __ shrptr(card_addr, CardTableModRefBS::card_shift);
1733 // Do not use ExternalAddress to load 'byte_map_base', since 'byte_map_base' is NOT
1734 // a valid address and therefore is not properly handled by the relocation code.
1735 __ movptr(cardtable, (intptr_t)ct->byte_map_base);
1736 __ addptr(card_addr, cardtable);
1737
1738 NOT_LP64(__ get_thread(thread);)
1739
1740 __ cmpb(Address(card_addr, 0), (int)G1SATBCardTableModRefBS::g1_young_card_val());
1741 __ jcc(Assembler::equal, done);
1742
1743 __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad));
1744 __ cmpb(Address(card_addr, 0), (int)CardTableModRefBS::dirty_card_val());
1745 __ jcc(Assembler::equal, done);
1746
1747 // storing region crossing non-NULL, card is clean.
1748 // dirty card and log.
1749
1750 __ movb(Address(card_addr, 0), (int)CardTableModRefBS::dirty_card_val());
1751
1752 const Register tmp = rdx;
1753 __ push(rdx);
1754
1755 __ movptr(tmp, queue_index);
1756 __ testptr(tmp, tmp);
1757 __ jcc(Assembler::zero, runtime);
1758 __ subptr(tmp, wordSize);
1759 __ movptr(queue_index, tmp);
1760 __ addptr(tmp, buffer);
1761 __ movptr(Address(tmp, 0), card_addr);
1762 __ jmp(enqueued);
1763
1764 __ bind(runtime);
1765 #ifdef _LP64
1766 __ push(r8);
1767 __ push(r9);
1768 __ push(r10);
1769 __ push(r11);
1770 # ifndef _WIN64
1771 __ push(rdi);
1772 __ push(rsi);
1773 # endif
1774 #endif
1775 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread);
1776 #ifdef _LP64
1777 # ifndef _WIN64
1778 __ pop(rsi);
1779 __ pop(rdi);
1780 # endif
1781 __ pop(r11);
1782 __ pop(r10);
1783 __ pop(r9);
1784 __ pop(r8);
1785 #endif
1786 __ bind(enqueued);
1787 __ pop(rdx);
1788
1789 __ bind(done);
1790 __ pop(rcx);
1791 __ pop(rax);
1792 }
1793 break;
1794 #endif // INCLUDE_ALL_GCS
1795
1796 case predicate_failed_trap_id:
1797 {
1798 StubFrame f(sasm, "predicate_failed_trap", dont_gc_arguments);
1799
1800 OopMap* map = save_live_registers(sasm, 1);
1801
1802 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, predicate_failed_trap));
1803 oop_maps = new OopMapSet();
1804 oop_maps->add_gc_map(call_offset, map);
1805 restore_live_registers(sasm);
1806 __ leave();
1807 DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob();
1808 assert(deopt_blob != NULL, "deoptimization blob must have been created");
1809
1810 __ jump(RuntimeAddress(deopt_blob->unpack_with_reexecution()));
1811 }
|