1.1 --- a/src/share/vm/opto/loopnode.hpp Wed Aug 12 14:27:54 2009 -0700 1.2 +++ b/src/share/vm/opto/loopnode.hpp Fri Aug 14 00:02:12 2009 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -442,6 +442,9 @@ 1.11 uint *_preorders; 1.12 uint _max_preorder; 1.13 1.14 + const PhaseIdealLoop* _verify_me; 1.15 + bool _verify_only; 1.16 + 1.17 // Allocate _preorders[] array 1.18 void allocate_preorders() { 1.19 _max_preorder = C->unique()+8; 1.20 @@ -497,6 +500,12 @@ 1.21 Node_Array _dom_lca_tags; 1.22 void init_dom_lca_tags(); 1.23 void clear_dom_lca_tags(); 1.24 + 1.25 + // Helper for debugging bad dominance relationships 1.26 + bool verify_dominance(Node* n, Node* use, Node* LCA, Node* early); 1.27 + 1.28 + Node* compute_lca_of_uses(Node* n, Node* early, bool verify = false); 1.29 + 1.30 // Inline wrapper for frequent cases: 1.31 // 1) only one use 1.32 // 2) a use is the same as the current LCA passed as 'n1' 1.33 @@ -511,6 +520,7 @@ 1.34 return find_non_split_ctrl(n); 1.35 } 1.36 Node *dom_lca_for_get_late_ctrl_internal( Node *lca, Node *n, Node *tag ); 1.37 + 1.38 // true if CFG node d dominates CFG node n 1.39 bool is_dominator(Node *d, Node *n); 1.40 1.41 @@ -621,9 +631,9 @@ 1.42 IdealLoopTree *sort( IdealLoopTree *loop, IdealLoopTree *innermost ); 1.43 1.44 // Place Data nodes in some loop nest 1.45 - void build_loop_early( VectorSet &visited, Node_List &worklist, Node_Stack &nstack, const PhaseIdealLoop *verify_me ); 1.46 - void build_loop_late ( VectorSet &visited, Node_List &worklist, Node_Stack &nstack, const PhaseIdealLoop *verify_me ); 1.47 - void build_loop_late_post ( Node* n, const PhaseIdealLoop *verify_me ); 1.48 + void build_loop_early( VectorSet &visited, Node_List &worklist, Node_Stack &nstack ); 1.49 + void build_loop_late ( VectorSet &visited, Node_List &worklist, Node_Stack &nstack ); 1.50 + void build_loop_late_post ( Node* n ); 1.51 1.52 // Array of immediate dominance info for each CFG node indexed by node idx 1.53 private: 1.54 @@ -662,6 +672,19 @@ 1.55 // Is safept not required by an outer loop? 1.56 bool is_deleteable_safept(Node* sfpt); 1.57 1.58 + // Perform verification that the graph is valid. 1.59 + PhaseIdealLoop( PhaseIterGVN &igvn) : 1.60 + PhaseTransform(Ideal_Loop), 1.61 + _igvn(igvn), 1.62 + _dom_lca_tags(C->comp_arena()), 1.63 + _verify_me(NULL), 1.64 + _verify_only(true) { 1.65 + build_and_optimize(false); 1.66 + } 1.67 + 1.68 + // build the loop tree and perform any requested optimizations 1.69 + void build_and_optimize(bool do_split_if); 1.70 + 1.71 public: 1.72 // Dominators for the sea of nodes 1.73 void Dominators(); 1.74 @@ -671,7 +694,32 @@ 1.75 Node *dom_lca_internal( Node *n1, Node *n2 ) const; 1.76 1.77 // Compute the Ideal Node to Loop mapping 1.78 - PhaseIdealLoop( PhaseIterGVN &igvn, const PhaseIdealLoop *verify_me, bool do_split_ifs ); 1.79 + PhaseIdealLoop( PhaseIterGVN &igvn, bool do_split_ifs) : 1.80 + PhaseTransform(Ideal_Loop), 1.81 + _igvn(igvn), 1.82 + _dom_lca_tags(C->comp_arena()), 1.83 + _verify_me(NULL), 1.84 + _verify_only(false) { 1.85 + build_and_optimize(do_split_ifs); 1.86 + } 1.87 + 1.88 + // Verify that verify_me made the same decisions as a fresh run. 1.89 + PhaseIdealLoop( PhaseIterGVN &igvn, const PhaseIdealLoop *verify_me) : 1.90 + PhaseTransform(Ideal_Loop), 1.91 + _igvn(igvn), 1.92 + _dom_lca_tags(C->comp_arena()), 1.93 + _verify_me(verify_me), 1.94 + _verify_only(false) { 1.95 + build_and_optimize(false); 1.96 + } 1.97 + 1.98 + // Build and verify the loop tree without modifying the graph. This 1.99 + // is useful to verify that all inputs properly dominate their uses. 1.100 + static void verify(PhaseIterGVN& igvn) { 1.101 +#ifdef ASSERT 1.102 + PhaseIdealLoop v(igvn); 1.103 +#endif 1.104 + } 1.105 1.106 // True if the method has at least 1 irreducible loop 1.107 bool _has_irreducible_loops;