# HG changeset patch # Parent 8d0505df77a82e1e8cde2a10cb445bf4819f36b3 diff --git a/src/hotspot/share/opto/compile.cpp b/src/hotspot/share/opto/compile.cpp --- a/src/hotspot/share/opto/compile.cpp +++ b/src/hotspot/share/opto/compile.cpp @@ -3381,7 +3381,7 @@ } case Op_If: { #ifdef ASSERT - if (ShenandoahWriteBarrierNode::is_evacuation_in_progress_test(n->as_If())) { + if (ShenandoahWBWithMemBar && ShenandoahWriteBarrierNode::is_evacuation_in_progress_test(n->as_If())) { Node* c = n->in(0); int count = 0; for (;;) { diff --git a/src/hotspot/share/opto/shenandoahSupport.cpp b/src/hotspot/share/opto/shenandoahSupport.cpp --- a/src/hotspot/share/opto/shenandoahSupport.cpp +++ b/src/hotspot/share/opto/shenandoahSupport.cpp @@ -595,10 +595,12 @@ Node* ShenandoahWriteBarrierNode::evacuation_in_progress_test_ctrl(Node* iff) { assert(is_evacuation_in_progress_test(iff), "bad input"); Node* c = iff; - 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); + if (ShenandoahWBWithMemBar) { + 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); } @@ -3480,30 +3482,33 @@ evacuation_in_progress_adr_type, TypeInt::BOOL, MemNode::unordered); phase->register_new_node(evacuation_in_progress, ctrl); - 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); - phase->register_control(ctrl_proj, loop, mb); - raw_mem = new ProjNode(mb, TypeFunc::Memory); - phase->register_new_node(raw_mem, mb); - - mb = MemBarNode::make(phase->C, Op_MemBarAcquire, alias); - mb->init_req(TypeFunc::Control, ctrl_proj); - mb->init_req(TypeFunc::Memory, wb_mem); - phase->register_control(mb, loop, ctrl_proj); - 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); + if (ShenandoahWBWithMemBar) { + 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); + phase->register_control(ctrl_proj, loop, mb); + raw_mem = new ProjNode(mb, TypeFunc::Memory); + phase->register_new_node(raw_mem, mb); + + mb = MemBarNode::make(phase->C, Op_MemBarAcquire, alias); + mb->init_req(TypeFunc::Control, ctrl_proj); + mb->init_req(TypeFunc::Memory, wb_mem); + phase->register_control(mb, loop, ctrl_proj); + 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); + ctrl = ctrl_proj; + } 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), "inconsistent"); @@ -3909,6 +3914,7 @@ } void ShenandoahWriteBarrierNode::move_evacuation_test_out_of_loop(IfNode* iff, PhaseIdealLoop* phase) { + if (!ShenandoahWBWithMemBar) return; // move test and its mem barriers out of the loop assert(is_evacuation_in_progress_test(iff), "inconsistent"); @@ -3941,7 +3947,6 @@ assert(new_proj_mem->outcnt() >= 1, "memory projection is disconnected"); new_mbs.push(new_proj_ctrl); } while (mb->adr_type() != TypeRawPtr::BOTTOM); - c = entry_c; for (int i = new_mbs.length()-1; i >= 0; i--) { Node* proj_ctrl = new_mbs.at(i); @@ -3989,6 +3994,7 @@ } void ShenandoahWriteBarrierNode::backtoback_evacs(IfNode* iff, IfNode* dom_if, PhaseIdealLoop* phase) { + if (!ShenandoahWBWithMemBar) 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);