85 if (n != NULL && (n->is_LoadBarrierSlowReg() || n->is_LoadBarrierWeakSlowReg())) { 86 return true; 87 } 88 } 89 90 return false; 91 } 92 93 void ZBarrierSetC2::register_potential_barrier_node(Node* node) const { 94 if (node->is_LoadBarrier()) { 95 state()->add_load_barrier_node(node->as_LoadBarrier()); 96 } 97 } 98 99 void ZBarrierSetC2::unregister_potential_barrier_node(Node* node) const { 100 if (node->is_LoadBarrier()) { 101 state()->remove_load_barrier_node(node->as_LoadBarrier()); 102 } 103 } 104 105 void ZBarrierSetC2::eliminate_useless_gc_barriers(Unique_Node_List &useful) const { 106 // Remove useless LoadBarrier nodes 107 ZBarrierSetC2State* s = state(); 108 for (int i = s->load_barrier_count()-1; i >= 0; i--) { 109 LoadBarrierNode* n = s->load_barrier_node(i); 110 if (!useful.member(n)) { 111 unregister_potential_barrier_node(n); 112 } 113 } 114 } 115 116 void ZBarrierSetC2::enqueue_useful_gc_barrier(Unique_Node_List &worklist, Node* node) const { 117 if (node->is_LoadBarrier() && !node->as_LoadBarrier()->has_true_uses()) { 118 worklist.push(node); 119 } 120 } 121 122 void ZBarrierSetC2::find_dominating_barriers(PhaseIterGVN& igvn) { 123 // Look for dominating barriers on the same address only once all 124 // other loop opts are over: loop opts may cause a safepoint to be 125 // inserted between a barrier and its dominating barrier. 126 Compile* C = Compile::current(); 127 ZBarrierSetC2* bs = (ZBarrierSetC2*)BarrierSet::barrier_set()->barrier_set_c2(); 128 ZBarrierSetC2State* s = bs->state(); 129 if (s->load_barrier_count() >= 2) { 130 Compile::TracePhase tp("idealLoop", &C->timers[Phase::_t_idealLoop]); 131 PhaseIdealLoop ideal_loop(igvn, LoopOptsLastRound); 132 if (C->major_progress()) C->print_method(PHASE_PHASEIDEALLOOP_ITERATIONS, 2); 133 } 134 } 135 136 void ZBarrierSetC2::add_users_to_worklist(Unique_Node_List* worklist) const { 137 // Permanent temporary workaround 138 // Loadbarriers may have non-obvious dead uses keeping them alive during parsing. The use is | 85 if (n != NULL && (n->is_LoadBarrierSlowReg() || n->is_LoadBarrierWeakSlowReg())) { 86 return true; 87 } 88 } 89 90 return false; 91 } 92 93 void ZBarrierSetC2::register_potential_barrier_node(Node* node) const { 94 if (node->is_LoadBarrier()) { 95 state()->add_load_barrier_node(node->as_LoadBarrier()); 96 } 97 } 98 99 void ZBarrierSetC2::unregister_potential_barrier_node(Node* node) const { 100 if (node->is_LoadBarrier()) { 101 state()->remove_load_barrier_node(node->as_LoadBarrier()); 102 } 103 } 104 105 void ZBarrierSetC2::eliminate_useless_gc_barriers(Unique_Node_List &useful, Compile* C) const { 106 // Remove useless LoadBarrier nodes 107 ZBarrierSetC2State* s = state(); 108 for (int i = s->load_barrier_count()-1; i >= 0; i--) { 109 LoadBarrierNode* n = s->load_barrier_node(i); 110 if (!useful.member(n)) { 111 unregister_potential_barrier_node(n); 112 } 113 } 114 } 115 116 void ZBarrierSetC2::enqueue_useful_gc_barrier(PhaseIterGVN* igvn, Node* node) const { 117 if (node->is_LoadBarrier() && !node->as_LoadBarrier()->has_true_uses()) { 118 igvn->_worklist.push(node); 119 } 120 } 121 122 void ZBarrierSetC2::find_dominating_barriers(PhaseIterGVN& igvn) { 123 // Look for dominating barriers on the same address only once all 124 // other loop opts are over: loop opts may cause a safepoint to be 125 // inserted between a barrier and its dominating barrier. 126 Compile* C = Compile::current(); 127 ZBarrierSetC2* bs = (ZBarrierSetC2*)BarrierSet::barrier_set()->barrier_set_c2(); 128 ZBarrierSetC2State* s = bs->state(); 129 if (s->load_barrier_count() >= 2) { 130 Compile::TracePhase tp("idealLoop", &C->timers[Phase::_t_idealLoop]); 131 PhaseIdealLoop ideal_loop(igvn, LoopOptsLastRound); 132 if (C->major_progress()) C->print_method(PHASE_PHASEIDEALLOOP_ITERATIONS, 2); 133 } 134 } 135 136 void ZBarrierSetC2::add_users_to_worklist(Unique_Node_List* worklist) const { 137 // Permanent temporary workaround 138 // Loadbarriers may have non-obvious dead uses keeping them alive during parsing. The use is |