# HG changeset patch # Parent 73d0d1848c5877985e2a82c5cff56509ad72d58d diff -r 73d0d1848c58 src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp --- a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp Wed Apr 03 13:33:31 2019 +0200 +++ b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.cpp Wed Apr 03 15:27:31 2019 +0200 @@ -66,7 +66,7 @@ } #endif - if (!dest_uninitialized && !ShenandoahHeap::heap()->heuristics()->can_do_traversal_gc()) { + if (!dest_uninitialized) { Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread); #ifndef _LP64 __ push(thread); @@ -342,37 +342,6 @@ #endif } -void ShenandoahBarrierSetAssembler::storeval_barrier(MacroAssembler* masm, Register dst, Register tmp) { - if (ShenandoahStoreValEnqueueBarrier) { - storeval_barrier_impl(masm, dst, tmp); - } -} - -void ShenandoahBarrierSetAssembler::storeval_barrier_impl(MacroAssembler* masm, Register dst, Register tmp) { - assert(ShenandoahStoreValEnqueueBarrier, "should be enabled"); - - if (dst == noreg) return; - -#ifdef _LP64 - if (ShenandoahStoreValEnqueueBarrier) { - // The set of registers to be saved+restored is the same as in the write-barrier above. - // Those are the commonly used registers in the interpreter. - __ pusha(); - // __ push_callee_saved_registers(); - __ subptr(rsp, 2 * Interpreter::stackElementSize); - __ movdbl(Address(rsp, 0), xmm0); - - satb_write_barrier_pre(masm, noreg, dst, r15_thread, tmp, true, false); - __ movdbl(xmm0, Address(rsp, 0)); - __ addptr(rsp, 2 * Interpreter::stackElementSize); - //__ pop_callee_saved_registers(); - __ popa(); - } -#else - Unimplemented(); -#endif -} - void ShenandoahBarrierSetAssembler::load_reference_barrier(MacroAssembler* masm, Register dst) { if (ShenandoahLoadRefBarrier) { Label done; @@ -446,12 +415,7 @@ val != noreg /* tosca_live */, false /* expand_call */); } - if (val == noreg) { - BarrierSetAssembler::store_at(masm, decorators, type, Address(tmp1, 0), val, noreg, noreg); - } else { - storeval_barrier(masm, val, tmp3); - BarrierSetAssembler::store_at(masm, decorators, type, Address(tmp1, 0), val, noreg, noreg); - } + BarrierSetAssembler::store_at(masm, decorators, type, Address(tmp1, 0), val, noreg, noreg); NOT_LP64(imasm->restore_bcp()); } else { BarrierSetAssembler::store_at(masm, decorators, type, dst, val, tmp1, tmp2); diff -r 73d0d1848c58 src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.hpp --- a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.hpp Wed Apr 03 13:33:31 2019 +0200 +++ b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetAssembler_x86.hpp Wed Apr 03 15:27:31 2019 +0200 @@ -60,8 +60,6 @@ void load_reference_barrier_not_null(MacroAssembler* masm, Register dst); - void storeval_barrier_impl(MacroAssembler* masm, Register dst, Register tmp); - address generate_shenandoah_lrb(StubCodeGenerator* cgen); void save_vector_registers(MacroAssembler* masm); @@ -70,7 +68,6 @@ public: static address shenandoah_lrb(); - void storeval_barrier(MacroAssembler* masm, Register dst, Register tmp); #ifdef COMPILER1 void gen_pre_barrier_stub(LIR_Assembler* ce, ShenandoahPreBarrierStub* stub); void gen_load_reference_barrier_stub(LIR_Assembler* ce, ShenandoahLoadReferenceBarrierStub* stub); diff -r 73d0d1848c58 src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetC1_x86.cpp --- a/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetC1_x86.cpp Wed Apr 03 13:33:31 2019 +0200 +++ b/src/hotspot/cpu/x86/gc/shenandoah/shenandoahBarrierSetC1_x86.cpp Wed Apr 03 15:27:31 2019 +0200 @@ -43,9 +43,6 @@ assert(cmpval != addr, "cmp and addr must be in different registers"); assert(newval != addr, "new value and addr must be in different registers"); - // Apply storeval barrier to newval. - ShenandoahBarrierSet::assembler()->storeval_barrier(masm->masm(), newval, tmp1); - if (UseCompressedOops) { __ encode_heap_oop(cmpval); __ mov(rscratch1, newval); @@ -96,10 +93,6 @@ value.load_item(); LIR_Opr value_opr = value.result(); - if (access.is_oop()) { - value_opr = storeval_barrier(access.gen(), value_opr, access.access_emit_info(), access.decorators()); - } - // Because we want a 2-arg form of xchg and xadd __ move(value_opr, result); diff -r 73d0d1848c58 src/hotspot/share/gc/shenandoah/c1/shenandoahBarrierSetC1.cpp --- a/src/hotspot/share/gc/shenandoah/c1/shenandoahBarrierSetC1.cpp Wed Apr 03 13:33:31 2019 +0200 +++ b/src/hotspot/share/gc/shenandoah/c1/shenandoahBarrierSetC1.cpp Wed Apr 03 15:27:31 2019 +0200 @@ -164,20 +164,9 @@ return obj; } -LIR_Opr ShenandoahBarrierSetC1::storeval_barrier(LIRGenerator* gen, LIR_Opr obj, CodeEmitInfo* info, DecoratorSet decorators) { - if (ShenandoahStoreValEnqueueBarrier) { - obj = ensure_in_register(gen, obj); - pre_barrier(gen, info, decorators, LIR_OprFact::illegalOpr, obj); - } - return obj; -} - void ShenandoahBarrierSetC1::store_at_resolved(LIRAccess& access, LIR_Opr value) { - if (access.is_oop()) { - if (ShenandoahSATBBarrier) { - pre_barrier(access.gen(), access.access_emit_info(), access.decorators(), access.resolved_addr(), LIR_OprFact::illegalOpr /* pre_val */); - } - value = storeval_barrier(access.gen(), value, access.access_emit_info(), access.decorators()); + if (access.is_oop() && ShenandoahSATBBarrier) { + pre_barrier(access.gen(), access.access_emit_info(), access.decorators(), access.resolved_addr(), LIR_OprFact::illegalOpr /* pre_val */); } BarrierSetC1::store_at_resolved(access, value); } diff -r 73d0d1848c58 src/hotspot/share/gc/shenandoah/c1/shenandoahBarrierSetC1.hpp --- a/src/hotspot/share/gc/shenandoah/c1/shenandoahBarrierSetC1.hpp Wed Apr 03 13:33:31 2019 +0200 +++ b/src/hotspot/share/gc/shenandoah/c1/shenandoahBarrierSetC1.hpp Wed Apr 03 15:27:31 2019 +0200 @@ -182,7 +182,6 @@ void pre_barrier(LIRGenerator* gen, CodeEmitInfo* info, DecoratorSet decorators, LIR_Opr addr_opr, LIR_Opr pre_val); LIR_Opr load_reference_barrier(LIRGenerator* gen, LIR_Opr obj, CodeEmitInfo* info, bool need_null_check); - LIR_Opr storeval_barrier(LIRGenerator* gen, LIR_Opr obj, CodeEmitInfo* info, DecoratorSet decorators); LIR_Opr load_reference_barrier_impl(LIRGenerator* gen, LIR_Opr obj, CodeEmitInfo* info, bool need_null_check); diff -r 73d0d1848c58 src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp --- a/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp Wed Apr 03 13:33:31 2019 +0200 +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp Wed Apr 03 15:27:31 2019 +0200 @@ -43,27 +43,7 @@ } ShenandoahBarrierSetC2State::ShenandoahBarrierSetC2State(Arena* comp_arena) - : _enqueue_barriers(new (comp_arena) GrowableArray(comp_arena, 8, 0, NULL)), - _load_reference_barriers(new (comp_arena) GrowableArray(comp_arena, 8, 0, NULL)) { -} - -int ShenandoahBarrierSetC2State::enqueue_barriers_count() const { - return _enqueue_barriers->length(); -} - -ShenandoahEnqueueBarrierNode* ShenandoahBarrierSetC2State::enqueue_barrier(int idx) const { - return _enqueue_barriers->at(idx); -} - -void ShenandoahBarrierSetC2State::add_enqueue_barrier(ShenandoahEnqueueBarrierNode * n) { - assert(!_enqueue_barriers->contains(n), "duplicate entry in barrier list"); - _enqueue_barriers->append(n); -} - -void ShenandoahBarrierSetC2State::remove_enqueue_barrier(ShenandoahEnqueueBarrierNode * n) { - if (_enqueue_barriers->contains(n)) { - _enqueue_barriers->remove(n); - } + : _load_reference_barriers(new (comp_arena) GrowableArray(comp_arena, 8, 0, NULL)) { } int ShenandoahBarrierSetC2State::load_reference_barriers_count() const { @@ -85,13 +65,6 @@ } } -Node* ShenandoahBarrierSetC2::shenandoah_storeval_barrier(GraphKit* kit, Node* obj) const { - if (ShenandoahStoreValEnqueueBarrier) { - obj = shenandoah_enqueue_barrier(kit, obj); - } - return obj; -} - #define __ kit-> bool ShenandoahBarrierSetC2::satb_can_remove_pre_barrier(GraphKit* kit, PhaseTransform* phase, Node* adr, @@ -238,7 +211,7 @@ Node* marking; Node* gc_state = __ AddP(no_base, tls, __ ConX(in_bytes(ShenandoahThreadLocalData::gc_state_offset()))); Node* ld = __ load(__ ctrl(), gc_state, TypeInt::BYTE, T_BYTE, Compile::AliasIdxRaw); - marking = __ AndI(ld, __ ConI(ShenandoahHeap::MARKING)); + marking = __ AndI(ld, __ ConI(ShenandoahHeap::MARKING | ShenandoahHeap::TRAVERSAL)); assert(ShenandoahBarrierC2Support::is_gc_state_load(ld), "Should match the shape"); // if (!marking) @@ -311,7 +284,7 @@ cmpx->is_Cmp() && cmpx->in(2) == phase->intcon(0) && is_shenandoah_state_load(cmpx->in(1)->in(1)) && cmpx->in(1)->in(2)->is_Con() && - cmpx->in(1)->in(2) == phase->intcon(ShenandoahHeap::MARKING)) { + cmpx->in(1)->in(2) == phase->intcon(ShenandoahHeap::MARKING | ShenandoahHeap::TRAVERSAL)) { return true; } @@ -346,10 +319,6 @@ } } -Node* ShenandoahBarrierSetC2::shenandoah_enqueue_barrier(GraphKit* kit, Node* pre_val) const { - return kit->gvn().transform(new ShenandoahEnqueueBarrierNode(pre_val)); -} - // Helper that guards and inserts a pre-barrier. void ShenandoahBarrierSetC2::insert_pre_barrier(GraphKit* kit, Node* base_oop, Node* offset, Node* pre_val, bool need_mem_bar) const { @@ -503,9 +472,6 @@ uint adr_idx = kit->C->get_alias_index(adr_type); assert(adr_idx != Compile::AliasIdxTop, "use other store_to_memory factory" ); - Node* value = val.node(); - value = shenandoah_storeval_barrier(kit, value); - val.set_node(value); shenandoah_write_barrier_pre(kit, true /* do_load */, /*kit->control(),*/ access.base(), adr, adr_idx, val.node(), static_cast(val.type()), NULL /* pre_val */, access.type()); } else { @@ -514,11 +480,6 @@ C2OptAccess& opt_access = static_cast(access); PhaseGVN& gvn = opt_access.gvn(); MergeMemNode* mm = opt_access.mem(); - - if (ShenandoahStoreValEnqueueBarrier) { - Node* enqueue = gvn.transform(new ShenandoahEnqueueBarrierNode(val.node())); - val.set_node(enqueue); - } } return BarrierSetC2::store_at_resolved(access, val); } @@ -590,7 +551,6 @@ Node* new_val, const Type* value_type) const { GraphKit* kit = access.kit(); if (access.is_oop()) { - new_val = shenandoah_storeval_barrier(kit, new_val); shenandoah_write_barrier_pre(kit, false /* do_load */, NULL, NULL, max_juint, NULL, NULL, expected_val /* pre_val */, T_OBJECT); @@ -638,7 +598,6 @@ Node* new_val, const Type* value_type) const { GraphKit* kit = access.kit(); if (access.is_oop()) { - new_val = shenandoah_storeval_barrier(kit, new_val); shenandoah_write_barrier_pre(kit, false /* do_load */, NULL, NULL, max_juint, NULL, NULL, expected_val /* pre_val */, T_OBJECT); @@ -691,9 +650,6 @@ Node* ShenandoahBarrierSetC2::atomic_xchg_at_resolved(C2AtomicParseAccess& access, Node* val, const Type* value_type) const { GraphKit* kit = access.kit(); - if (access.is_oop()) { - val = shenandoah_storeval_barrier(kit, val); - } Node* result = BarrierSetC2::atomic_xchg_at_resolved(access, val, value_type); if (access.is_oop()) { result = kit->gvn().transform(new ShenandoahLoadReferenceBarrierNode(NULL, result)); @@ -753,9 +709,6 @@ if (c->Opcode() == Op_ShenandoahLoadReferenceBarrier) { return c->in(ShenandoahLoadReferenceBarrierNode::ValueIn); } - if (c->Opcode() == Op_ShenandoahEnqueueBarrier) { - c = c->in(1); - } return c; } @@ -788,9 +741,6 @@ } return !is_clone; } - if (phase == Optimization) { - return !ShenandoahStoreValEnqueueBarrier; - } return true; } @@ -862,18 +812,12 @@ // Support for macro expanded GC barriers void ShenandoahBarrierSetC2::register_potential_barrier_node(Node* node) const { - if (node->Opcode() == Op_ShenandoahEnqueueBarrier) { - state()->add_enqueue_barrier((ShenandoahEnqueueBarrierNode*) node); - } if (node->Opcode() == Op_ShenandoahLoadReferenceBarrier) { state()->add_load_reference_barrier((ShenandoahLoadReferenceBarrierNode*) node); } } void ShenandoahBarrierSetC2::unregister_potential_barrier_node(Node* node) const { - if (node->Opcode() == Op_ShenandoahEnqueueBarrier) { - state()->remove_enqueue_barrier((ShenandoahEnqueueBarrierNode*) node); - } if (node->Opcode() == Op_ShenandoahLoadReferenceBarrier) { state()->remove_load_reference_barrier((ShenandoahLoadReferenceBarrierNode*) node); } @@ -921,12 +865,6 @@ } } } - for (int i = state()->enqueue_barriers_count() - 1; i >= 0; i--) { - ShenandoahEnqueueBarrierNode* n = state()->enqueue_barrier(i); - if (!useful.member(n)) { - state()->remove_enqueue_barrier(n); - } - } for (int i = state()->load_reference_barriers_count() - 1; i >= 0; i--) { ShenandoahLoadReferenceBarrierNode* n = state()->load_reference_barrier(i); if (!useful.member(n)) { @@ -1174,9 +1112,6 @@ } return false; } - case Op_ShenandoahEnqueueBarrier: - conn_graph->add_local_var_and_edge(n, PointsToNode::NoEscape, n->in(1), delayed_worklist); - break; case Op_ShenandoahLoadReferenceBarrier: conn_graph->add_local_var_and_edge(n, PointsToNode::NoEscape, n->in(ShenandoahLoadReferenceBarrierNode::ValueIn), delayed_worklist); return true; @@ -1200,9 +1135,6 @@ case Op_ShenandoahWeakCompareAndSwapP: case Op_ShenandoahWeakCompareAndSwapN: return conn_graph->add_final_edges_unsafe_access(n, opcode); - case Op_ShenandoahEnqueueBarrier: - conn_graph->add_local_var_and_edge(n, PointsToNode::NoEscape, n->in(1), NULL); - return true; case Op_ShenandoahLoadReferenceBarrier: conn_graph->add_local_var_and_edge(n, PointsToNode::NoEscape, n->in(ShenandoahLoadReferenceBarrierNode::ValueIn), NULL); return true; diff -r 73d0d1848c58 src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.hpp --- a/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.hpp Wed Apr 03 13:33:31 2019 +0200 +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.hpp Wed Apr 03 15:27:31 2019 +0200 @@ -30,17 +30,11 @@ class ShenandoahBarrierSetC2State : public ResourceObj { private: - GrowableArray* _enqueue_barriers; GrowableArray* _load_reference_barriers; public: ShenandoahBarrierSetC2State(Arena* comp_arena); - int enqueue_barriers_count() const; - ShenandoahEnqueueBarrierNode* enqueue_barrier(int idx) const; - void add_enqueue_barrier(ShenandoahEnqueueBarrierNode* n); - void remove_enqueue_barrier(ShenandoahEnqueueBarrierNode * n); - int load_reference_barriers_count() const; ShenandoahLoadReferenceBarrierNode* load_reference_barrier(int idx) const; void add_load_reference_barrier(ShenandoahLoadReferenceBarrierNode* n); @@ -72,9 +66,6 @@ Node* pre_val, BasicType bt) const; - Node* shenandoah_enqueue_barrier(GraphKit* kit, Node* val) const; - Node* shenandoah_storeval_barrier(GraphKit* kit, Node* obj) const; - void insert_pre_barrier(GraphKit* kit, Node* base_oop, Node* offset, Node* pre_val, bool need_mem_bar) const; diff -r 73d0d1848c58 src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp --- a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp Wed Apr 03 13:33:31 2019 +0200 +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp Wed Apr 03 15:27:31 2019 +0200 @@ -43,8 +43,7 @@ bool ShenandoahBarrierC2Support::expand(Compile* C, PhaseIterGVN& igvn) { ShenandoahBarrierSetC2State* state = ShenandoahBarrierSetC2::bsc2()->state(); - if ((state->enqueue_barriers_count() + - state->load_reference_barriers_count()) > 0) { + if (state->load_reference_barriers_count() > 0) { bool attempt_more_loopopts = ShenandoahLoopOptsAfterExpansion; C->clear_major_progress(); PhaseIdealLoop ideal_loop(igvn, LoopOptsShenandoahExpand); @@ -213,9 +212,6 @@ uint i = 0; for (; i < phis.size(); i++) { Node* n = phis.node_at(i); - if (n->Opcode() == Op_ShenandoahEnqueueBarrier) { - break; - } } if (i == phis.size()) { return false; @@ -223,15 +219,6 @@ } barriers_used.push(in); if (trace) {tty->print("Found barrier"); in->dump();} - } else if (in->Opcode() == Op_ShenandoahEnqueueBarrier) { - if (t != ShenandoahOopStore) { - in = in->in(1); - continue; - } - if (trace) {tty->print("Found enqueue barrier"); in->dump();} - phis.push(in, in->req()); - in = in->in(1); - continue; } else if (in->is_Proj() && in->in(0)->is_Allocate()) { if (trace) { tty->print("Found alloc"); @@ -376,7 +363,7 @@ } } - if (verify && !verify_helper(n->in(MemNode::ValueIn), phis, visited, ShenandoahStoreValEnqueueBarrier ? ShenandoahOopStore : ShenandoahValue, trace, barriers_used)) { + if (verify && !verify_helper(n->in(MemNode::ValueIn), phis, visited, ShenandoahValue, trace, barriers_used)) { report_verify_failure("Shenandoah verification: Store should have barriers", n); } } @@ -418,7 +405,7 @@ } } else if (n->is_LoadStore()) { if (n->in(MemNode::ValueIn)->bottom_type()->make_ptr() && - !verify_helper(n->in(MemNode::ValueIn), phis, visited, ShenandoahStoreValEnqueueBarrier ? ShenandoahOopStore : ShenandoahValue, trace, barriers_used)) { + !verify_helper(n->in(MemNode::ValueIn), phis, visited, ShenandoahValue, trace, barriers_used)) { report_verify_failure("Shenandoah verification: LoadStore (value) should have barriers", n); } @@ -567,7 +554,7 @@ } } } - } else if (n->Opcode() == Op_ShenandoahEnqueueBarrier || n->Opcode() == Op_ShenandoahLoadReferenceBarrier) { + } else if (n->Opcode() == Op_ShenandoahLoadReferenceBarrier) { // skip } else if (n->is_AddP() || n->is_Phi() @@ -697,7 +684,6 @@ n->Opcode() == Op_SCMemProj || n->Opcode() == Op_EncodeP || n->Opcode() == Op_DecodeN || - n->Opcode() == Op_ShenandoahEnqueueBarrier || n->Opcode() == Op_ShenandoahLoadReferenceBarrier)) { if (m->bottom_type()->make_oopptr() && m->bottom_type()->make_oopptr()->meet(TypePtr::NULL_PTR) == m->bottom_type()) { report_verify_failure("Shenandoah verification: null input", n, m); @@ -1198,19 +1184,6 @@ GrowableArray memory_graph_fixers; Unique_Node_List uses; - for (int i = 0; i < state->enqueue_barriers_count(); i++) { - Node* barrier = state->enqueue_barrier(i); - Node* ctrl = phase->get_ctrl(barrier); - IdealLoopTree* loop = phase->get_loop(ctrl); - if (loop->_head->is_OuterStripMinedLoop()) { - // Expanding a barrier here will break loop strip mining - // verification. Transform the loop so the loop nest doesn't - // appear as strip mined. - OuterStripMinedLoopNode* outer = loop->_head->as_OuterStripMinedLoop(); - hide_strip_mined_loop(outer, outer->unique_ctrl_out()->as_CountedLoop(), phase); - } - } - Node_Stack stack(0); Node_List clones; for (int i = state->load_reference_barriers_count() - 1; i >= 0; i--) { @@ -1588,157 +1561,6 @@ } // Done expanding load-reference-barriers. assert(ShenandoahBarrierSetC2::bsc2()->state()->load_reference_barriers_count() == 0, "all load reference barrier nodes should have been replaced"); - - for (int i = state->enqueue_barriers_count() - 1; i >= 0; i--) { - Node* barrier = state->enqueue_barrier(i); - Node* pre_val = barrier->in(1); - - if (phase->igvn().type(pre_val)->higher_equal(TypePtr::NULL_PTR)) { - ShouldNotReachHere(); - continue; - } - - Node* ctrl = phase->get_ctrl(barrier); - - if (ctrl->is_Proj() && ctrl->in(0)->is_CallJava()) { - assert(is_dominator(phase->get_ctrl(pre_val), ctrl->in(0)->in(0), pre_val, ctrl->in(0), phase), "can't move"); - ctrl = ctrl->in(0)->in(0); - phase->set_ctrl(barrier, ctrl); - } else if (ctrl->is_CallRuntime()) { - assert(is_dominator(phase->get_ctrl(pre_val), ctrl->in(0), pre_val, ctrl, phase), "can't move"); - ctrl = ctrl->in(0); - phase->set_ctrl(barrier, ctrl); - } - - Node* init_ctrl = ctrl; - IdealLoopTree* loop = phase->get_loop(ctrl); - Node* raw_mem = fixer.find_mem(ctrl, barrier); - Node* init_raw_mem = raw_mem; - Node* raw_mem_for_ctrl = fixer.find_mem(ctrl, NULL); - Node* heap_stable_ctrl = NULL; - Node* null_ctrl = NULL; - uint last = phase->C->unique(); - - enum { _heap_stable = 1, _heap_unstable, PATH_LIMIT }; - Node* region = new RegionNode(PATH_LIMIT); - Node* phi = PhiNode::make(region, raw_mem, Type::MEMORY, TypeRawPtr::BOTTOM); - - enum { _fast_path = 1, _slow_path, _null_path, PATH_LIMIT2 }; - Node* region2 = new RegionNode(PATH_LIMIT2); - Node* phi2 = PhiNode::make(region2, raw_mem, Type::MEMORY, TypeRawPtr::BOTTOM); - - // Stable path. - test_heap_stable(ctrl, raw_mem, heap_stable_ctrl, phase); - region->init_req(_heap_stable, heap_stable_ctrl); - phi->init_req(_heap_stable, raw_mem); - - // Null path - Node* reg2_ctrl = NULL; - test_null(ctrl, pre_val, null_ctrl, phase); - if (null_ctrl != NULL) { - reg2_ctrl = null_ctrl->in(0); - region2->init_req(_null_path, null_ctrl); - phi2->init_req(_null_path, raw_mem); - } else { - region2->del_req(_null_path); - phi2->del_req(_null_path); - } - - const int index_offset = in_bytes(ShenandoahThreadLocalData::satb_mark_queue_index_offset()); - const int buffer_offset = in_bytes(ShenandoahThreadLocalData::satb_mark_queue_buffer_offset()); - Node* thread = new ThreadLocalNode(); - phase->register_new_node(thread, ctrl); - Node* buffer_adr = new AddPNode(phase->C->top(), thread, phase->igvn().MakeConX(buffer_offset)); - phase->register_new_node(buffer_adr, ctrl); - Node* index_adr = new AddPNode(phase->C->top(), thread, phase->igvn().MakeConX(index_offset)); - phase->register_new_node(index_adr, ctrl); - - BasicType index_bt = TypeX_X->basic_type(); - assert(sizeof(size_t) == type2aelembytes(index_bt), "Loading G1 SATBMarkQueue::_index with wrong size."); - const TypePtr* adr_type = TypeRawPtr::BOTTOM; - Node* index = new LoadXNode(ctrl, raw_mem, index_adr, adr_type, TypeX_X, MemNode::unordered); - phase->register_new_node(index, ctrl); - Node* index_cmp = new CmpXNode(index, phase->igvn().MakeConX(0)); - phase->register_new_node(index_cmp, ctrl); - Node* index_test = new BoolNode(index_cmp, BoolTest::ne); - phase->register_new_node(index_test, ctrl); - IfNode* queue_full_iff = new IfNode(ctrl, index_test, PROB_LIKELY(0.999), COUNT_UNKNOWN); - if (reg2_ctrl == NULL) reg2_ctrl = queue_full_iff; - phase->register_control(queue_full_iff, loop, ctrl); - Node* not_full = new IfTrueNode(queue_full_iff); - phase->register_control(not_full, loop, queue_full_iff); - Node* full = new IfFalseNode(queue_full_iff); - phase->register_control(full, loop, queue_full_iff); - - ctrl = not_full; - - Node* next_index = new SubXNode(index, phase->igvn().MakeConX(sizeof(intptr_t))); - phase->register_new_node(next_index, ctrl); - - Node* buffer = new LoadPNode(ctrl, raw_mem, buffer_adr, adr_type, TypeRawPtr::NOTNULL, MemNode::unordered); - phase->register_new_node(buffer, ctrl); - Node *log_addr = new AddPNode(phase->C->top(), buffer, next_index); - phase->register_new_node(log_addr, ctrl); - Node* log_store = new StorePNode(ctrl, raw_mem, log_addr, adr_type, pre_val, MemNode::unordered); - phase->register_new_node(log_store, ctrl); - // update the index - Node* index_update = new StoreXNode(ctrl, log_store, index_adr, adr_type, next_index, MemNode::unordered); - phase->register_new_node(index_update, ctrl); - - // Fast-path case - region2->init_req(_fast_path, ctrl); - phi2->init_req(_fast_path, index_update); - - ctrl = full; - - Node* base = find_bottom_mem(ctrl, phase); - - MergeMemNode* mm = MergeMemNode::make(base); - mm->set_memory_at(Compile::AliasIdxRaw, raw_mem); - phase->register_new_node(mm, ctrl); - - Node* call = new CallLeafNode(ShenandoahBarrierSetC2::write_ref_field_pre_entry_Type(), CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_field_pre_entry), "shenandoah_wb_pre", TypeRawPtr::BOTTOM); - call->init_req(TypeFunc::Control, ctrl); - call->init_req(TypeFunc::I_O, phase->C->top()); - call->init_req(TypeFunc::Memory, mm); - call->init_req(TypeFunc::FramePtr, phase->C->top()); - call->init_req(TypeFunc::ReturnAdr, phase->C->top()); - call->init_req(TypeFunc::Parms, pre_val); - call->init_req(TypeFunc::Parms+1, thread); - phase->register_control(call, loop, ctrl); - - Node* ctrl_proj = new ProjNode(call, TypeFunc::Control); - phase->register_control(ctrl_proj, loop, call); - Node* mem_proj = new ProjNode(call, TypeFunc::Memory); - phase->register_new_node(mem_proj, call); - - // Slow-path case - region2->init_req(_slow_path, ctrl_proj); - phi2->init_req(_slow_path, mem_proj); - - phase->register_control(region2, loop, reg2_ctrl); - phase->register_new_node(phi2, region2); - - region->init_req(_heap_unstable, region2); - phi->init_req(_heap_unstable, phi2); - - phase->register_control(region, loop, heap_stable_ctrl->in(0)); - phase->register_new_node(phi, region); - - fix_ctrl(barrier, region, fixer, uses, uses_to_ignore, last, phase); - for(uint next = 0; next < uses.size(); next++ ) { - Node *n = uses.at(next); - assert(phase->get_ctrl(n) == init_ctrl, "bad control"); - assert(n != init_raw_mem, "should leave input raw mem above the barrier"); - phase->set_ctrl(n, region); - follow_barrier_uses(n, init_ctrl, uses, phase); - } - fixer.fix_mem(init_ctrl, region, init_raw_mem, raw_mem_for_ctrl, phi, uses); - - phase->igvn().replace_node(barrier, pre_val); - } - assert(state->enqueue_barriers_count() == 0, "all enqueue barrier nodes should have been replaced"); - } void ShenandoahBarrierC2Support::move_heap_stable_test_out_of_loop(IfNode* iff, PhaseIdealLoop* phase) { @@ -2067,126 +1889,6 @@ } #endif -ShenandoahEnqueueBarrierNode::ShenandoahEnqueueBarrierNode(Node* val) : Node(NULL, val) { - ShenandoahBarrierSetC2::bsc2()->state()->add_enqueue_barrier(this); -} - -const Type* ShenandoahEnqueueBarrierNode::bottom_type() const { - if (in(1) == NULL || in(1)->is_top()) { - return Type::TOP; - } - const Type* t = in(1)->bottom_type(); - if (t == TypePtr::NULL_PTR) { - return t; - } - return t->is_oopptr()->cast_to_nonconst(); -} - -const Type* ShenandoahEnqueueBarrierNode::Value(PhaseGVN* phase) const { - if (in(1) == NULL) { - return Type::TOP; - } - const Type* t = phase->type(in(1)); - if (t == Type::TOP) { - return Type::TOP; - } - if (t == TypePtr::NULL_PTR) { - return t; - } - return t->is_oopptr()->cast_to_nonconst(); -} - -int ShenandoahEnqueueBarrierNode::needed(Node* n) { - if (n == NULL || - n->is_Allocate() || - n->Opcode() == Op_ShenandoahEnqueueBarrier || - n->bottom_type() == TypePtr::NULL_PTR || - (n->bottom_type()->make_oopptr() != NULL && n->bottom_type()->make_oopptr()->const_oop() != NULL)) { - return NotNeeded; - } - if (n->is_Phi() || - n->is_CMove()) { - return MaybeNeeded; - } - return Needed; -} - -Node* ShenandoahEnqueueBarrierNode::next(Node* n) { - for (;;) { - if (n == NULL) { - return n; - } else if (n->bottom_type() == TypePtr::NULL_PTR) { - return n; - } else if (n->bottom_type()->make_oopptr() != NULL && n->bottom_type()->make_oopptr()->const_oop() != NULL) { - return n; - } else if (n->is_ConstraintCast() || - n->Opcode() == Op_DecodeN || - n->Opcode() == Op_EncodeP) { - n = n->in(1); - } else if (n->is_Proj()) { - n = n->in(0); - } else { - return n; - } - } - ShouldNotReachHere(); - return NULL; -} - -Node* ShenandoahEnqueueBarrierNode::Identity(PhaseGVN* phase) { - PhaseIterGVN* igvn = phase->is_IterGVN(); - - Node* n = next(in(1)); - - int cont = needed(n); - - if (cont == NotNeeded) { - return in(1); - } else if (cont == MaybeNeeded) { - if (igvn == NULL) { - phase->record_for_igvn(this); - return this; - } else { - ResourceMark rm; - Unique_Node_List wq; - uint wq_i = 0; - - for (;;) { - if (n->is_Phi()) { - for (uint i = 1; i < n->req(); i++) { - Node* m = n->in(i); - if (m != NULL) { - wq.push(m); - } - } - } else { - assert(n->is_CMove(), "nothing else here"); - Node* m = n->in(CMoveNode::IfFalse); - wq.push(m); - m = n->in(CMoveNode::IfTrue); - wq.push(m); - } - Node* orig_n = NULL; - do { - if (wq_i >= wq.size()) { - return in(1); - } - n = wq.at(wq_i); - wq_i++; - orig_n = n; - n = next(n); - cont = needed(n); - if (cont == Needed) { - return this; - } - } while (cont != MaybeNeeded || (orig_n != n && wq.member(n))); - } - } - } - - return this; -} - #ifdef ASSERT static bool has_never_branch(Node* root) { for (uint i = 1; i < root->req(); i++) { @@ -3080,8 +2782,6 @@ case Op_CMoveP: return needs_barrier_impl(phase, n->in(2), visited) || needs_barrier_impl(phase, n->in(3), visited); - case Op_ShenandoahEnqueueBarrier: - return needs_barrier_impl(phase, n->in(1), visited); default: break; } @@ -3157,7 +2857,6 @@ case Op_GetAndAddI: case Op_GetAndAddB: case Op_GetAndAddS: - case Op_ShenandoahEnqueueBarrier: case Op_FastLock: case Op_FastUnlock: case Op_Rethrow: diff -r 73d0d1848c58 src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.hpp --- a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.hpp Wed Apr 03 13:33:31 2019 +0200 +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.hpp Wed Apr 03 15:27:31 2019 +0200 @@ -87,23 +87,6 @@ #endif }; -class ShenandoahEnqueueBarrierNode : public Node { -public: - ShenandoahEnqueueBarrierNode(Node* val); - - const Type *bottom_type() const; - const Type* Value(PhaseGVN* phase) const; - Node* Identity(PhaseGVN* phase); - - int Opcode() const; - -private: - enum { Needed, NotNeeded, MaybeNeeded }; - - static int needed(Node* n); - static Node* next(Node* n); -}; - class MemoryGraphFixer : public ResourceObj { private: Node_List _memory_nodes; diff -r 73d0d1848c58 src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.cpp --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.cpp Wed Apr 03 13:33:31 2019 +0200 +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahPassiveHeuristics.cpp Wed Apr 03 15:27:31 2019 +0200 @@ -46,7 +46,6 @@ SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahLoadRefBarrier); SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahSATBBarrier); SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahKeepAliveBarrier); - SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahStoreValEnqueueBarrier); SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahCASBarrier); SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahCloneBarrier); diff -r 73d0d1848c58 src/hotspot/share/gc/shenandoah/heuristics/shenandoahTraversalHeuristics.cpp --- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahTraversalHeuristics.cpp Wed Apr 03 13:33:31 2019 +0200 +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahTraversalHeuristics.cpp Wed Apr 03 15:27:31 2019 +0200 @@ -34,26 +34,17 @@ #include "utilities/quickSort.hpp" ShenandoahTraversalHeuristics::ShenandoahTraversalHeuristics() : ShenandoahHeuristics(), - _last_cset_select(0) - { - FLAG_SET_DEFAULT(ShenandoahSATBBarrier, false); - FLAG_SET_DEFAULT(ShenandoahStoreValEnqueueBarrier, true); - FLAG_SET_DEFAULT(ShenandoahKeepAliveBarrier, false); + _last_cset_select(0) { + FLAG_SET_DEFAULT(ShenandoahAllowMixedAllocs, false); - SHENANDOAH_ERGO_OVERRIDE_DEFAULT(ShenandoahRefProcFrequency, 1); - - // Adjust class unloading settings only if globally enabled. - if (ClassUnloadingWithConcurrentMark) { - SHENANDOAH_ERGO_OVERRIDE_DEFAULT(ShenandoahUnloadClassesFrequency, 1); - } - SHENANDOAH_ERGO_ENABLE_FLAG(ExplicitGCInvokesConcurrent); SHENANDOAH_ERGO_ENABLE_FLAG(ShenandoahImplicitGCInvokesConcurrent); // Final configuration checks SHENANDOAH_CHECK_FLAG_SET(ShenandoahLoadRefBarrier); - SHENANDOAH_CHECK_FLAG_SET(ShenandoahStoreValEnqueueBarrier); + SHENANDOAH_CHECK_FLAG_SET(ShenandoahSATBBarrier); + SHENANDOAH_CHECK_FLAG_SET(ShenandoahKeepAliveBarrier); SHENANDOAH_CHECK_FLAG_SET(ShenandoahCASBarrier); SHENANDOAH_CHECK_FLAG_SET(ShenandoahCloneBarrier); } diff -r 73d0d1848c58 src/hotspot/share/gc/shenandoah/shenandoahArguments.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahArguments.cpp Wed Apr 03 13:33:31 2019 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahArguments.cpp Wed Apr 03 15:27:31 2019 +0200 @@ -107,7 +107,6 @@ if (ShenandoahVerifyOptoBarriers && (!FLAG_IS_DEFAULT(ShenandoahSATBBarrier) || !FLAG_IS_DEFAULT(ShenandoahKeepAliveBarrier) || - !FLAG_IS_DEFAULT(ShenandoahStoreValEnqueueBarrier) || !FLAG_IS_DEFAULT(ShenandoahCASBarrier) || !FLAG_IS_DEFAULT(ShenandoahCloneBarrier) )) { diff -r 73d0d1848c58 src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp Wed Apr 03 13:33:31 2019 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.cpp Wed Apr 03 15:27:31 2019 +0200 @@ -132,7 +132,7 @@ template void ShenandoahBarrierSet::write_ref_array_pre_work(T* dst, size_t count) { shenandoah_assert_not_in_cset_loc_except(dst, _heap->cancelled_gc()); - if (ShenandoahSATBBarrier && _heap->is_concurrent_mark_in_progress()) { + if (ShenandoahSATBBarrier && _heap->is_gc_in_progress_mask(ShenandoahHeap::MARKING | ShenandoahHeap::TRAVERSAL)) { T* elem_ptr = dst; for (size_t i = 0; i < count; i++, elem_ptr++) { T heap_oop = RawAccess<>::oop_load(elem_ptr); @@ -158,7 +158,7 @@ template inline void ShenandoahBarrierSet::inline_write_ref_field_pre(T* field, oop new_val) { shenandoah_assert_not_in_cset_loc_except(field, _heap->cancelled_gc()); - if (_heap->is_concurrent_mark_in_progress()) { + if (_heap->is_gc_in_progress_mask(ShenandoahHeap::MARKING | ShenandoahHeap::TRAVERSAL)) { T heap_oop = RawAccess<>::oop_load(field); if (!CompressedOops::is_null(heap_oop)) { enqueue(CompressedOops::decode(heap_oop)); @@ -294,20 +294,14 @@ } } -void ShenandoahBarrierSet::storeval_barrier(oop obj) { - if (ShenandoahStoreValEnqueueBarrier && !CompressedOops::is_null(obj)) { - enqueue(obj); - } -} - void ShenandoahBarrierSet::keep_alive_barrier(oop obj) { - if (ShenandoahKeepAliveBarrier && _heap->is_concurrent_mark_in_progress()) { + if (ShenandoahKeepAliveBarrier && _heap->is_gc_in_progress_mask(ShenandoahHeap::MARKING | ShenandoahHeap::TRAVERSAL)) { enqueue(obj); } } void ShenandoahBarrierSet::enqueue(oop obj) { - shenandoah_assert_not_forwarded_if(NULL, obj, _heap->is_concurrent_traversal_in_progress()); + //shenandoah_assert_not_forwarded_if(NULL, obj, _heap->is_concurrent_traversal_in_progress()); if (!_satb_mark_queue_set.is_active()) return; // Filter marked objects before hitting the SATB queues. The same predicate would diff -r 73d0d1848c58 src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp Wed Apr 03 13:33:31 2019 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp Wed Apr 03 15:27:31 2019 +0200 @@ -90,7 +90,6 @@ static inline oop resolve_forwarded_not_null(oop p); static inline oop resolve_forwarded(oop p); - void storeval_barrier(oop obj); void keep_alive_barrier(oop obj); oop load_reference_barrier(oop obj); diff -r 73d0d1848c58 src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp Wed Apr 03 13:33:31 2019 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp Wed Apr 03 15:27:31 2019 +0200 @@ -76,7 +76,6 @@ template template inline void ShenandoahBarrierSet::AccessBarrier::oop_store_in_heap(T* addr, oop value) { - ShenandoahBarrierSet::barrier_set()->storeval_barrier(value); const bool keep_alive = (decorators & AS_NO_KEEPALIVE) == 0; if (keep_alive) { ShenandoahBarrierSet::barrier_set()->write_ref_field_pre_work(addr, value); @@ -109,7 +108,6 @@ template template inline oop ShenandoahBarrierSet::AccessBarrier::oop_atomic_cmpxchg_in_heap_impl(oop new_value, T* addr, oop compare_value) { - ShenandoahBarrierSet::barrier_set()->storeval_barrier(new_value); oop result = oop_atomic_cmpxchg_not_in_heap(new_value, addr, compare_value); const bool keep_alive = (decorators & AS_NO_KEEPALIVE) == 0; if (keep_alive && ShenandoahSATBBarrier && !CompressedOops::is_null(result) && @@ -148,7 +146,6 @@ template template inline oop ShenandoahBarrierSet::AccessBarrier::oop_atomic_xchg_in_heap_impl(oop new_value, T* addr) { - ShenandoahBarrierSet::barrier_set()->storeval_barrier(new_value); oop result = oop_atomic_xchg_not_in_heap(new_value, addr); const bool keep_alive = (decorators & AS_NO_KEEPALIVE) == 0; if (keep_alive && ShenandoahSATBBarrier && !CompressedOops::is_null(result)) { @@ -320,7 +317,7 @@ arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw, size_t length) { ShenandoahHeap* heap = ShenandoahHeap::heap(); - bool satb = ShenandoahSATBBarrier && heap->is_concurrent_mark_in_progress(); + bool satb = ShenandoahSATBBarrier && (heap->is_concurrent_mark_in_progress() || heap->is_concurrent_traversal_in_progress()); bool checkcast = HasDecorator::value; bool disjoint = HasDecorator::value; ArrayCopyStoreValMode storeval_mode; diff -r 73d0d1848c58 src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.cpp --- a/src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.cpp Wed Apr 03 13:33:31 2019 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.cpp Wed Apr 03 15:27:31 2019 +0200 @@ -110,7 +110,7 @@ for (size_t i = 0; i < size; ++i) { oop* p = (oop*) &buffer[i]; oop obj = RawAccess<>::oop_load(p); - shenandoah_assert_not_forwarded(p, obj); + obj = ShenandoahBarrierSet::barrier_set()->load_reference_barrier_not_null(obj); if (_heap->marking_context()->mark(obj)) { _queue->push(ShenandoahMarkTask(obj)); } @@ -121,13 +121,17 @@ class ShenandoahTraversalSATBThreadsClosure : public ThreadClosure { private: ShenandoahTraversalSATBBufferClosure* _satb_cl; + int _thread_parity; public: ShenandoahTraversalSATBThreadsClosure(ShenandoahTraversalSATBBufferClosure* satb_cl) : - _satb_cl(satb_cl) {} + _satb_cl(satb_cl), + _thread_parity(Threads::thread_claim_parity()) {} void do_thread(Thread* thread) { - ShenandoahThreadLocalData::satb_mark_queue(thread).apply_closure_and_empty(_satb_cl); + if (thread->claim_oops_do(true, _thread_parity)) { + ShenandoahThreadLocalData::satb_mark_queue(thread).apply_closure_and_empty(_satb_cl); + } } }; @@ -223,13 +227,11 @@ class ShenandoahFinalTraversalCollectionTask : public AbstractGangTask { private: - ShenandoahRootProcessor* _rp; ShenandoahTaskTerminator* _terminator; ShenandoahHeap* _heap; public: - ShenandoahFinalTraversalCollectionTask(ShenandoahRootProcessor* rp, ShenandoahTaskTerminator* terminator) : + ShenandoahFinalTraversalCollectionTask(ShenandoahTaskTerminator* terminator) : AbstractGangTask("Shenandoah Final Traversal Collection"), - _rp(rp), _terminator(terminator), _heap(ShenandoahHeap::heap()) {} @@ -250,40 +252,14 @@ } // Step 0: Drain outstanding SATB queues. - // NOTE: we piggy-back draining of remaining thread SATB buffers on the final root scan below. - ShenandoahTraversalSATBBufferClosure satb_cl(q); { // Process remaining finished SATB buffers. + ShenandoahTraversalSATBBufferClosure satb_cl(q); SATBMarkQueueSet& satb_mq_set = ShenandoahBarrierSet::satb_mark_queue_set(); while (satb_mq_set.apply_closure_to_completed_buffer(&satb_cl)); - // Process remaining threads SATB buffers below. - } - - // Step 1: Process GC roots. - // For oops in code roots, they are marked, evacuated, enqueued for further traversal, - // and the references to the oops are updated during init pause. New nmethods are handled - // in similar way during nmethod-register process. Therefore, we don't need to rescan code - // roots here. - if (!_heap->is_degenerated_gc_in_progress()) { - ShenandoahTraversalClosure roots_cl(q, rp); - CLDToOopClosure cld_cl(&roots_cl, ClassLoaderData::_claim_strong); + // Process per-thread SATB buffers. ShenandoahTraversalSATBThreadsClosure tc(&satb_cl); - if (unload_classes) { - ShenandoahRemarkCLDClosure weak_cld_cl(&roots_cl); - _rp->process_strong_roots(&roots_cl, process_refs ? NULL : &roots_cl, &cld_cl, &weak_cld_cl, NULL, &tc, worker_id); - } else { - _rp->process_all_roots(&roots_cl, process_refs ? NULL : &roots_cl, &cld_cl, NULL, &tc, worker_id); - } - } else { - ShenandoahTraversalDegenClosure roots_cl(q, rp); - CLDToOopClosure cld_cl(&roots_cl, ClassLoaderData::_claim_strong); - ShenandoahTraversalSATBThreadsClosure tc(&satb_cl); - if (unload_classes) { - ShenandoahRemarkCLDClosure weak_cld_cl(&roots_cl); - _rp->process_strong_roots(&roots_cl, process_refs ? NULL : &roots_cl, &cld_cl, &weak_cld_cl, NULL, &tc, worker_id); - } else { - _rp->process_all_roots(&roots_cl, process_refs ? NULL : &roots_cl, &cld_cl, NULL, &tc, worker_id); - } + Threads::threads_do(&tc); } { @@ -571,31 +547,28 @@ _heap->make_parsable(true); if (!_heap->cancelled_gc()) { -#if defined(COMPILER2) || INCLUDE_JVMCI - DerivedPointerTable::clear(); -#endif ShenandoahGCPhase phase_work(ShenandoahPhaseTimings::final_traversal_gc_work); uint nworkers = _heap->workers()->active_workers(); task_queues()->reserve(nworkers); // Finish traversal - ShenandoahRootProcessor rp(_heap, nworkers, ShenandoahPhaseTimings::final_traversal_gc_work); ShenandoahTerminationTracker term(ShenandoahPhaseTimings::final_traversal_gc_termination); - ShenandoahTaskTerminator terminator(nworkers, task_queues()); - ShenandoahFinalTraversalCollectionTask task(&rp, &terminator); - _heap->workers()->run_task(&task); -#if defined(COMPILER2) || INCLUDE_JVMCI - DerivedPointerTable::update_pointers(); -#endif + { + StrongRootsScope scope(nworkers); + ShenandoahFinalTraversalCollectionTask task(&terminator); + _heap->workers()->run_task(&task); + } } if (!_heap->cancelled_gc() && _heap->process_references()) { weak_refs_work(); } - if (!_heap->cancelled_gc() && _heap->unload_classes()) { - _heap->unload_classes_and_cleanup_tables(false); + if (!_heap->cancelled_gc()) { + if (_heap->unload_classes()) { + _heap->unload_classes_and_cleanup_tables(false); + } fixup_roots(); } diff -r 73d0d1848c58 src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp Wed Apr 03 13:33:31 2019 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp Wed Apr 03 15:27:31 2019 +0200 @@ -352,9 +352,6 @@ diagnostic(bool, ShenandoahKeepAliveBarrier, true, \ "Turn on/off keep alive barriers in Shenandoah") \ \ - diagnostic(bool, ShenandoahStoreValEnqueueBarrier, false, \ - "Turn on/off enqueuing of oops for storeval barriers") \ - \ diagnostic(bool, ShenandoahCASBarrier, true, \ "Turn on/off CAS barriers in Shenandoah") \ \ diff -r 73d0d1848c58 src/hotspot/share/opto/classes.hpp --- a/src/hotspot/share/opto/classes.hpp Wed Apr 03 13:33:31 2019 +0200 +++ b/src/hotspot/share/opto/classes.hpp Wed Apr 03 15:27:31 2019 +0200 @@ -280,7 +280,6 @@ shmacro(ShenandoahCompareAndSwapP) shmacro(ShenandoahWeakCompareAndSwapN) shmacro(ShenandoahWeakCompareAndSwapP) -shmacro(ShenandoahEnqueueBarrier) shmacro(ShenandoahLoadReferenceBarrier) macro(SCMemProj) macro(SqrtD) diff -r 73d0d1848c58 test/hotspot/jtreg/gc/shenandoah/options/TestSelectiveBarrierFlags.java --- a/test/hotspot/jtreg/gc/shenandoah/options/TestSelectiveBarrierFlags.java Wed Apr 03 13:33:31 2019 +0200 +++ b/test/hotspot/jtreg/gc/shenandoah/options/TestSelectiveBarrierFlags.java Wed Apr 03 15:27:31 2019 +0200 @@ -44,7 +44,7 @@ String[][] opts = { new String[] { "ShenandoahKeepAliveBarrier" }, new String[] { "ShenandoahLoadRefBarrier" }, - new String[] { "ShenandoahSATBBarrier", "ShenandoahStoreValEnqueueBarrier" }, + new String[] { "ShenandoahSATBBarrier" }, new String[] { "ShenandoahCASBarrier" }, new String[] { "ShenandoahCloneBarrier" }, }; diff -r 73d0d1848c58 test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasherWithShenandoah.java --- a/test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasherWithShenandoah.java Wed Apr 03 13:33:31 2019 +0200 +++ b/test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasherWithShenandoah.java Wed Apr 03 15:27:31 2019 +0200 @@ -34,19 +34,9 @@ * @requires vm.flavor == "server" & !vm.emulatedClient & !vm.graal.enabled * @summary Stress the Shenandoah GC by trying to make old objects more likely to be garbage than young objects. * - * @run main/othervm/timeout=200 -Xlog:gc*=info -Xmx1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=passive -XX:+ShenandoahVerify -XX:+ShenandoahDegeneratedGC gc.stress.gcbasher.TestGCBasherWithShenandoah 120000 - * @run main/othervm/timeout=200 -Xlog:gc*=info -Xmx1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=passive -XX:+ShenandoahVerify -XX:-ShenandoahDegeneratedGC gc.stress.gcbasher.TestGCBasherWithShenandoah 120000 - * - * @run main/othervm/timeout=200 -Xlog:gc*=info -Xmx1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot gc.stress.gcbasher.TestGCBasherWithShenandoah 120000 - * @run main/othervm/timeout=200 -Xlog:gc*=info -Xmx1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahAllocFailureALot gc.stress.gcbasher.TestGCBasherWithShenandoah 120000 - * @run main/othervm/timeout=200 -Xlog:gc*=info -Xmx1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive gc.stress.gcbasher.TestGCBasherWithShenandoah 120000 - * - * @run main/othervm/timeout=200 -Xlog:gc*=info -Xmx1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive -XX:+ShenandoahVerify gc.stress.gcbasher.TestGCBasherWithShenandoah 120000 * @run main/othervm/timeout=200 -Xlog:gc*=info -Xmx1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=traversal -XX:+ShenandoahVerify gc.stress.gcbasher.TestGCBasherWithShenandoah 120000 * - * @run main/othervm/timeout=200 -Xlog:gc*=info -Xmx1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive gc.stress.gcbasher.TestGCBasherWithShenandoah 120000 * @run main/othervm/timeout=200 -Xlog:gc*=info -Xmx1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=traversal gc.stress.gcbasher.TestGCBasherWithShenandoah 120000 - * @run main/othervm/timeout=200 -Xlog:gc*=info -Xmx1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact gc.stress.gcbasher.TestGCBasherWithShenandoah 120000 */ public class TestGCBasherWithShenandoah { public static void main(String[] args) throws IOException {