Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/loopnode.cpp @ 23421:c1091733abe6
8011858: Use Compile::live_nodes() instead of Compile::unique() in appropriate places
Reviewed-by: kvn, vlivanov
Contributed-by: vlad.ureche@gmail.com
author | zmajo |
---|---|
date | Wed, 16 Sep 2015 11:09:09 +0200 |
parents | 0a5d68482373 |
children | cf93dd06db0f |
comparison
equal
deleted
inserted
replaced
23420:c1374141598c | 23421:c1091733abe6 |
---|---|
2228 // node. For CFG nodes, the _nodes array starts out and remains | 2228 // node. For CFG nodes, the _nodes array starts out and remains |
2229 // holding the associated IdealLoopTree pointer. For DATA nodes, the | 2229 // holding the associated IdealLoopTree pointer. For DATA nodes, the |
2230 // _nodes array holds the earliest legal controlling CFG node. | 2230 // _nodes array holds the earliest legal controlling CFG node. |
2231 | 2231 |
2232 // Allocate stack with enough space to avoid frequent realloc | 2232 // Allocate stack with enough space to avoid frequent realloc |
2233 int stack_size = (C->unique() >> 1) + 16; // (unique>>1)+16 from Java2D stats | 2233 int stack_size = (C->live_nodes() >> 1) + 16; // (live_nodes>>1)+16 from Java2D stats |
2234 Node_Stack nstack( a, stack_size ); | 2234 Node_Stack nstack( a, stack_size ); |
2235 | 2235 |
2236 visited.Clear(); | 2236 visited.Clear(); |
2237 Node_List worklist(a); | 2237 Node_List worklist(a); |
2238 // Don't need C->root() on worklist since | 2238 // Don't need C->root() on worklist since |
2684 if (_dom_depth[i] > 0 && _idom[i] != NULL) { | 2684 if (_dom_depth[i] > 0 && _idom[i] != NULL) { |
2685 _dom_depth[i] = no_depth_marker; | 2685 _dom_depth[i] = no_depth_marker; |
2686 } | 2686 } |
2687 } | 2687 } |
2688 if (_dom_stk == NULL) { | 2688 if (_dom_stk == NULL) { |
2689 uint init_size = C->unique() / 100; // Guess that 1/100 is a reasonable initial size. | 2689 uint init_size = C->live_nodes() / 100; // Guess that 1/100 is a reasonable initial size. |
2690 if (init_size < 10) init_size = 10; | 2690 if (init_size < 10) init_size = 10; |
2691 _dom_stk = new GrowableArray<uint>(init_size); | 2691 _dom_stk = new GrowableArray<uint>(init_size); |
2692 } | 2692 } |
2693 // Compute new depth for each node. | 2693 // Compute new depth for each node. |
2694 for (i = 0; i < _idom_size; i++) { | 2694 for (i = 0; i < _idom_size; i++) { |
2774 // I need to inspect loop header pre-order numbers to properly nest my | 2774 // I need to inspect loop header pre-order numbers to properly nest my |
2775 // loops. This means I need to sort my childrens' loops by pre-order. | 2775 // loops. This means I need to sort my childrens' loops by pre-order. |
2776 // The sort is of size number-of-control-children, which generally limits | 2776 // The sort is of size number-of-control-children, which generally limits |
2777 // it to size 2 (i.e., I just choose between my 2 target loops). | 2777 // it to size 2 (i.e., I just choose between my 2 target loops). |
2778 void PhaseIdealLoop::build_loop_tree() { | 2778 void PhaseIdealLoop::build_loop_tree() { |
2779 // Allocate stack of size C->unique()/2 to avoid frequent realloc | 2779 // Allocate stack of size C->live_nodes()/2 to avoid frequent realloc |
2780 GrowableArray <Node *> bltstack(C->unique() >> 1); | 2780 GrowableArray <Node *> bltstack(C->live_nodes() >> 1); |
2781 Node *n = C->root(); | 2781 Node *n = C->root(); |
2782 bltstack.push(n); | 2782 bltstack.push(n); |
2783 int pre_order = 1; | 2783 int pre_order = 1; |
2784 int stack_size; | 2784 int stack_size; |
2785 | 2785 |
3664 #ifndef PRODUCT | 3664 #ifndef PRODUCT |
3665 //------------------------------dump------------------------------------------- | 3665 //------------------------------dump------------------------------------------- |
3666 void PhaseIdealLoop::dump( ) const { | 3666 void PhaseIdealLoop::dump( ) const { |
3667 ResourceMark rm; | 3667 ResourceMark rm; |
3668 Arena* arena = Thread::current()->resource_area(); | 3668 Arena* arena = Thread::current()->resource_area(); |
3669 Node_Stack stack(arena, C->unique() >> 2); | 3669 Node_Stack stack(arena, C->live_nodes() >> 2); |
3670 Node_List rpo_list; | 3670 Node_List rpo_list; |
3671 VectorSet visited(arena); | 3671 VectorSet visited(arena); |
3672 visited.set(C->top()->_idx); | 3672 visited.set(C->top()->_idx); |
3673 rpo( C->root(), stack, visited, rpo_list ); | 3673 rpo( C->root(), stack, visited, rpo_list ); |
3674 // Dump root loop indexed by last element in PO order | 3674 // Dump root loop indexed by last element in PO order |