src/hotspot/share/c1/c1_LIRGenerator.cpp
changeset 49164 7e958a8ebcd3
parent 47580 96392e113a0a
child 49347 edb65305d3ac
child 56276 ee5e58456be5
equal deleted inserted replaced
49163:580bb0b85f63 49164:7e958a8ebcd3
     1 /*
     1 /*
     2  * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    31 #include "c1/c1_LIRGenerator.hpp"
    31 #include "c1/c1_LIRGenerator.hpp"
    32 #include "c1/c1_ValueStack.hpp"
    32 #include "c1/c1_ValueStack.hpp"
    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"
       
    37 #include "gc/shared/cardTable.hpp"
    36 #include "gc/shared/cardTableModRefBS.hpp"
    38 #include "gc/shared/cardTableModRefBS.hpp"
    37 #include "runtime/arguments.hpp"
    39 #include "runtime/arguments.hpp"
    38 #include "runtime/sharedRuntime.hpp"
    40 #include "runtime/sharedRuntime.hpp"
    39 #include "runtime/stubRoutines.hpp"
    41 #include "runtime/stubRoutines.hpp"
    40 #include "runtime/vm_version.hpp"
    42 #include "runtime/vm_version.hpp"
  1459 #if INCLUDE_ALL_GCS
  1461 #if INCLUDE_ALL_GCS
  1460     case BarrierSet::G1SATBCTLogging:
  1462     case BarrierSet::G1SATBCTLogging:
  1461       G1SATBCardTableModRef_pre_barrier(addr_opr, pre_val, do_load, patch, info);
  1463       G1SATBCardTableModRef_pre_barrier(addr_opr, pre_val, do_load, patch, info);
  1462       break;
  1464       break;
  1463 #endif // INCLUDE_ALL_GCS
  1465 #endif // INCLUDE_ALL_GCS
  1464     case BarrierSet::CardTableForRS:
  1466     case BarrierSet::CardTableModRef:
  1465     case BarrierSet::CardTableExtension:
       
  1466       // No pre barriers
       
  1467       break;
       
  1468     case BarrierSet::ModRef:
       
  1469       // No pre barriers
  1467       // No pre barriers
  1470       break;
  1468       break;
  1471     default      :
  1469     default      :
  1472       ShouldNotReachHere();
  1470       ShouldNotReachHere();
  1473 
  1471 
  1479 #if INCLUDE_ALL_GCS
  1477 #if INCLUDE_ALL_GCS
  1480     case BarrierSet::G1SATBCTLogging:
  1478     case BarrierSet::G1SATBCTLogging:
  1481       G1SATBCardTableModRef_post_barrier(addr,  new_val);
  1479       G1SATBCardTableModRef_post_barrier(addr,  new_val);
  1482       break;
  1480       break;
  1483 #endif // INCLUDE_ALL_GCS
  1481 #endif // INCLUDE_ALL_GCS
  1484     case BarrierSet::CardTableForRS:
  1482     case BarrierSet::CardTableModRef:
  1485     case BarrierSet::CardTableExtension:
       
  1486       CardTableModRef_post_barrier(addr,  new_val);
  1483       CardTableModRef_post_barrier(addr,  new_val);
  1487       break;
       
  1488     case BarrierSet::ModRef:
       
  1489       // No post barriers
       
  1490       break;
  1484       break;
  1491     default      :
  1485     default      :
  1492       ShouldNotReachHere();
  1486       ShouldNotReachHere();
  1493     }
  1487     }
  1494 }
  1488 }
  1614 
  1608 
  1615 #endif // INCLUDE_ALL_GCS
  1609 #endif // INCLUDE_ALL_GCS
  1616 ////////////////////////////////////////////////////////////////////////
  1610 ////////////////////////////////////////////////////////////////////////
  1617 
  1611 
  1618 void LIRGenerator::CardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) {
  1612 void LIRGenerator::CardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) {
  1619   CardTableModRefBS* ct = barrier_set_cast<CardTableModRefBS>(_bs);
  1613   LIR_Const* card_table_base = new LIR_Const(ci_card_table_address());
  1620   assert(sizeof(*(ct->byte_map_base)) == sizeof(jbyte), "adjust this code");
       
  1621   LIR_Const* card_table_base = new LIR_Const(ct->byte_map_base);
       
  1622   if (addr->is_address()) {
  1614   if (addr->is_address()) {
  1623     LIR_Address* address = addr->as_address_ptr();
  1615     LIR_Address* address = addr->as_address_ptr();
  1624     // ptr cannot be an object because we use this barrier for array card marks
  1616     // ptr cannot be an object because we use this barrier for array card marks
  1625     // and addr can point in the middle of an array.
  1617     // and addr can point in the middle of an array.
  1626     LIR_Opr ptr = new_pointer_register();
  1618     LIR_Opr ptr = new_pointer_register();
  1638   CardTableModRef_post_barrier_helper(addr, card_table_base);
  1630   CardTableModRef_post_barrier_helper(addr, card_table_base);
  1639 #else
  1631 #else
  1640   LIR_Opr tmp = new_pointer_register();
  1632   LIR_Opr tmp = new_pointer_register();
  1641   if (TwoOperandLIRForm) {
  1633   if (TwoOperandLIRForm) {
  1642     __ move(addr, tmp);
  1634     __ move(addr, tmp);
  1643     __ unsigned_shift_right(tmp, CardTableModRefBS::card_shift, tmp);
  1635     __ unsigned_shift_right(tmp, CardTable::card_shift, tmp);
  1644   } else {
  1636   } else {
  1645     __ unsigned_shift_right(addr, CardTableModRefBS::card_shift, tmp);
  1637     __ unsigned_shift_right(addr, CardTable::card_shift, tmp);
  1646   }
  1638   }
  1647 
  1639 
  1648   LIR_Address* card_addr;
  1640   LIR_Address* card_addr;
  1649   if (can_inline_as_constant(card_table_base)) {
  1641   if (can_inline_as_constant(card_table_base)) {
  1650     card_addr = new LIR_Address(tmp, card_table_base->as_jint(), T_BYTE);
  1642     card_addr = new LIR_Address(tmp, card_table_base->as_jint(), T_BYTE);
  1651   } else {
  1643   } else {
  1652     card_addr = new LIR_Address(tmp, load_constant(card_table_base), T_BYTE);
  1644     card_addr = new LIR_Address(tmp, load_constant(card_table_base), T_BYTE);
  1653   }
  1645   }
  1654 
  1646 
  1655   LIR_Opr dirty = LIR_OprFact::intConst(CardTableModRefBS::dirty_card_val());
  1647   LIR_Opr dirty = LIR_OprFact::intConst(CardTable::dirty_card_val());
  1656   if (UseCondCardMark) {
  1648   if (UseCondCardMark) {
  1657     LIR_Opr cur_value = new_register(T_INT);
  1649     LIR_Opr cur_value = new_register(T_INT);
  1658     if (UseConcMarkSweepGC) {
  1650     if (UseConcMarkSweepGC) {
  1659       __ membar_storeload();
  1651       __ membar_storeload();
  1660     }
  1652     }