src/cpu/mips/vm/macroAssembler_mips.cpp

changeset 8006
b70d88852ac9
parent 8004
941851413ebf
child 8009
0477693968a6
equal deleted inserted replaced
8005:b5abf640a085 8006:b70d88852ac9
1511 PtrQueue::byte_offset_of_buf())); 1511 PtrQueue::byte_offset_of_buf()));
1512 1512
1513 1513
1514 // Is marking active? 1514 // Is marking active?
1515 if (in_bytes(PtrQueue::byte_width_of_active()) == 4) { 1515 if (in_bytes(PtrQueue::byte_width_of_active()) == 4) {
1516 //cmpl(in_progress, 0);
1517 lw(AT, in_progress); 1516 lw(AT, in_progress);
1518 } else { 1517 } else {
1519 assert(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption"); 1518 assert(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption");
1520 //cmpb(in_progress, 0);
1521 lb(AT, in_progress); 1519 lb(AT, in_progress);
1522 } 1520 }
1523 //jcc(Assembler::equal, done);
1524 beq(AT, R0, done); 1521 beq(AT, R0, done);
1525 nop(); 1522 nop();
1526 1523
1527 // Do we need to load the previous value? 1524 // Do we need to load the previous value?
1528 if (obj != noreg) { 1525 if (obj != noreg) {
1529 load_heap_oop(pre_val, Address(obj, 0)); 1526 load_heap_oop(pre_val, Address(obj, 0));
1530 } 1527 }
1531 1528
1532 // Is the previous value null? 1529 // Is the previous value null?
1533 //cmpptr(pre_val, (int32_t) NULL_WORD);
1534 //jcc(Assembler::equal, done);
1535 beq(pre_val, R0, done); 1530 beq(pre_val, R0, done);
1536 nop(); 1531 nop();
1537 1532
1538 // Can we store original value in the thread's buffer? 1533 // Can we store original value in the thread's buffer?
1539 // Is index == 0? 1534 // Is index == 0?
1540 // (The index field is typed as size_t.) 1535 // (The index field is typed as size_t.)
1541 1536
1542 //movptr(tmp, index); // tmp := *index_adr
1543 ld(tmp, index); 1537 ld(tmp, index);
1544 //cmpptr(tmp, 0); // tmp == 0?
1545 //jcc(Assembler::equal, runtime); // If yes, goto runtime
1546 beq(tmp, R0, runtime); 1538 beq(tmp, R0, runtime);
1547 nop(); 1539 nop();
1548 1540
1549 //subptr(tmp, wordSize); // tmp := tmp - wordSize
1550 //movptr(index, tmp); // *index_adr := tmp
1551 //addptr(tmp, buffer); // tmp := tmp + *buffer_adr
1552 daddiu(tmp, tmp, -1 * wordSize); 1541 daddiu(tmp, tmp, -1 * wordSize);
1553 sd(tmp, index); 1542 sd(tmp, index);
1554 ld(AT, buffer); 1543 ld(AT, buffer);
1555 daddu(tmp, tmp, AT); 1544 daddu(tmp, tmp, AT);
1556 1545
1557 // Record the previous value 1546 // Record the previous value
1558 //movptr(Address(tmp, 0), pre_val);
1559 //jmp(done);
1560 sd(pre_val, tmp, 0); 1547 sd(pre_val, tmp, 0);
1561 beq(R0, R0, done); 1548 beq(R0, R0, done);
1562 nop(); 1549 nop();
1563 1550
1564 bind(runtime); 1551 bind(runtime);
1565 // save the live input values 1552 // save the live input values
1566 //if(tosca_live) push(rax); 1553 if (tosca_live) push(V0);
1567 if(tosca_live) push(V0); 1554
1568 1555 if (obj != noreg && obj != V0) push(obj);
1569 //if (obj != noreg && obj != rax) 1556
1570 if (obj != noreg && obj != V0) 1557 if (pre_val != V0) push(pre_val);
1571 push(obj);
1572
1573 //if (pre_val != rax)
1574 if (pre_val != V0)
1575 push(pre_val);
1576 1558
1577 // Calling the runtime using the regular call_VM_leaf mechanism generates 1559 // Calling the runtime using the regular call_VM_leaf mechanism generates
1578 // code (generated by InterpreterMacroAssember::call_VM_leaf_base) 1560 // code (generated by InterpreterMacroAssember::call_VM_leaf_base)
1579 // that checks that the *(ebp+frame::interpreter_frame_last_sp) == NULL. 1561 // that checks that the *(ebp+frame::interpreter_frame_last_sp) == NULL.
1580 // 1562 //
1587 // expand_call should be passed true. 1569 // expand_call should be passed true.
1588 1570
1589 NOT_LP64( push(thread); ) 1571 NOT_LP64( push(thread); )
1590 1572
1591 if (expand_call) { 1573 if (expand_call) {
1592 //LP64_ONLY( assert(pre_val != c_rarg1, "smashed arg"); )
1593 LP64_ONLY( assert(pre_val != A1, "smashed arg"); ) 1574 LP64_ONLY( assert(pre_val != A1, "smashed arg"); )
1594 //pass_arg1(this, thread);
1595 if (thread != A1) move(A1, thread); 1575 if (thread != A1) move(A1, thread);
1596 //pass_arg0(this, pre_val);
1597 if (pre_val != A0) move(A0, pre_val); 1576 if (pre_val != A0) move(A0, pre_val);
1598 MacroAssembler::call_VM_leaf_base(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), 2); 1577 MacroAssembler::call_VM_leaf_base(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), 2);
1599 } else { 1578 } else {
1600 call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), pre_val, thread); 1579 call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), pre_val, thread);
1601 } 1580 }
1602 1581
1603 NOT_LP64( pop(thread); ) 1582 NOT_LP64( pop(thread); )
1604 1583
1605 // save the live input values 1584 // save the live input values
1606 //if (pre_val != rax)
1607 if (pre_val != V0) 1585 if (pre_val != V0)
1608 pop(pre_val); 1586 pop(pre_val);
1609 1587
1610 //if (obj != noreg && obj != rax)
1611 if (obj != noreg && obj != V0) 1588 if (obj != noreg && obj != V0)
1612 pop(obj); 1589 pop(obj);
1613 1590
1614 //if(tosca_live) pop(rax);
1615 if(tosca_live) pop(V0); 1591 if(tosca_live) pop(V0);
1616 1592
1617 bind(done); 1593 bind(done);
1618 } 1594 }
1619 1595
1639 1615
1640 Label done; 1616 Label done;
1641 Label runtime; 1617 Label runtime;
1642 1618
1643 // Does store cross heap regions? 1619 // Does store cross heap regions?
1644
1645 //movptr(tmp, store_addr);
1646 //xorptr(tmp, new_val);
1647 //shrptr(tmp, HeapRegion::LogOfHRGrainBytes);
1648 //jcc(Assembler::equal, done);
1649 xorr(AT, store_addr, new_val); 1620 xorr(AT, store_addr, new_val);
1650 dsrl(AT, AT, HeapRegion::LogOfHRGrainBytes); 1621 dsrl(AT, AT, HeapRegion::LogOfHRGrainBytes);
1651 beq(AT, R0, done); 1622 beq(AT, R0, done);
1652 nop(); 1623 nop();
1653 1624
1654 1625
1655 // crosses regions, storing NULL? 1626 // crosses regions, storing NULL?
1656
1657 //cmpptr(new_val, (int32_t) NULL_WORD);
1658 //jcc(Assembler::equal, done);
1659 beq(new_val, R0, done); 1627 beq(new_val, R0, done);
1660 nop(); 1628 nop();
1661 1629
1662 // storing region crossing non-NULL, is card already dirty? 1630 // storing region crossing non-NULL, is card already dirty?
1663
1664 const Register card_addr = tmp; 1631 const Register card_addr = tmp;
1665 const Register cardtable = tmp2; 1632 const Register cardtable = tmp2;
1666 1633
1667 //movptr(card_addr, store_addr);
1668 //shrptr(card_addr, CardTableModRefBS::card_shift);
1669 move(card_addr, store_addr); 1634 move(card_addr, store_addr);
1670 dsrl(card_addr, card_addr, CardTableModRefBS::card_shift); 1635 dsrl(card_addr, card_addr, CardTableModRefBS::card_shift);
1671 // Do not use ExternalAddress to load 'byte_map_base', since 'byte_map_base' is NOT 1636 // Do not use ExternalAddress to load 'byte_map_base', since 'byte_map_base' is NOT
1672 // a valid address and therefore is not properly handled by the relocation code. 1637 // a valid address and therefore is not properly handled by the relocation code.
1673 //movptr(cardtable, (intptr_t)ct->byte_map_base);
1674 //addptr(card_addr, cardtable);
1675 set64(cardtable, (intptr_t)ct->byte_map_base); 1638 set64(cardtable, (intptr_t)ct->byte_map_base);
1676 daddu(card_addr, card_addr, cardtable); 1639 daddu(card_addr, card_addr, cardtable);
1677 1640
1678 //cmpb(Address(card_addr, 0), (int)G1SATBCardTableModRefBS::g1_young_card_val());
1679 //jcc(Assembler::equal, done);
1680 lb(AT, card_addr, 0); 1641 lb(AT, card_addr, 0);
1681 daddiu(AT, AT, -1 * (int)G1SATBCardTableModRefBS::g1_young_card_val()); 1642 daddiu(AT, AT, -1 * (int)G1SATBCardTableModRefBS::g1_young_card_val());
1682 beq(AT, R0, done); 1643 beq(AT, R0, done);
1683 nop(); 1644 nop();
1684 1645
1685 //membar(Assembler::Membar_mask_bits(Assembler::StoreLoad));
1686 //cmpb(Address(card_addr, 0), (int)CardTableModRefBS::dirty_card_val());
1687 //jcc(Assembler::equal, done);
1688 sync(); 1646 sync();
1689 lb(AT, card_addr, 0); 1647 lb(AT, card_addr, 0);
1690 daddiu(AT, AT, -1 * (int)(int)CardTableModRefBS::dirty_card_val()); 1648 daddiu(AT, AT, -1 * (int)(int)CardTableModRefBS::dirty_card_val());
1691 beq(AT, R0, done); 1649 beq(AT, R0, done);
1692 nop(); 1650 nop();
1693 1651
1694 1652
1695 // storing a region crossing, non-NULL oop, card is clean. 1653 // storing a region crossing, non-NULL oop, card is clean.
1696 // dirty card and log. 1654 // dirty card and log.
1697
1698 //movb(Address(card_addr, 0), (int)CardTableModRefBS::dirty_card_val());
1699 move(AT, (int)CardTableModRefBS::dirty_card_val()); 1655 move(AT, (int)CardTableModRefBS::dirty_card_val());
1700 sb(AT, card_addr, 0); 1656 sb(AT, card_addr, 0);
1701 1657
1702 //cmpl(queue_index, 0);
1703 //jcc(Assembler::equal, runtime);
1704 //subl(queue_index, wordSize);
1705 //movptr(tmp2, buffer);
1706 lw(AT, queue_index); 1658 lw(AT, queue_index);
1707 beq(AT, R0, runtime); 1659 beq(AT, R0, runtime);
1708 nop(); 1660 nop();
1709 daddiu(AT, AT, -1 * wordSize); 1661 daddiu(AT, AT, -1 * wordSize);
1710 sw(AT, queue_index); 1662 sw(AT, queue_index);
1711 ld(tmp2, buffer); 1663 ld(tmp2, buffer);
1712 #ifdef _LP64 1664 #ifdef _LP64
1713 //movslq(rscratch1, queue_index);
1714 //addq(tmp2, rscratch1);
1715 //movq(Address(tmp2, 0), card_addr);
1716 ld(AT, queue_index); 1665 ld(AT, queue_index);
1717 daddu(tmp2, tmp2, AT); 1666 daddu(tmp2, tmp2, AT);
1718 sd(card_addr, tmp2, 0); 1667 sd(card_addr, tmp2, 0);
1719 #else 1668 #else
1720 //addl(tmp2, queue_index);
1721 //movl(Address(tmp2, 0), card_addr);
1722 lw(AT, queue_index); 1669 lw(AT, queue_index);
1723 addu32(tmp2, tmp2, AT); 1670 addu32(tmp2, tmp2, AT);
1724 sw(card_addr, tmp2, 0); 1671 sw(card_addr, tmp2, 0);
1725 #endif 1672 #endif
1726 //jmp(done);
1727 beq(R0, R0, done); 1673 beq(R0, R0, done);
1728 nop(); 1674 nop();
1729 1675
1730 bind(runtime); 1676 bind(runtime);
1731 // save the live input values 1677 // save the live input values

mercurial