< prev index next >
src/hotspot/share/opto/shenandoahSupport.cpp
Print this page
rev 47953 : Implement flag to generate write-barriers without membars.
@@ -646,14 +646,16 @@
}
Node* ShenandoahWriteBarrierNode::evacuation_in_progress_test_ctrl(Node* iff) {
assert(is_evacuation_in_progress_test(iff), "bad input");
Node* c = iff;
+ if (ShenandoahWriteBarrierMemBar) {
do {
assert(c->in(0)->is_Proj() && c->in(0)->in(0)->is_MemBar(), "where's the mem bar?");
c = c->in(0)->in(0);
} while (c->adr_type() != TypeRawPtr::BOTTOM);
+ }
return c->in(0);
}
bool ShenandoahBarrierNode::dominates_memory_impl(PhaseGVN* phase,
Node* b1,
@@ -3530,10 +3532,11 @@
debug_only(gc_state_adr_type = phase->C->get_adr_type(gc_state_idx));
Node* gc_state = new LoadUBNode(ctrl, raw_mem, gc_state_addr, gc_state_adr_type, TypeInt::BYTE, MemNode::unordered);
phase->register_new_node(gc_state, ctrl);
+ if (ShenandoahWriteBarrierMemBar) {
Node* mb = MemBarNode::make(phase->C, Op_MemBarAcquire, Compile::AliasIdxRaw);
mb->init_req(TypeFunc::Control, ctrl);
mb->init_req(TypeFunc::Memory, raw_mem);
phase->register_control(mb, loop, ctrl);
Node* ctrl_proj = new ProjNode(mb,TypeFunc::Control);
@@ -3548,18 +3551,22 @@
ctrl_proj = new ProjNode(mb,TypeFunc::Control);
phase->register_control(ctrl_proj, loop, mb);
wb_mem = new ProjNode(mb,TypeFunc::Memory);
phase->register_new_node(wb_mem, mb);
- Node* evacuation_in_progress = new AndINode(gc_state, phase->igvn().intcon(ShenandoahHeap::EVACUATION));
- phase->register_new_node(evacuation_in_progress, ctrl_proj);
+ ctrl = ctrl_proj;
+ }
+
+ Node* evacuation_in_progress = gc_state;
+ evacuation_in_progress = new AndINode(gc_state, phase->igvn().intcon(ShenandoahHeap::EVACUATION));
+ phase->register_new_node(evacuation_in_progress, ctrl);
Node* evacuation_in_progress_cmp = new CmpINode(evacuation_in_progress, phase->igvn().zerocon(T_INT));
- phase->register_new_node(evacuation_in_progress_cmp, ctrl_proj);
+ phase->register_new_node(evacuation_in_progress_cmp, ctrl);
Node* evacuation_in_progress_test = new BoolNode(evacuation_in_progress_cmp, BoolTest::ne);
- phase->register_new_node(evacuation_in_progress_test, ctrl_proj);
- evacuation_iff = new IfNode(ctrl_proj, evacuation_in_progress_test, PROB_UNLIKELY(0.999), COUNT_UNKNOWN);
- phase->register_control(evacuation_iff, loop, ctrl_proj);
+ phase->register_new_node(evacuation_in_progress_test, ctrl);
+ evacuation_iff = new IfNode(ctrl, evacuation_in_progress_test, PROB_UNLIKELY(0.999), COUNT_UNKNOWN);
+ phase->register_control(evacuation_iff, loop, ctrl);
assert(is_evacuation_in_progress_test(evacuation_iff), "Should match the shape");
assert(is_gc_state_load(gc_state), "Should match the shape");
evac_not_in_progress = new IfFalseNode(evacuation_iff);
@@ -3969,10 +3976,11 @@
void ShenandoahWriteBarrierNode::move_evacuation_test_out_of_loop(IfNode* iff, PhaseIdealLoop* phase) {
// move test and its mem barriers out of the loop
assert(is_evacuation_in_progress_test(iff), "inconsistent");
+ if (ShenandoahWriteBarrierMemBar) {
IdealLoopTree *loop = phase->get_loop(iff);
Node* loop_head = loop->_head;
Node* entry_c = loop_head->in(LoopNode::EntryControl);
IdealLoopTree *entry_loop = phase->get_loop(entry_c);
@@ -4043,13 +4051,25 @@
}
c = next;
}
assert(phase->is_dominator(phase->get_ctrl(load->in(MemNode::Address)), entry_c), "address not out of loop?");
+ } else {
+ IdealLoopTree *loop = phase->get_loop(iff);
+ Node* loop_head = loop->_head;
+ Node* entry_c = loop_head->in(LoopNode::EntryControl);
+
+ Node* load = iff->in(1)->in(1)->in(1);
+ assert(load->Opcode() == Op_LoadUB, "inconsistent");
+ Node* mem_ctrl = NULL;
+ }
}
void ShenandoahWriteBarrierNode::backtoback_evacs(IfNode* iff, IfNode* dom_if, PhaseIdealLoop* phase) {
+ if (!ShenandoahWriteBarrierMemBar) {
+ return;
+ }
// move all mem barriers from this evac test to the dominating one,
// removing duplicates in the process
IdealLoopTree *loop = phase->get_loop(dom_if);
Node* c1 = iff->in(0);
Node* mb1 = NULL;
< prev index next >