8255026: C2: Miscellaneous cleanups in Compile and PhaseIdealLoop code

Reviewed-by: thartmann, neliasso, redestad
This commit is contained in:
Vladimir Ivanov 2020-10-21 07:34:54 +00:00
parent c107178bcc
commit 27230fae24
6 changed files with 117 additions and 156 deletions

View file

@ -309,12 +309,12 @@ class Compile : public Phase {
DirectiveSet* _directive; // Compiler directive
CompileLog* _log; // from CompilerThread
const char* _failure_reason; // for record_failure/failing pattern
GrowableArray<CallGenerator*>* _intrinsics; // List of intrinsics.
GrowableArray<Node*>* _macro_nodes; // List of nodes which need to be expanded before matching.
GrowableArray<Node*>* _predicate_opaqs; // List of Opaque1 nodes for the loop predicates.
GrowableArray<Node*>* _expensive_nodes; // List of nodes that are expensive to compute and that we'd better not let the GVN freely common
GrowableArray<Node*>* _range_check_casts; // List of CastII nodes with a range check dependency
GrowableArray<Node*>* _opaque4_nodes; // List of Opaque4 nodes that have a default value
GrowableArray<CallGenerator*> _intrinsics; // List of intrinsics.
GrowableArray<Node*> _macro_nodes; // List of nodes which need to be expanded before matching.
GrowableArray<Node*> _predicate_opaqs; // List of Opaque1 nodes for the loop predicates.
GrowableArray<Node*> _expensive_nodes; // List of nodes that are expensive to compute and that we'd better not let the GVN freely common
GrowableArray<Node*> _range_check_casts; // List of CastII nodes with a range check dependency
GrowableArray<Node*> _opaque4_nodes; // List of Opaque4 nodes that have a default value
ConnectionGraph* _congraph;
#ifndef PRODUCT
IdealGraphPrinter* _printer;
@ -376,10 +376,8 @@ class Compile : public Phase {
Unique_Node_List* _for_igvn; // Initial work-list for next round of Iterative GVN
WarmCallInfo* _warm_calls; // Sorted work-list for heat-based inlining.
GrowableArray<CallGenerator*> _late_inlines; // List of CallGenerators to be revisited after
// main parsing has finished.
GrowableArray<CallGenerator*> _late_inlines; // List of CallGenerators to be revisited after main parsing has finished.
GrowableArray<CallGenerator*> _string_late_inlines; // same but for string operations
GrowableArray<CallGenerator*> _boxing_late_inlines; // same but for boxing operations
GrowableArray<CallGenerator*> _vector_reboxing_late_inlines; // same but for vector reboxing operations
@ -659,54 +657,54 @@ class Compile : public Phase {
void end_method(int level = 1);
int macro_count() const { return _macro_nodes->length(); }
int predicate_count() const { return _predicate_opaqs->length();}
int expensive_count() const { return _expensive_nodes->length(); }
Node* macro_node(int idx) const { return _macro_nodes->at(idx); }
Node* predicate_opaque1_node(int idx) const { return _predicate_opaqs->at(idx);}
Node* expensive_node(int idx) const { return _expensive_nodes->at(idx); }
int macro_count() const { return _macro_nodes.length(); }
int predicate_count() const { return _predicate_opaqs.length();}
int expensive_count() const { return _expensive_nodes.length(); }
Node* macro_node(int idx) const { return _macro_nodes.at(idx); }
Node* predicate_opaque1_node(int idx) const { return _predicate_opaqs.at(idx);}
Node* expensive_node(int idx) const { return _expensive_nodes.at(idx); }
ConnectionGraph* congraph() { return _congraph;}
void set_congraph(ConnectionGraph* congraph) { _congraph = congraph;}
void add_macro_node(Node * n) {
//assert(n->is_macro(), "must be a macro node");
assert(!_macro_nodes->contains(n), "duplicate entry in expand list");
_macro_nodes->append(n);
assert(!_macro_nodes.contains(n), "duplicate entry in expand list");
_macro_nodes.append(n);
}
void remove_macro_node(Node* n) {
// this function may be called twice for a node so we can only remove it
// if it's still existing.
_macro_nodes->remove_if_existing(n);
_macro_nodes.remove_if_existing(n);
// remove from _predicate_opaqs list also if it is there
if (predicate_count() > 0) {
_predicate_opaqs->remove_if_existing(n);
_predicate_opaqs.remove_if_existing(n);
}
}
void add_expensive_node(Node* n);
void remove_expensive_node(Node* n) {
_expensive_nodes->remove_if_existing(n);
_expensive_nodes.remove_if_existing(n);
}
void add_predicate_opaq(Node* n) {
assert(!_predicate_opaqs->contains(n), "duplicate entry in predicate opaque1");
assert(_macro_nodes->contains(n), "should have already been in macro list");
_predicate_opaqs->append(n);
assert(!_predicate_opaqs.contains(n), "duplicate entry in predicate opaque1");
assert(_macro_nodes.contains(n), "should have already been in macro list");
_predicate_opaqs.append(n);
}
// Range check dependent CastII nodes that can be removed after loop optimizations
void add_range_check_cast(Node* n);
void remove_range_check_cast(Node* n) {
_range_check_casts->remove_if_existing(n);
_range_check_casts.remove_if_existing(n);
}
Node* range_check_cast_node(int idx) const { return _range_check_casts->at(idx); }
int range_check_cast_count() const { return _range_check_casts->length(); }
Node* range_check_cast_node(int idx) const { return _range_check_casts.at(idx); }
int range_check_cast_count() const { return _range_check_casts.length(); }
// Remove all range check dependent CastIINodes.
void remove_range_check_casts(PhaseIterGVN &igvn);
void add_opaque4_node(Node* n);
void remove_opaque4_node(Node* n) {
_opaque4_nodes->remove_if_existing(n);
_opaque4_nodes.remove_if_existing(n);
}
Node* opaque4_node(int idx) const { return _opaque4_nodes->at(idx); }
int opaque4_count() const { return _opaque4_nodes->length(); }
Node* opaque4_node(int idx) const { return _opaque4_nodes.at(idx); }
int opaque4_count() const { return _opaque4_nodes.length(); }
void remove_opaque4_nodes(PhaseIterGVN &igvn);
void sort_macro_nodes();
@ -714,8 +712,8 @@ class Compile : public Phase {
// remove the opaque nodes that protect the predicates so that the unused checks and
// uncommon traps will be eliminated from the graph.
void cleanup_loop_predicates(PhaseIterGVN &igvn);
bool is_predicate_opaq(Node * n) {
return _predicate_opaqs->contains(n);
bool is_predicate_opaq(Node* n) {
return _predicate_opaqs.contains(n);
}
// Are there candidate expensive nodes for optimization?
@ -952,6 +950,7 @@ class Compile : public Phase {
}
void remove_useless_late_inlines(GrowableArray<CallGenerator*>* inlines, Unique_Node_List &useful);
void remove_useless_nodes (GrowableArray<Node*>& node_list, Unique_Node_List &useful);
void process_print_inlining();
void dump_print_inlining();
@ -1084,7 +1083,6 @@ class Compile : public Phase {
void verify_top(Node*) const PRODUCT_RETURN;
// Intrinsic setup.
void register_library_intrinsics(); // initializer
CallGenerator* make_vm_intrinsic(ciMethod* m, bool is_virtual); // constructor
int intrinsic_insertion_index(ciMethod* m, bool is_virtual, bool& found); // helper
CallGenerator* find_intrinsic(ciMethod* m, bool is_virtual); // query fn