< prev index next >

src/share/vm/opto/graphKit.cpp

Print this page
rev 11463 : Backport Traversal GC


1522 
1523   return st;
1524 }
1525 
1526 
1527 void GraphKit::pre_barrier(bool do_load,
1528                            Node* ctl,
1529                            Node* obj,
1530                            Node* adr,
1531                            uint  adr_idx,
1532                            Node* val,
1533                            const TypeOopPtr* val_type,
1534                            Node* pre_val,
1535                            BasicType bt) {
1536 
1537   BarrierSet* bs = Universe::heap()->barrier_set();
1538   set_control(ctl);
1539   switch (bs->kind()) {
1540     case BarrierSet::G1SATBCT:
1541     case BarrierSet::G1SATBCTLogging:


1542     case BarrierSet::ShenandoahBarrierSet:

1543       g1_write_barrier_pre(do_load, obj, adr, adr_idx, val, val_type, pre_val, bt);

1544       break;
1545 
1546     case BarrierSet::CardTableModRef:
1547     case BarrierSet::CardTableExtension:
1548     case BarrierSet::ModRef:
1549       break;
1550 
1551     case BarrierSet::Other:
1552     default      :
1553       ShouldNotReachHere();
1554 
1555   }
1556 }
1557 
1558 bool GraphKit::can_move_pre_barrier() const {
1559   BarrierSet* bs = Universe::heap()->barrier_set();
1560   switch (bs->kind()) {
1561     case BarrierSet::G1SATBCT:
1562     case BarrierSet::G1SATBCTLogging:
1563     case BarrierSet::ShenandoahBarrierSet:
1564       return true; // Can move it if no safepoint
1565 


1573       ShouldNotReachHere();
1574   }
1575   return false;
1576 }
1577 
1578 void GraphKit::post_barrier(Node* ctl,
1579                             Node* store,
1580                             Node* obj,
1581                             Node* adr,
1582                             uint  adr_idx,
1583                             Node* val,
1584                             BasicType bt,
1585                             bool use_precise) {
1586   BarrierSet* bs = Universe::heap()->barrier_set();
1587   set_control(ctl);
1588   switch (bs->kind()) {
1589     case BarrierSet::G1SATBCT:
1590     case BarrierSet::G1SATBCTLogging:
1591       g1_write_barrier_post(store, obj, adr, adr_idx, val, bt, use_precise);
1592       break;
1593 




1594     case BarrierSet::CardTableModRef:
1595     case BarrierSet::CardTableExtension:
1596       write_barrier_post(store, obj, adr, adr_idx, val, use_precise);
1597       break;
1598 
1599     case BarrierSet::ModRef:
1600     case BarrierSet::ShenandoahBarrierSet:
1601       break;
1602 
1603     case BarrierSet::Other:
1604     default      :
1605       ShouldNotReachHere();
1606 
1607   }
1608 }
1609 
1610 Node* GraphKit::store_oop(Node* ctl,
1611                           Node* obj,
1612                           Node* adr,
1613                           const TypePtr* adr_type,
1614                           Node* val,
1615                           const TypeOopPtr* val_type,
1616                           BasicType bt,
1617                           bool use_precise,
1618                           MemNode::MemOrd mo,
1619                           bool mismatched) {
1620   // Transformation of a value which could be NULL pointer (CastPP #NULL)


3931   assert(in_bytes(PtrQueue::byte_width_of_active()) == 4 || in_bytes(PtrQueue::byte_width_of_active()) == 1, "flag width");
3932 
3933   // Offsets into the thread
3934   const int marking_offset = in_bytes(JavaThread::satb_mark_queue_offset() +  // 648
3935                                           PtrQueue::byte_offset_of_active());
3936   const int index_offset   = in_bytes(JavaThread::satb_mark_queue_offset() +  // 656
3937                                           PtrQueue::byte_offset_of_index());
3938   const int buffer_offset  = in_bytes(JavaThread::satb_mark_queue_offset() +  // 652
3939                                           PtrQueue::byte_offset_of_buf());
3940 
3941   // Now the actual pointers into the thread
3942   Node* marking_adr = __ AddP(no_base, tls, __ ConX(marking_offset));
3943   Node* buffer_adr  = __ AddP(no_base, tls, __ ConX(buffer_offset));
3944   Node* index_adr   = __ AddP(no_base, tls, __ ConX(index_offset));
3945 
3946   // Now some of the values
3947   Node* marking;
3948   if (UseShenandoahGC) {
3949     Node* gc_state = __ AddP(no_base, tls, __ ConX(in_bytes(JavaThread::gc_state_offset())));
3950     Node* ld = __ load(__ ctrl(), gc_state, TypeInt::BYTE, T_BYTE, Compile::AliasIdxRaw);
3951     marking = __ AndI(ld, __ ConI(ShenandoahHeap::MARKING));
3952     assert(ShenandoahBarrierC2Support::is_gc_state_load(ld), "Should match the shape");
3953   } else {
3954     assert(UseG1GC, "should be");
3955     marking = __ load(__ ctrl(), marking_adr, TypeInt::INT, active_type, Compile::AliasIdxRaw);
3956   }
3957 
3958   // if (!marking)
3959   __ if_then(marking, BoolTest::ne, zero, unlikely); {
3960     BasicType index_bt = TypeX_X->basic_type();
3961     assert(sizeof(size_t) == type2aelembytes(index_bt), "Loading G1 PtrQueue::_index with wrong size.");
3962     Node* index   = __ load(__ ctrl(), index_adr, TypeX_X, index_bt, Compile::AliasIdxRaw);
3963 
3964     if (do_load) {
3965       // load original value
3966       // alias_idx correct??
3967       pre_val = __ load(__ ctrl(), adr, val_type, bt, alias_idx);
3968     }
3969 
3970     // if (pre_val != NULL)
3971     __ if_then(pre_val, BoolTest::ne, null()); {




1522 
1523   return st;
1524 }
1525 
1526 
1527 void GraphKit::pre_barrier(bool do_load,
1528                            Node* ctl,
1529                            Node* obj,
1530                            Node* adr,
1531                            uint  adr_idx,
1532                            Node* val,
1533                            const TypeOopPtr* val_type,
1534                            Node* pre_val,
1535                            BasicType bt) {
1536 
1537   BarrierSet* bs = Universe::heap()->barrier_set();
1538   set_control(ctl);
1539   switch (bs->kind()) {
1540     case BarrierSet::G1SATBCT:
1541     case BarrierSet::G1SATBCTLogging:
1542       g1_write_barrier_pre(do_load, obj, adr, adr_idx, val, val_type, pre_val, bt);
1543       break;
1544     case BarrierSet::ShenandoahBarrierSet:
1545       if (ShenandoahSATBBarrier) {
1546         g1_write_barrier_pre(do_load, obj, adr, adr_idx, val, val_type, pre_val, bt);
1547       }
1548       break;

1549     case BarrierSet::CardTableModRef:
1550     case BarrierSet::CardTableExtension:
1551     case BarrierSet::ModRef:
1552       break;
1553 
1554     case BarrierSet::Other:
1555     default      :
1556       ShouldNotReachHere();
1557 
1558   }
1559 }
1560 
1561 bool GraphKit::can_move_pre_barrier() const {
1562   BarrierSet* bs = Universe::heap()->barrier_set();
1563   switch (bs->kind()) {
1564     case BarrierSet::G1SATBCT:
1565     case BarrierSet::G1SATBCTLogging:
1566     case BarrierSet::ShenandoahBarrierSet:
1567       return true; // Can move it if no safepoint
1568 


1576       ShouldNotReachHere();
1577   }
1578   return false;
1579 }
1580 
1581 void GraphKit::post_barrier(Node* ctl,
1582                             Node* store,
1583                             Node* obj,
1584                             Node* adr,
1585                             uint  adr_idx,
1586                             Node* val,
1587                             BasicType bt,
1588                             bool use_precise) {
1589   BarrierSet* bs = Universe::heap()->barrier_set();
1590   set_control(ctl);
1591   switch (bs->kind()) {
1592     case BarrierSet::G1SATBCT:
1593     case BarrierSet::G1SATBCTLogging:
1594       g1_write_barrier_post(store, obj, adr, adr_idx, val, bt, use_precise);
1595       break;
1596     case BarrierSet::ShenandoahBarrierSet:
1597       if (ShenandoahStoreValEnqueueBarrier) {
1598         g1_write_barrier_pre(false, NULL, NULL, max_juint, NULL, NULL, val, bt);
1599       }
1600       break;
1601     case BarrierSet::CardTableModRef:
1602     case BarrierSet::CardTableExtension:
1603       write_barrier_post(store, obj, adr, adr_idx, val, use_precise);
1604       break;
1605 
1606     case BarrierSet::ModRef:

1607       break;
1608 
1609     case BarrierSet::Other:
1610     default      :
1611       ShouldNotReachHere();
1612 
1613   }
1614 }
1615 
1616 Node* GraphKit::store_oop(Node* ctl,
1617                           Node* obj,
1618                           Node* adr,
1619                           const TypePtr* adr_type,
1620                           Node* val,
1621                           const TypeOopPtr* val_type,
1622                           BasicType bt,
1623                           bool use_precise,
1624                           MemNode::MemOrd mo,
1625                           bool mismatched) {
1626   // Transformation of a value which could be NULL pointer (CastPP #NULL)


3937   assert(in_bytes(PtrQueue::byte_width_of_active()) == 4 || in_bytes(PtrQueue::byte_width_of_active()) == 1, "flag width");
3938 
3939   // Offsets into the thread
3940   const int marking_offset = in_bytes(JavaThread::satb_mark_queue_offset() +  // 648
3941                                           PtrQueue::byte_offset_of_active());
3942   const int index_offset   = in_bytes(JavaThread::satb_mark_queue_offset() +  // 656
3943                                           PtrQueue::byte_offset_of_index());
3944   const int buffer_offset  = in_bytes(JavaThread::satb_mark_queue_offset() +  // 652
3945                                           PtrQueue::byte_offset_of_buf());
3946 
3947   // Now the actual pointers into the thread
3948   Node* marking_adr = __ AddP(no_base, tls, __ ConX(marking_offset));
3949   Node* buffer_adr  = __ AddP(no_base, tls, __ ConX(buffer_offset));
3950   Node* index_adr   = __ AddP(no_base, tls, __ ConX(index_offset));
3951 
3952   // Now some of the values
3953   Node* marking;
3954   if (UseShenandoahGC) {
3955     Node* gc_state = __ AddP(no_base, tls, __ ConX(in_bytes(JavaThread::gc_state_offset())));
3956     Node* ld = __ load(__ ctrl(), gc_state, TypeInt::BYTE, T_BYTE, Compile::AliasIdxRaw);
3957     marking = __ AndI(ld, __ ConI(ShenandoahHeap::MARKING | ShenandoahHeap::TRAVERSAL));
3958     assert(ShenandoahBarrierC2Support::is_gc_state_load(ld), "Should match the shape");
3959   } else {
3960     assert(UseG1GC, "should be");
3961     marking = __ load(__ ctrl(), marking_adr, TypeInt::INT, active_type, Compile::AliasIdxRaw);
3962   }
3963 
3964   // if (!marking)
3965   __ if_then(marking, BoolTest::ne, zero, unlikely); {
3966     BasicType index_bt = TypeX_X->basic_type();
3967     assert(sizeof(size_t) == type2aelembytes(index_bt), "Loading G1 PtrQueue::_index with wrong size.");
3968     Node* index   = __ load(__ ctrl(), index_adr, TypeX_X, index_bt, Compile::AliasIdxRaw);
3969 
3970     if (do_load) {
3971       // load original value
3972       // alias_idx correct??
3973       pre_val = __ load(__ ctrl(), adr, val_type, bt, alias_idx);
3974     }
3975 
3976     // if (pre_val != NULL)
3977     __ if_then(pre_val, BoolTest::ne, null()); {


< prev index next >