src/hotspot/share/c1/c1_LIRGenerator.cpp
changeset 49455 848864ed9b17
parent 49449 ef5d5d343e2a
child 49746 b17256b5c047
child 56406 e629240491c7
equal deleted inserted replaced
49454:689ebcfe04fd 49455:848864ed9b17
    33 #include "ci/ciArrayKlass.hpp"
    33 #include "ci/ciArrayKlass.hpp"
    34 #include "ci/ciInstance.hpp"
    34 #include "ci/ciInstance.hpp"
    35 #include "ci/ciObjArray.hpp"
    35 #include "ci/ciObjArray.hpp"
    36 #include "ci/ciUtilities.hpp"
    36 #include "ci/ciUtilities.hpp"
    37 #include "gc/shared/cardTable.hpp"
    37 #include "gc/shared/cardTable.hpp"
    38 #include "gc/shared/cardTableModRefBS.hpp"
    38 #include "gc/shared/cardTableBarrierSet.hpp"
    39 #include "gc/shared/collectedHeap.hpp"
    39 #include "gc/shared/collectedHeap.hpp"
    40 #include "runtime/arguments.hpp"
    40 #include "runtime/arguments.hpp"
    41 #include "runtime/sharedRuntime.hpp"
    41 #include "runtime/sharedRuntime.hpp"
    42 #include "runtime/stubRoutines.hpp"
    42 #include "runtime/stubRoutines.hpp"
    43 #include "runtime/vm_version.hpp"
    43 #include "runtime/vm_version.hpp"
  1459                                bool do_load, bool patch, CodeEmitInfo* info) {
  1459                                bool do_load, bool patch, CodeEmitInfo* info) {
  1460   // Do the pre-write barrier, if any.
  1460   // Do the pre-write barrier, if any.
  1461   switch (_bs->kind()) {
  1461   switch (_bs->kind()) {
  1462 #if INCLUDE_ALL_GCS
  1462 #if INCLUDE_ALL_GCS
  1463     case BarrierSet::G1BarrierSet:
  1463     case BarrierSet::G1BarrierSet:
  1464       G1SATBCardTableModRef_pre_barrier(addr_opr, pre_val, do_load, patch, info);
  1464       G1BarrierSet_pre_barrier(addr_opr, pre_val, do_load, patch, info);
  1465       break;
  1465       break;
  1466 #endif // INCLUDE_ALL_GCS
  1466 #endif // INCLUDE_ALL_GCS
  1467     case BarrierSet::CardTableModRef:
  1467     case BarrierSet::CardTableBarrierSet:
  1468       // No pre barriers
  1468       // No pre barriers
  1469       break;
  1469       break;
  1470     default      :
  1470     default      :
  1471       ShouldNotReachHere();
  1471       ShouldNotReachHere();
  1472 
  1472 
  1475 
  1475 
  1476 void LIRGenerator::post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) {
  1476 void LIRGenerator::post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) {
  1477   switch (_bs->kind()) {
  1477   switch (_bs->kind()) {
  1478 #if INCLUDE_ALL_GCS
  1478 #if INCLUDE_ALL_GCS
  1479     case BarrierSet::G1BarrierSet:
  1479     case BarrierSet::G1BarrierSet:
  1480       G1SATBCardTableModRef_post_barrier(addr,  new_val);
  1480       G1BarrierSet_post_barrier(addr,  new_val);
  1481       break;
  1481       break;
  1482 #endif // INCLUDE_ALL_GCS
  1482 #endif // INCLUDE_ALL_GCS
  1483     case BarrierSet::CardTableModRef:
  1483     case BarrierSet::CardTableBarrierSet:
  1484       CardTableModRef_post_barrier(addr,  new_val);
  1484       CardTableBarrierSet_post_barrier(addr,  new_val);
  1485       break;
  1485       break;
  1486     default      :
  1486     default      :
  1487       ShouldNotReachHere();
  1487       ShouldNotReachHere();
  1488     }
  1488     }
  1489 }
  1489 }
  1490 
  1490 
  1491 ////////////////////////////////////////////////////////////////////////
  1491 ////////////////////////////////////////////////////////////////////////
  1492 #if INCLUDE_ALL_GCS
  1492 #if INCLUDE_ALL_GCS
  1493 
  1493 
  1494 void LIRGenerator::G1SATBCardTableModRef_pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val,
  1494 void LIRGenerator::G1BarrierSet_pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val,
  1495                                                      bool do_load, bool patch, CodeEmitInfo* info) {
  1495                                             bool do_load, bool patch, CodeEmitInfo* info) {
  1496   // First we test whether marking is in progress.
  1496   // First we test whether marking is in progress.
  1497   BasicType flag_type;
  1497   BasicType flag_type;
  1498   if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
  1498   if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
  1499     flag_type = T_INT;
  1499     flag_type = T_INT;
  1500   } else {
  1500   } else {
  1544 
  1544 
  1545   __ branch(lir_cond_notEqual, T_INT, slow);
  1545   __ branch(lir_cond_notEqual, T_INT, slow);
  1546   __ branch_destination(slow->continuation());
  1546   __ branch_destination(slow->continuation());
  1547 }
  1547 }
  1548 
  1548 
  1549 void LIRGenerator::G1SATBCardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) {
  1549 void LIRGenerator::G1BarrierSet_post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) {
  1550   // If the "new_val" is a constant NULL, no barrier is necessary.
  1550   // If the "new_val" is a constant NULL, no barrier is necessary.
  1551   if (new_val->is_constant() &&
  1551   if (new_val->is_constant() &&
  1552       new_val->as_constant_ptr()->as_jobject() == NULL) return;
  1552       new_val->as_constant_ptr()->as_jobject() == NULL) return;
  1553 
  1553 
  1554   if (!new_val->is_register()) {
  1554   if (!new_val->is_register()) {
  1608 }
  1608 }
  1609 
  1609 
  1610 #endif // INCLUDE_ALL_GCS
  1610 #endif // INCLUDE_ALL_GCS
  1611 ////////////////////////////////////////////////////////////////////////
  1611 ////////////////////////////////////////////////////////////////////////
  1612 
  1612 
  1613 void LIRGenerator::CardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) {
  1613 void LIRGenerator::CardTableBarrierSet_post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) {
  1614   LIR_Const* card_table_base = new LIR_Const(ci_card_table_address());
  1614   LIR_Const* card_table_base = new LIR_Const(ci_card_table_address());
  1615   if (addr->is_address()) {
  1615   if (addr->is_address()) {
  1616     LIR_Address* address = addr->as_address_ptr();
  1616     LIR_Address* address = addr->as_address_ptr();
  1617     // ptr cannot be an object because we use this barrier for array card marks
  1617     // ptr cannot be an object because we use this barrier for array card marks
  1618     // and addr can point in the middle of an array.
  1618     // and addr can point in the middle of an array.
  1625     }
  1625     }
  1626     addr = ptr;
  1626     addr = ptr;
  1627   }
  1627   }
  1628   assert(addr->is_register(), "must be a register at this point");
  1628   assert(addr->is_register(), "must be a register at this point");
  1629 
  1629 
  1630 #ifdef CARDTABLEMODREF_POST_BARRIER_HELPER
  1630 #ifdef CARDTABLEBARRIERSET_POST_BARRIER_HELPER
  1631   CardTableModRef_post_barrier_helper(addr, card_table_base);
  1631   CardTableBarrierSet_post_barrier_helper(addr, card_table_base);
  1632 #else
  1632 #else
  1633   LIR_Opr tmp = new_pointer_register();
  1633   LIR_Opr tmp = new_pointer_register();
  1634   if (TwoOperandLIRForm) {
  1634   if (TwoOperandLIRForm) {
  1635     __ move(addr, tmp);
  1635     __ move(addr, tmp);
  1636     __ unsigned_shift_right(tmp, CardTable::card_shift, tmp);
  1636     __ unsigned_shift_right(tmp, CardTable::card_shift, tmp);