Mercurial > hg > graal-jvmci-8
comparison src/cpu/x86/vm/c1_Runtime1_x86.cpp @ 362:f8199438385b
Merge
author | apetrusenko |
---|---|
date | Wed, 17 Sep 2008 16:49:18 +0400 |
parents | dc7f315e41f7 37f87013dfd8 |
children | eb28cf662f56 |
comparison
equal
deleted
inserted
replaced
316:5fa96a5a7e76 | 362:f8199438385b |
---|---|
1581 __ pop(rsi); | 1581 __ pop(rsi); |
1582 __ ret(0); | 1582 __ ret(0); |
1583 } | 1583 } |
1584 break; | 1584 break; |
1585 | 1585 |
1586 #ifndef SERIALGC | |
1587 case g1_pre_barrier_slow_id: | |
1588 { | |
1589 StubFrame f(sasm, "g1_pre_barrier", dont_gc_arguments); | |
1590 // arg0 : previous value of memory | |
1591 | |
1592 BarrierSet* bs = Universe::heap()->barrier_set(); | |
1593 if (bs->kind() != BarrierSet::G1SATBCTLogging) { | |
1594 __ movptr(rax, (int)id); | |
1595 __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), rax); | |
1596 __ should_not_reach_here(); | |
1597 break; | |
1598 } | |
1599 | |
1600 __ push(rax); | |
1601 __ push(rdx); | |
1602 | |
1603 const Register pre_val = rax; | |
1604 const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread); | |
1605 const Register tmp = rdx; | |
1606 | |
1607 NOT_LP64(__ get_thread(thread);) | |
1608 | |
1609 Address in_progress(thread, in_bytes(JavaThread::satb_mark_queue_offset() + | |
1610 PtrQueue::byte_offset_of_active())); | |
1611 | |
1612 Address queue_index(thread, in_bytes(JavaThread::satb_mark_queue_offset() + | |
1613 PtrQueue::byte_offset_of_index())); | |
1614 Address buffer(thread, in_bytes(JavaThread::satb_mark_queue_offset() + | |
1615 PtrQueue::byte_offset_of_buf())); | |
1616 | |
1617 | |
1618 Label done; | |
1619 Label runtime; | |
1620 | |
1621 // Can we store original value in the thread's buffer? | |
1622 | |
1623 LP64_ONLY(__ movslq(tmp, queue_index);) | |
1624 #ifdef _LP64 | |
1625 __ cmpq(tmp, 0); | |
1626 #else | |
1627 __ cmpl(queue_index, 0); | |
1628 #endif | |
1629 __ jcc(Assembler::equal, runtime); | |
1630 #ifdef _LP64 | |
1631 __ subq(tmp, wordSize); | |
1632 __ movl(queue_index, tmp); | |
1633 __ addq(tmp, buffer); | |
1634 #else | |
1635 __ subl(queue_index, wordSize); | |
1636 __ movl(tmp, buffer); | |
1637 __ addl(tmp, queue_index); | |
1638 #endif | |
1639 | |
1640 // prev_val (rax) | |
1641 f.load_argument(0, pre_val); | |
1642 __ movptr(Address(tmp, 0), pre_val); | |
1643 __ jmp(done); | |
1644 | |
1645 __ bind(runtime); | |
1646 // load the pre-value | |
1647 __ push(rcx); | |
1648 f.load_argument(0, rcx); | |
1649 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), rcx, thread); | |
1650 __ pop(rcx); | |
1651 | |
1652 __ bind(done); | |
1653 __ pop(rdx); | |
1654 __ pop(rax); | |
1655 } | |
1656 break; | |
1657 | |
1658 case g1_post_barrier_slow_id: | |
1659 { | |
1660 StubFrame f(sasm, "g1_post_barrier", dont_gc_arguments); | |
1661 | |
1662 | |
1663 // arg0: store_address | |
1664 Address store_addr(rbp, 2*BytesPerWord); | |
1665 | |
1666 BarrierSet* bs = Universe::heap()->barrier_set(); | |
1667 CardTableModRefBS* ct = (CardTableModRefBS*)bs; | |
1668 Label done; | |
1669 Label runtime; | |
1670 | |
1671 // At this point we know new_value is non-NULL and the new_value crosses regsion. | |
1672 // Must check to see if card is already dirty | |
1673 | |
1674 const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread); | |
1675 | |
1676 Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() + | |
1677 PtrQueue::byte_offset_of_index())); | |
1678 Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() + | |
1679 PtrQueue::byte_offset_of_buf())); | |
1680 | |
1681 __ push(rax); | |
1682 __ push(rdx); | |
1683 | |
1684 NOT_LP64(__ get_thread(thread);) | |
1685 ExternalAddress cardtable((address)ct->byte_map_base); | |
1686 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); | |
1687 | |
1688 const Register card_addr = rdx; | |
1689 #ifdef _LP64 | |
1690 const Register tmp = rscratch1; | |
1691 f.load_argument(0, card_addr); | |
1692 __ shrq(card_addr, CardTableModRefBS::card_shift); | |
1693 __ lea(tmp, cardtable); | |
1694 // get the address of the card | |
1695 __ addq(card_addr, tmp); | |
1696 #else | |
1697 const Register card_index = rdx; | |
1698 f.load_argument(0, card_index); | |
1699 __ shrl(card_index, CardTableModRefBS::card_shift); | |
1700 | |
1701 Address index(noreg, card_index, Address::times_1); | |
1702 __ leal(card_addr, __ as_Address(ArrayAddress(cardtable, index))); | |
1703 #endif | |
1704 | |
1705 __ cmpb(Address(card_addr, 0), 0); | |
1706 __ jcc(Assembler::equal, done); | |
1707 | |
1708 // storing region crossing non-NULL, card is clean. | |
1709 // dirty card and log. | |
1710 | |
1711 __ movb(Address(card_addr, 0), 0); | |
1712 | |
1713 __ cmpl(queue_index, 0); | |
1714 __ jcc(Assembler::equal, runtime); | |
1715 __ subl(queue_index, wordSize); | |
1716 | |
1717 const Register buffer_addr = rbx; | |
1718 __ push(rbx); | |
1719 | |
1720 __ movptr(buffer_addr, buffer); | |
1721 | |
1722 #ifdef _LP64 | |
1723 __ movslq(rscratch1, queue_index); | |
1724 __ addptr(buffer_addr, rscratch1); | |
1725 #else | |
1726 __ addptr(buffer_addr, queue_index); | |
1727 #endif | |
1728 __ movptr(Address(buffer_addr, 0), card_addr); | |
1729 | |
1730 __ pop(rbx); | |
1731 __ jmp(done); | |
1732 | |
1733 __ bind(runtime); | |
1734 NOT_LP64(__ push(rcx);) | |
1735 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread); | |
1736 NOT_LP64(__ pop(rcx);) | |
1737 | |
1738 __ bind(done); | |
1739 __ pop(rdx); | |
1740 __ pop(rax); | |
1741 | |
1742 } | |
1743 break; | |
1744 #endif // !SERIALGC | |
1745 | |
1586 default: | 1746 default: |
1587 { StubFrame f(sasm, "unimplemented entry", dont_gc_arguments); | 1747 { StubFrame f(sasm, "unimplemented entry", dont_gc_arguments); |
1588 __ movptr(rax, (int)id); | 1748 __ movptr(rax, (int)id); |
1589 __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), rax); | 1749 __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), rax); |
1590 __ should_not_reach_here(); | 1750 __ should_not_reach_here(); |