< prev index next > src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp
Print this page
bool G1BarrierSetC2::is_gc_pre_barrier_node(Node *node) const {
return is_g1_pre_val_load(node);
}
! void G1BarrierSetC2::eliminate_gc_barrier(PhaseMacroExpand* macro, Node* node) const {
if (is_g1_pre_val_load(node)) {
! macro->replace_node(node, macro->zerocon(node->as_Load()->bottom_type()->basic_type()));
} else {
assert(node->Opcode() == Op_CastP2X, "ConvP2XNode required");
assert(node->outcnt() <= 2, "expects 1 or 2 users: Xor and URShift nodes");
// It could be only one user, URShift node, in Object.clone() intrinsic
// but the new allocation is passed to arraycopy stub and it could not
bool G1BarrierSetC2::is_gc_pre_barrier_node(Node *node) const {
return is_g1_pre_val_load(node);
}
! void G1BarrierSetC2::eliminate_gc_barrier(PhaseIterGVN* igvn, Node* node) const {
if (is_g1_pre_val_load(node)) {
! igvn->replace_node(node, igvn->zerocon(node->as_Load()->bottom_type()->basic_type()));
} else {
assert(node->Opcode() == Op_CastP2X, "ConvP2XNode required");
assert(node->outcnt() <= 2, "expects 1 or 2 users: Xor and URShift nodes");
// It could be only one user, URShift node, in Object.clone() intrinsic
// but the new allocation is passed to arraycopy stub and it could not
Node* shift = xorx->unique_out();
Node* cmpx = shift->unique_out();
assert(cmpx->is_Cmp() && cmpx->unique_out()->is_Bool() &&
cmpx->unique_out()->as_Bool()->_test._test == BoolTest::ne,
"missing region check in G1 post barrier");
! macro->replace_node(cmpx, macro->makecon(TypeInt::CC_EQ));
// Remove G1 pre barrier.
// Search "if (marking != 0)" check and set it to "false".
// There is no G1 pre barrier if previous stored value is null
// (for example, after initialization).
if (this_region->is_Region() && this_region->req() == 3) {
! int ind = 1;
! if (!this_region->in(ind)->is_IfFalse()) {
! ind = 2;
! }
! if (this_region->in(ind)->is_IfFalse() &&
! this_region->in(ind)->in(0)->Opcode() == Op_If) {
! Node* bol = this_region->in(ind)->in(0)->in(1);
! assert(bol->is_Bool(), "");
! cmpx = bol->in(1);
! if (bol->as_Bool()->_test._test == BoolTest::ne &&
! cmpx->is_Cmp() && cmpx->in(2) == macro->intcon(0) &&
! cmpx->in(1)->is_Load()) {
! Node* adr = cmpx->in(1)->as_Load()->in(MemNode::Address);
! const int marking_offset = in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset());
! if (adr->is_AddP() && adr->in(AddPNode::Base) == macro->top() &&
! adr->in(AddPNode::Address)->Opcode() == Op_ThreadLocal &&
- adr->in(AddPNode::Offset) == macro->MakeConX(marking_offset)) {
- macro->replace_node(cmpx, macro->makecon(TypeInt::CC_EQ));
}
}
}
}
} else {
Node* shift = xorx->unique_out();
Node* cmpx = shift->unique_out();
assert(cmpx->is_Cmp() && cmpx->unique_out()->is_Bool() &&
cmpx->unique_out()->as_Bool()->_test._test == BoolTest::ne,
"missing region check in G1 post barrier");
! igvn->replace_node(cmpx, igvn->makecon(TypeInt::CC_EQ));
// Remove G1 pre barrier.
// Search "if (marking != 0)" check and set it to "false".
// There is no G1 pre barrier if previous stored value is null
// (for example, after initialization).
if (this_region->is_Region() && this_region->req() == 3) {
! for (int i = 1; i < 3; ++i) {
! if (this_region->in(i)->is_IfFalse() &&
! this_region->in(i)->in(0)->is_If() &&
! this_region->in(i)->in(0)->in(1)->is_Bool()) {
! Node* bol = this_region->in(i)->in(0)->in(1);
! cmpx = bol->in(1);
! if (bol->as_Bool()->_test._test == BoolTest::ne &&
! cmpx->is_Cmp() && cmpx->in(2) == igvn->intcon(0) &&
! cmpx->in(1)->is_Load()) {
! Node* adr = cmpx->in(1)->as_Load()->in(MemNode::Address);
! const int marking_offset = in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset());
! if (adr->is_AddP() && adr->in(AddPNode::Base) == igvn->C->top() &&
! adr->in(AddPNode::Address)->Opcode() == Op_ThreadLocal &&
! adr->in(AddPNode::Offset) == igvn->MakeConX(marking_offset)) {
! igvn->replace_node(cmpx, igvn->makecon(TypeInt::CC_EQ));
! }
}
}
}
}
} else {
assert(load != nullptr, "missing G1 post barrier");
Node* cmpx = load->unique_out();
assert(cmpx->is_Cmp() && cmpx->unique_out()->is_Bool() &&
cmpx->unique_out()->as_Bool()->_test._test == BoolTest::ne,
"missing card value check in G1 post barrier");
! macro->replace_node(cmpx, macro->makecon(TypeInt::CC_EQ));
// There is no G1 pre barrier in this case
}
// Now CastP2X can be removed since it is used only on dead path
// which currently still alive until igvn optimize it.
assert(node->outcnt() == 0 || node->unique_out()->Opcode() == Op_URShiftX, "");
! macro->replace_node(node, macro->top());
}
}
Node* G1BarrierSetC2::step_over_gc_barrier(Node* c) const {
if (!use_ReduceInitialCardMarks() &&
assert(load != nullptr, "missing G1 post barrier");
Node* cmpx = load->unique_out();
assert(cmpx->is_Cmp() && cmpx->unique_out()->is_Bool() &&
cmpx->unique_out()->as_Bool()->_test._test == BoolTest::ne,
"missing card value check in G1 post barrier");
! igvn->replace_node(cmpx, igvn->makecon(TypeInt::CC_EQ));
// There is no G1 pre barrier in this case
}
// Now CastP2X can be removed since it is used only on dead path
// which currently still alive until igvn optimize it.
assert(node->outcnt() == 0 || node->unique_out()->Opcode() == Op_URShiftX, "");
! igvn->replace_node(node, igvn->C->top());
}
}
Node* G1BarrierSetC2::step_over_gc_barrier(Node* c) const {
if (!use_ReduceInitialCardMarks() &&
< prev index next >