< prev index next >
src/hotspot/share/gc/shared/c1/cardTableBarrierSetC1.cpp
BarrierSetC1_v3
#include "gc/shared/c1/cardTableBarrierSetC1.hpp"
#include "gc/shared/cardTableBarrierSet.hpp"
#include "utilities/macros.hpp"
#ifdef ASSERT
! #define __ lir_generator->lir(__FILE__, __LINE__)->
#else
! #define __ lir_generator->lir()->
#endif
! void CardTableBarrierSetC1::post_barrier(LIRGenerator *lir_generator, DecoratorSet decorators,
! LIR_OprDesc* addr, LIR_OprDesc* new_val) {
bool in_heap = (decorators & IN_HEAP) != 0;
if (!in_heap) {
return;
}
#include "gc/shared/c1/cardTableBarrierSetC1.hpp"
#include "gc/shared/cardTableBarrierSet.hpp"
#include "utilities/macros.hpp"
#ifdef ASSERT
! #define __ gen->lir(__FILE__, __LINE__)->
#else
! #define __ gen->lir()->
#endif
! void CardTableBarrierSetC1::post_barrier(LIRAccess& access, LIR_OprDesc* addr, LIR_OprDesc* new_val) {
! DecoratorSet decorators = access.decorators();
! LIRGenerator* gen = access.gen();
bool in_heap = (decorators & IN_HEAP) != 0;
if (!in_heap) {
return;
}
***************
LIR_Const* card_table_base = new LIR_Const(ct->byte_map_base());
if (addr->is_address()) {
LIR_Address* address = addr->as_address_ptr();
// ptr cannot be an object because we use this barrier for array card marks
// and addr can point in the middle of an array.
! LIR_Opr ptr = lir_generator->new_pointer_register();
if (!address->index()->is_valid() && address->disp() == 0) {
__ move(address->base(), ptr);
} else {
assert(address->disp() != max_jint, "lea doesn't support patched addresses!");
__ leal(addr, ptr);
LIR_Const* card_table_base = new LIR_Const(ct->byte_map_base());
if (addr->is_address()) {
LIR_Address* address = addr->as_address_ptr();
// ptr cannot be an object because we use this barrier for array card marks
// and addr can point in the middle of an array.
! LIR_Opr ptr = gen->new_pointer_register();
if (!address->index()->is_valid() && address->disp() == 0) {
__ move(address->base(), ptr);
} else {
assert(address->disp() != max_jint, "lea doesn't support patched addresses!");
__ leal(addr, ptr);
***************
assert(addr->is_register(), "must be a register at this point");
#ifdef CARDTABLEBARRIERSET_POST_BARRIER_HELPER
CardTableBarrierSet_post_barrier_helper(addr, card_table_base);
#else
! LIR_Opr tmp = lir_generator->new_pointer_register();
if (TwoOperandLIRForm) {
__ move(addr, tmp);
__ unsigned_shift_right(tmp, CardTable::card_shift, tmp);
} else {
__ unsigned_shift_right(addr, CardTable::card_shift, tmp);
}
LIR_Address* card_addr;
! if (lir_generator->can_inline_as_constant(card_table_base)) {
card_addr = new LIR_Address(tmp, card_table_base->as_jint(), T_BYTE);
} else {
! card_addr = new LIR_Address(tmp, lir_generator->load_constant(card_table_base), T_BYTE);
}
LIR_Opr dirty = LIR_OprFact::intConst(CardTable::dirty_card_val());
if (UseCondCardMark) {
! LIR_Opr cur_value = lir_generator->new_register(T_INT);
if (ct->scanned_concurrently()) {
__ membar_storeload();
}
__ move(card_addr, cur_value);
assert(addr->is_register(), "must be a register at this point");
#ifdef CARDTABLEBARRIERSET_POST_BARRIER_HELPER
CardTableBarrierSet_post_barrier_helper(addr, card_table_base);
#else
! LIR_Opr tmp = gen->new_pointer_register();
if (TwoOperandLIRForm) {
__ move(addr, tmp);
__ unsigned_shift_right(tmp, CardTable::card_shift, tmp);
} else {
__ unsigned_shift_right(addr, CardTable::card_shift, tmp);
}
LIR_Address* card_addr;
! if (gen->can_inline_as_constant(card_table_base)) {
card_addr = new LIR_Address(tmp, card_table_base->as_jint(), T_BYTE);
} else {
! card_addr = new LIR_Address(tmp, gen->load_constant(card_table_base), T_BYTE);
}
LIR_Opr dirty = LIR_OprFact::intConst(CardTable::dirty_card_val());
if (UseCondCardMark) {
! LIR_Opr cur_value = gen->new_register(T_INT);
if (ct->scanned_concurrently()) {
__ membar_storeload();
}
__ move(card_addr, cur_value);
< prev index next >