1702 __ pop(r8); 1703 #endif 1704 __ pop(rcx); 1705 __ bind(done); 1706 1707 __ pop(rdx); 1708 __ pop(rax); 1709 } 1710 break; 1711 1712 case g1_post_barrier_slow_id: 1713 { 1714 StubFrame f(sasm, "g1_post_barrier", dont_gc_arguments); 1715 1716 1717 // arg0: store_address 1718 Address store_addr(rbp, 2*BytesPerWord); 1719 1720 BarrierSet* bs = Universe::heap()->barrier_set(); 1721 CardTableModRefBS* ct = (CardTableModRefBS*)bs; 1722 Label done; 1723 Label runtime; 1724 1725 // At this point we know new_value is non-NULL and the new_value crosses regsion. 1726 // Must check to see if card is already dirty 1727 1728 const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread); 1729 1730 Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() + 1731 PtrQueue::byte_offset_of_index())); 1732 Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() + 1733 PtrQueue::byte_offset_of_buf())); 1734 1735 __ push(rax); 1736 __ push(rcx); 1737 1738 NOT_LP64(__ get_thread(thread);) 1739 ExternalAddress cardtable((address)ct->byte_map_base); 1740 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); 1741 1742 const Register card_addr = rcx; 1743 #ifdef _LP64 1744 const Register tmp = rscratch1; 1745 f.load_argument(0, card_addr); 1746 __ shrq(card_addr, CardTableModRefBS::card_shift); 1747 __ lea(tmp, cardtable); 1748 // get the address of the card 1749 __ addq(card_addr, tmp); 1750 #else 1751 const Register card_index = rcx; 1752 f.load_argument(0, card_index); 1753 __ shrl(card_index, CardTableModRefBS::card_shift); 1754 1755 Address index(noreg, card_index, Address::times_1); 1756 __ leal(card_addr, __ as_Address(ArrayAddress(cardtable, index))); 1757 #endif 1758 1759 __ cmpb(Address(card_addr, 0), (int)G1SATBCardTableModRefBS::g1_young_card_val()); 1760 __ jcc(Assembler::equal, done); 1761 1762 __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad)); 1763 __ cmpb(Address(card_addr, 0), (int)CardTableModRefBS::dirty_card_val()); 1764 __ jcc(Assembler::equal, done); 1765 1766 // storing region crossing non-NULL, card is clean. 1767 // dirty card and log. 1768 1769 __ movb(Address(card_addr, 0), (int)CardTableModRefBS::dirty_card_val()); 1770 1771 __ cmpl(queue_index, 0); 1772 __ jcc(Assembler::equal, runtime); 1773 __ subl(queue_index, wordSize); 1774 1775 const Register buffer_addr = rbx; 1776 __ push(rbx); 1777 | 1702 __ pop(r8); 1703 #endif 1704 __ pop(rcx); 1705 __ bind(done); 1706 1707 __ pop(rdx); 1708 __ pop(rax); 1709 } 1710 break; 1711 1712 case g1_post_barrier_slow_id: 1713 { 1714 StubFrame f(sasm, "g1_post_barrier", dont_gc_arguments); 1715 1716 1717 // arg0: store_address 1718 Address store_addr(rbp, 2*BytesPerWord); 1719 1720 BarrierSet* bs = Universe::heap()->barrier_set(); 1721 CardTableModRefBS* ct = (CardTableModRefBS*)bs; 1722 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); 1723 1724 Label done; 1725 Label runtime; 1726 1727 // At this point we know new_value is non-NULL and the new_value crosses regions. 1728 // Must check to see if card is already dirty 1729 1730 const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread); 1731 1732 Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() + 1733 PtrQueue::byte_offset_of_index())); 1734 Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() + 1735 PtrQueue::byte_offset_of_buf())); 1736 1737 __ push(rax); 1738 __ push(rcx); 1739 1740 const Register cardtable = rax; 1741 const Register card_addr = rcx; 1742 1743 f.load_argument(0, card_addr); 1744 __ shrptr(card_addr, CardTableModRefBS::card_shift); 1745 // Do not use ExternalAddress to load 'byte_map_base', since 'byte_map_base' is NOT 1746 // a valid address and therefore is not properly handled by the relocation code. See 8028109. 1747 __ movptr(cardtable, (intptr_t)ct->byte_map_base); 1748 __ addptr(card_addr, cardtable); 1749 1750 NOT_LP64(__ get_thread(thread);) 1751 1752 __ cmpb(Address(card_addr, 0), (int)G1SATBCardTableModRefBS::g1_young_card_val()); 1753 __ jcc(Assembler::equal, done); 1754 1755 __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad)); 1756 __ cmpb(Address(card_addr, 0), (int)CardTableModRefBS::dirty_card_val()); 1757 __ jcc(Assembler::equal, done); 1758 1759 // storing region crossing non-NULL, card is clean. 1760 // dirty card and log. 1761 1762 __ movb(Address(card_addr, 0), (int)CardTableModRefBS::dirty_card_val()); 1763 1764 __ cmpl(queue_index, 0); 1765 __ jcc(Assembler::equal, runtime); 1766 __ subl(queue_index, wordSize); 1767 1768 const Register buffer_addr = rbx; 1769 __ push(rbx); 1770 |