781 |
781 |
782 //============================================================================= |
782 //============================================================================= |
783 //------------------------------PhaseIterGVN----------------------------------- |
783 //------------------------------PhaseIterGVN----------------------------------- |
784 // Initialize hash table to fresh and clean for +VerifyOpto |
784 // Initialize hash table to fresh and clean for +VerifyOpto |
785 PhaseIterGVN::PhaseIterGVN( PhaseIterGVN *igvn, const char *dummy ) : PhaseGVN(igvn,dummy), _worklist( ), |
785 PhaseIterGVN::PhaseIterGVN( PhaseIterGVN *igvn, const char *dummy ) : PhaseGVN(igvn,dummy), _worklist( ), |
786 _stack(C->unique() >> 1), |
786 _stack(C->live_nodes() >> 1), |
787 _delay_transform(false) { |
787 _delay_transform(false) { |
788 } |
788 } |
789 |
789 |
790 //------------------------------PhaseIterGVN----------------------------------- |
790 //------------------------------PhaseIterGVN----------------------------------- |
791 // Initialize with previous PhaseIterGVN info; used by PhaseCCP |
791 // Initialize with previous PhaseIterGVN info; used by PhaseCCP |
798 |
798 |
799 //------------------------------PhaseIterGVN----------------------------------- |
799 //------------------------------PhaseIterGVN----------------------------------- |
800 // Initialize with previous PhaseGVN info from Parser |
800 // Initialize with previous PhaseGVN info from Parser |
801 PhaseIterGVN::PhaseIterGVN( PhaseGVN *gvn ) : PhaseGVN(gvn), |
801 PhaseIterGVN::PhaseIterGVN( PhaseGVN *gvn ) : PhaseGVN(gvn), |
802 _worklist(*C->for_igvn()), |
802 _worklist(*C->for_igvn()), |
803 _stack(C->unique() >> 1), |
803 // TODO: Before incremental inlining it was allocated only once and it was fine. Now that |
|
804 // the constructor is used in incremental inlining, this consumes too much memory: |
|
805 // _stack(C->live_nodes() >> 1), |
|
806 // So, as a band-aid, we replace this by: |
|
807 _stack(C->comp_arena(), 32), |
804 _delay_transform(false) |
808 _delay_transform(false) |
805 { |
809 { |
806 uint max; |
810 uint max; |
807 |
811 |
808 // Dead nodes in the hash table inherited from GVN were not treated as |
812 // Dead nodes in the hash table inherited from GVN were not treated as |
1584 return new_node; // Been there, done that, return old answer |
1588 return new_node; // Been there, done that, return old answer |
1585 new_node = transform_once(n); // Check for constant |
1589 new_node = transform_once(n); // Check for constant |
1586 _nodes.map( n->_idx, new_node ); // Flag as having been cloned |
1590 _nodes.map( n->_idx, new_node ); // Flag as having been cloned |
1587 |
1591 |
1588 // Allocate stack of size _nodes.Size()/2 to avoid frequent realloc |
1592 // Allocate stack of size _nodes.Size()/2 to avoid frequent realloc |
1589 GrowableArray <Node *> trstack(C->unique() >> 1); |
1593 GrowableArray <Node *> trstack(C->live_nodes() >> 1); |
1590 |
1594 |
1591 trstack.push(new_node); // Process children of cloned node |
1595 trstack.push(new_node); // Process children of cloned node |
1592 while ( trstack.is_nonempty() ) { |
1596 while ( trstack.is_nonempty() ) { |
1593 Node *clone = trstack.pop(); |
1597 Node *clone = trstack.pop(); |
1594 uint cnt = clone->req(); |
1598 uint cnt = clone->req(); |