1 /*
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
1511 Node* adr,
1512 uint adr_idx,
1513 Node* val,
1514 const TypeOopPtr* val_type,
1515 Node* pre_val,
1516 BasicType bt) {
1517
1518 BarrierSet* bs = Universe::heap()->barrier_set();
1519 set_control(ctl);
1520 switch (bs->kind()) {
1521 case BarrierSet::G1SATBCT:
1522 case BarrierSet::G1SATBCTLogging:
1523 g1_write_barrier_pre(do_load, obj, adr, adr_idx, val, val_type, pre_val, bt);
1524 break;
1525
1526 case BarrierSet::CardTableModRef:
1527 case BarrierSet::CardTableExtension:
1528 case BarrierSet::ModRef:
1529 break;
1530
1531 case BarrierSet::Other:
1532 default :
1533 ShouldNotReachHere();
1534
1535 }
1536 }
1537
1538 bool GraphKit::can_move_pre_barrier() const {
1539 BarrierSet* bs = Universe::heap()->barrier_set();
1540 switch (bs->kind()) {
1541 case BarrierSet::G1SATBCT:
1542 case BarrierSet::G1SATBCTLogging:
1543 return true; // Can move it if no safepoint
1544
1545 case BarrierSet::CardTableModRef:
1546 case BarrierSet::CardTableExtension:
1547 case BarrierSet::ModRef:
1548 return true; // There is no pre-barrier
1549
1550 case BarrierSet::Other:
1551 default :
1552 ShouldNotReachHere();
1553 }
1554 return false;
1555 }
1556
1557 void GraphKit::post_barrier(Node* ctl,
1558 Node* store,
1559 Node* obj,
1560 Node* adr,
1561 uint adr_idx,
1562 Node* val,
1563 BasicType bt,
1564 bool use_precise) {
1565 BarrierSet* bs = Universe::heap()->barrier_set();
1566 set_control(ctl);
1567 switch (bs->kind()) {
1568 case BarrierSet::G1SATBCT:
1569 case BarrierSet::G1SATBCTLogging:
1570 g1_write_barrier_post(store, obj, adr, adr_idx, val, bt, use_precise);
1571 break;
1572
1573 case BarrierSet::CardTableModRef:
1574 case BarrierSet::CardTableExtension:
1575 write_barrier_post(store, obj, adr, adr_idx, val, use_precise);
1576 break;
1577
1578 case BarrierSet::ModRef:
1579 break;
1580
1581 case BarrierSet::Other:
1582 default :
1583 ShouldNotReachHere();
1584
1585 }
1586 }
1587
1588 Node* GraphKit::store_oop(Node* ctl,
1589 Node* obj,
1590 Node* adr,
1591 const TypePtr* adr_type,
1592 Node* val,
1593 const TypeOopPtr* val_type,
1594 BasicType bt,
1595 bool use_precise,
1596 MemNode::MemOrd mo) {
1597 // Transformation of a value which could be NULL pointer (CastPP #NULL)
1598 // could be delayed during Parse (for example, in adjust_map_after_if()).
1599 // Execute transformation here to avoid barrier generation in such case.
1600 if (_gvn.type(val) == TypePtr::NULL_PTR)
1601 val = _gvn.makecon(TypePtr::NULL_PTR);
|
1 /*
2 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
1511 Node* adr,
1512 uint adr_idx,
1513 Node* val,
1514 const TypeOopPtr* val_type,
1515 Node* pre_val,
1516 BasicType bt) {
1517
1518 BarrierSet* bs = Universe::heap()->barrier_set();
1519 set_control(ctl);
1520 switch (bs->kind()) {
1521 case BarrierSet::G1SATBCT:
1522 case BarrierSet::G1SATBCTLogging:
1523 g1_write_barrier_pre(do_load, obj, adr, adr_idx, val, val_type, pre_val, bt);
1524 break;
1525
1526 case BarrierSet::CardTableModRef:
1527 case BarrierSet::CardTableExtension:
1528 case BarrierSet::ModRef:
1529 break;
1530
1531 default :
1532 ShouldNotReachHere();
1533
1534 }
1535 }
1536
1537 bool GraphKit::can_move_pre_barrier() const {
1538 BarrierSet* bs = Universe::heap()->barrier_set();
1539 switch (bs->kind()) {
1540 case BarrierSet::G1SATBCT:
1541 case BarrierSet::G1SATBCTLogging:
1542 return true; // Can move it if no safepoint
1543
1544 case BarrierSet::CardTableModRef:
1545 case BarrierSet::CardTableExtension:
1546 case BarrierSet::ModRef:
1547 return true; // There is no pre-barrier
1548
1549 default :
1550 ShouldNotReachHere();
1551 }
1552 return false;
1553 }
1554
1555 void GraphKit::post_barrier(Node* ctl,
1556 Node* store,
1557 Node* obj,
1558 Node* adr,
1559 uint adr_idx,
1560 Node* val,
1561 BasicType bt,
1562 bool use_precise) {
1563 BarrierSet* bs = Universe::heap()->barrier_set();
1564 set_control(ctl);
1565 switch (bs->kind()) {
1566 case BarrierSet::G1SATBCT:
1567 case BarrierSet::G1SATBCTLogging:
1568 g1_write_barrier_post(store, obj, adr, adr_idx, val, bt, use_precise);
1569 break;
1570
1571 case BarrierSet::CardTableModRef:
1572 case BarrierSet::CardTableExtension:
1573 write_barrier_post(store, obj, adr, adr_idx, val, use_precise);
1574 break;
1575
1576 case BarrierSet::ModRef:
1577 break;
1578
1579 default :
1580 ShouldNotReachHere();
1581
1582 }
1583 }
1584
1585 Node* GraphKit::store_oop(Node* ctl,
1586 Node* obj,
1587 Node* adr,
1588 const TypePtr* adr_type,
1589 Node* val,
1590 const TypeOopPtr* val_type,
1591 BasicType bt,
1592 bool use_precise,
1593 MemNode::MemOrd mo) {
1594 // Transformation of a value which could be NULL pointer (CastPP #NULL)
1595 // could be delayed during Parse (for example, in adjust_map_after_if()).
1596 // Execute transformation here to avoid barrier generation in such case.
1597 if (_gvn.type(val) == TypePtr::NULL_PTR)
1598 val = _gvn.makecon(TypePtr::NULL_PTR);
|