@@ -667,23 +667,20 @@ class Compile : public Phase {
667
667
assert (!_macro_nodes->contains (n), " duplicate entry in expand list" );
668
668
_macro_nodes->append (n);
669
669
}
670
- void remove_macro_node (Node * n) {
671
- // this function may be called twice for a node so check
672
- // that the node is in the array before attempting to remove it
673
- if (_macro_nodes->contains (n))
674
- _macro_nodes->remove (n);
670
+ void remove_macro_node (Node* n) {
671
+ // this function may be called twice for a node so we can only remove it
672
+ // if it's still existing.
673
+ _macro_nodes->remove_if_existing (n);
675
674
// remove from _predicate_opaqs list also if it is there
676
- if (predicate_count () > 0 && _predicate_opaqs-> contains (n)) {
677
- _predicate_opaqs->remove (n);
675
+ if (predicate_count () > 0 ) {
676
+ _predicate_opaqs->remove_if_existing (n);
678
677
}
679
678
}
680
- void add_expensive_node (Node * n);
681
- void remove_expensive_node (Node * n) {
682
- if (_expensive_nodes->contains (n)) {
683
- _expensive_nodes->remove (n);
684
- }
679
+ void add_expensive_node (Node* n);
680
+ void remove_expensive_node (Node* n) {
681
+ _expensive_nodes->remove_if_existing (n);
685
682
}
686
- void add_predicate_opaq (Node * n) {
683
+ void add_predicate_opaq (Node* n) {
687
684
assert (!_predicate_opaqs->contains (n), " duplicate entry in predicate opaque1" );
688
685
assert (_macro_nodes->contains (n), " should have already been in macro list" );
689
686
_predicate_opaqs->append (n);
@@ -692,9 +689,7 @@ class Compile : public Phase {
692
689
// Range check dependent CastII nodes that can be removed after loop optimizations
693
690
void add_range_check_cast (Node* n);
694
691
void remove_range_check_cast (Node* n) {
695
- if (_range_check_casts->contains (n)) {
696
- _range_check_casts->remove (n);
697
- }
692
+ _range_check_casts->remove_if_existing (n);
698
693
}
699
694
Node* range_check_cast_node (int idx) const { return _range_check_casts->at (idx); }
700
695
int range_check_cast_count () const { return _range_check_casts->length (); }
@@ -703,9 +698,7 @@ class Compile : public Phase {
703
698
704
699
void add_opaque4_node (Node* n);
705
700
void remove_opaque4_node (Node* n) {
706
- if (_opaque4_nodes->contains (n)) {
707
- _opaque4_nodes->remove (n);
708
- }
701
+ _opaque4_nodes->remove_if_existing (n);
709
702
}
710
703
Node* opaque4_node (int idx) const { return _opaque4_nodes->at (idx); }
711
704
int opaque4_count () const { return _opaque4_nodes->length (); }
0 commit comments