src/hotspot/share/opto/graphKit.cpp
changeset 49164 7e958a8ebcd3
parent 48961 120b61d50f85
child 49170 49e095e658c7
equal deleted inserted replaced
49163:580bb0b85f63 49164:7e958a8ebcd3
    21  * questions.
    21  * questions.
    22  *
    22  *
    23  */
    23  */
    24 
    24 
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
       
    26 #include "ci/ciUtilities.hpp"
    26 #include "compiler/compileLog.hpp"
    27 #include "compiler/compileLog.hpp"
       
    28 #include "gc/g1/g1CardTable.hpp"
    27 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
    29 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
    28 #include "gc/g1/heapRegion.hpp"
    30 #include "gc/g1/heapRegion.hpp"
    29 #include "gc/shared/barrierSet.hpp"
    31 #include "gc/shared/barrierSet.hpp"
       
    32 #include "gc/shared/cardTable.hpp"
    30 #include "gc/shared/cardTableModRefBS.hpp"
    33 #include "gc/shared/cardTableModRefBS.hpp"
    31 #include "gc/shared/collectedHeap.hpp"
    34 #include "gc/shared/collectedHeap.hpp"
    32 #include "memory/resourceArea.hpp"
    35 #include "memory/resourceArea.hpp"
    33 #include "opto/addnode.hpp"
    36 #include "opto/addnode.hpp"
    34 #include "opto/castnode.hpp"
    37 #include "opto/castnode.hpp"
  1560   switch (bs->kind()) {
  1563   switch (bs->kind()) {
  1561     case BarrierSet::G1SATBCTLogging:
  1564     case BarrierSet::G1SATBCTLogging:
  1562       g1_write_barrier_pre(do_load, obj, adr, adr_idx, val, val_type, pre_val, bt);
  1565       g1_write_barrier_pre(do_load, obj, adr, adr_idx, val, val_type, pre_val, bt);
  1563       break;
  1566       break;
  1564 
  1567 
  1565     case BarrierSet::CardTableForRS:
  1568     case BarrierSet::CardTableModRef:
  1566     case BarrierSet::CardTableExtension:
       
  1567     case BarrierSet::ModRef:
       
  1568       break;
  1569       break;
  1569 
  1570 
  1570     default      :
  1571     default      :
  1571       ShouldNotReachHere();
  1572       ShouldNotReachHere();
  1572 
  1573 
  1577   BarrierSet* bs = Universe::heap()->barrier_set();
  1578   BarrierSet* bs = Universe::heap()->barrier_set();
  1578   switch (bs->kind()) {
  1579   switch (bs->kind()) {
  1579     case BarrierSet::G1SATBCTLogging:
  1580     case BarrierSet::G1SATBCTLogging:
  1580       return true; // Can move it if no safepoint
  1581       return true; // Can move it if no safepoint
  1581 
  1582 
  1582     case BarrierSet::CardTableForRS:
  1583     case BarrierSet::CardTableModRef:
  1583     case BarrierSet::CardTableExtension:
       
  1584     case BarrierSet::ModRef:
       
  1585       return true; // There is no pre-barrier
  1584       return true; // There is no pre-barrier
  1586 
  1585 
  1587     default      :
  1586     default      :
  1588       ShouldNotReachHere();
  1587       ShouldNotReachHere();
  1589   }
  1588   }
  1603   switch (bs->kind()) {
  1602   switch (bs->kind()) {
  1604     case BarrierSet::G1SATBCTLogging:
  1603     case BarrierSet::G1SATBCTLogging:
  1605       g1_write_barrier_post(store, obj, adr, adr_idx, val, bt, use_precise);
  1604       g1_write_barrier_post(store, obj, adr, adr_idx, val, bt, use_precise);
  1606       break;
  1605       break;
  1607 
  1606 
  1608     case BarrierSet::CardTableForRS:
  1607     case BarrierSet::CardTableModRef:
  1609     case BarrierSet::CardTableExtension:
       
  1610       write_barrier_post(store, obj, adr, adr_idx, val, use_precise);
  1608       write_barrier_post(store, obj, adr, adr_idx, val, use_precise);
  1611       break;
       
  1612 
       
  1613     case BarrierSet::ModRef:
       
  1614       break;
  1609       break;
  1615 
  1610 
  1616     default      :
  1611     default      :
  1617       ShouldNotReachHere();
  1612       ShouldNotReachHere();
  1618 
  1613 
  3825   sync_kit(ideal);
  3820   sync_kit(ideal);
  3826 }
  3821 }
  3827 
  3822 
  3828 Node* GraphKit::byte_map_base_node() {
  3823 Node* GraphKit::byte_map_base_node() {
  3829   // Get base of card map
  3824   // Get base of card map
  3830   CardTableModRefBS* ct =
  3825   jbyte* card_table_base = ci_card_table_address();
  3831     barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
  3826   if (card_table_base != NULL) {
  3832   assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust users of this code");
  3827     return makecon(TypeRawPtr::make((address)card_table_base));
  3833   if (ct->byte_map_base != NULL) {
       
  3834     return makecon(TypeRawPtr::make((address)ct->byte_map_base));
       
  3835   } else {
  3828   } else {
  3836     return null();
  3829     return null();
  3837   }
  3830   }
  3838 }
  3831 }
  3839 
  3832 
  3881   Node* cast = __ CastPX(__ ctrl(), adr);
  3874   Node* cast = __ CastPX(__ ctrl(), adr);
  3882 
  3875 
  3883   // Divide by card size
  3876   // Divide by card size
  3884   assert(Universe::heap()->barrier_set()->is_a(BarrierSet::CardTableModRef),
  3877   assert(Universe::heap()->barrier_set()->is_a(BarrierSet::CardTableModRef),
  3885          "Only one we handle so far.");
  3878          "Only one we handle so far.");
  3886   Node* card_offset = __ URShiftX( cast, __ ConI(CardTableModRefBS::card_shift) );
  3879   Node* card_offset = __ URShiftX( cast, __ ConI(CardTable::card_shift) );
  3887 
  3880 
  3888   // Combine card table base and card offset
  3881   // Combine card table base and card offset
  3889   Node* card_adr = __ AddP(__ top(), byte_map_base_node(), card_offset );
  3882   Node* card_adr = __ AddP(__ top(), byte_map_base_node(), card_offset );
  3890 
  3883 
  3891   // Get the alias_index for raw card-mark memory
  3884   // Get the alias_index for raw card-mark memory
  4273   Node* tls = __ thread(); // ThreadLocalStorage
  4266   Node* tls = __ thread(); // ThreadLocalStorage
  4274 
  4267 
  4275   Node* no_base = __ top();
  4268   Node* no_base = __ top();
  4276   float likely  = PROB_LIKELY(0.999);
  4269   float likely  = PROB_LIKELY(0.999);
  4277   float unlikely  = PROB_UNLIKELY(0.999);
  4270   float unlikely  = PROB_UNLIKELY(0.999);
  4278   Node* young_card = __ ConI((jint)G1SATBCardTableModRefBS::g1_young_card_val());
  4271   Node* young_card = __ ConI((jint)G1CardTable::g1_young_card_val());
  4279   Node* dirty_card = __ ConI((jint)CardTableModRefBS::dirty_card_val());
  4272   Node* dirty_card = __ ConI((jint)CardTable::dirty_card_val());
  4280   Node* zeroX = __ ConX(0);
  4273   Node* zeroX = __ ConX(0);
  4281 
  4274 
  4282   // Get the alias_index for raw card-mark memory
  4275   // Get the alias_index for raw card-mark memory
  4283   const TypePtr* card_type = TypeRawPtr::BOTTOM;
  4276   const TypePtr* card_type = TypeRawPtr::BOTTOM;
  4284 
  4277 
  4304   // Convert the store obj pointer to an int prior to doing math on it
  4297   // Convert the store obj pointer to an int prior to doing math on it
  4305   // Must use ctrl to prevent "integerized oop" existing across safepoint
  4298   // Must use ctrl to prevent "integerized oop" existing across safepoint
  4306   Node* cast =  __ CastPX(__ ctrl(), adr);
  4299   Node* cast =  __ CastPX(__ ctrl(), adr);
  4307 
  4300 
  4308   // Divide pointer by card size
  4301   // Divide pointer by card size
  4309   Node* card_offset = __ URShiftX( cast, __ ConI(CardTableModRefBS::card_shift) );
  4302   Node* card_offset = __ URShiftX( cast, __ ConI(CardTable::card_shift) );
  4310 
  4303 
  4311   // Combine card table base and card offset
  4304   // Combine card table base and card offset
  4312   Node* card_adr = __ AddP(no_base, byte_map_base_node(), card_offset );
  4305   Node* card_adr = __ AddP(no_base, byte_map_base_node(), card_offset );
  4313 
  4306 
  4314   // If we know the value being stored does it cross regions?
  4307   // If we know the value being stored does it cross regions?