1717 // arg0: store_address |
1717 // arg0: store_address |
1718 Address store_addr(rbp, 2*BytesPerWord); |
1718 Address store_addr(rbp, 2*BytesPerWord); |
1719 |
1719 |
1720 BarrierSet* bs = Universe::heap()->barrier_set(); |
1720 BarrierSet* bs = Universe::heap()->barrier_set(); |
1721 CardTableModRefBS* ct = (CardTableModRefBS*)bs; |
1721 CardTableModRefBS* ct = (CardTableModRefBS*)bs; |
|
1722 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); |
|
1723 |
1722 Label done; |
1724 Label done; |
1723 Label runtime; |
1725 Label runtime; |
1724 |
1726 |
1725 // At this point we know new_value is non-NULL and the new_value crosses regsion. |
1727 // At this point we know new_value is non-NULL and the new_value crosses regions. |
1726 // Must check to see if card is already dirty |
1728 // Must check to see if card is already dirty |
1727 |
1729 |
1728 const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread); |
1730 const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread); |
1729 |
1731 |
1730 Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() + |
1732 Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() + |
1733 PtrQueue::byte_offset_of_buf())); |
1735 PtrQueue::byte_offset_of_buf())); |
1734 |
1736 |
1735 __ push(rax); |
1737 __ push(rax); |
1736 __ push(rcx); |
1738 __ push(rcx); |
1737 |
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. |
|
1747 __ movptr(cardtable, (intptr_t)ct->byte_map_base); |
|
1748 __ addptr(card_addr, cardtable); |
|
1749 |
1738 NOT_LP64(__ get_thread(thread);) |
1750 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 |
1751 |
1759 __ cmpb(Address(card_addr, 0), (int)G1SATBCardTableModRefBS::g1_young_card_val()); |
1752 __ cmpb(Address(card_addr, 0), (int)G1SATBCardTableModRefBS::g1_young_card_val()); |
1760 __ jcc(Assembler::equal, done); |
1753 __ jcc(Assembler::equal, done); |
1761 |
1754 |
1762 __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad)); |
1755 __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad)); |