comparison src/share/vm/opto/node.cpp @ 7196:2aff40cb4703

7092905: C2: Keep track of the number of dead nodes Summary: keep an (almost) accurate running count of the reachable (live) flow graph nodes. Reviewed-by: kvn, twisti, jrose, vlivanov
author bharadwaj
date Tue, 27 Nov 2012 17:24:15 -0800
parents e626685e9f6c
children 32164d89fe9c
comparison
equal deleted inserted replaced
7195:2cd5e15048e6 7196:2aff40cb4703
55 _debug_orig = NULL; 55 _debug_orig = NULL;
56 int old_debug_idx = Compile::debug_idx(); 56 int old_debug_idx = Compile::debug_idx();
57 int new_debug_idx = old_debug_idx+1; 57 int new_debug_idx = old_debug_idx+1;
58 if (new_debug_idx > 0) { 58 if (new_debug_idx > 0) {
59 // Arrange that the lowest five decimal digits of _debug_idx 59 // Arrange that the lowest five decimal digits of _debug_idx
60 // will repeat thos of _idx. In case this is somehow pathological, 60 // will repeat those of _idx. In case this is somehow pathological,
61 // we continue to assign negative numbers (!) consecutively. 61 // we continue to assign negative numbers (!) consecutively.
62 const int mod = 100000; 62 const int mod = 100000;
63 int bump = (int)(_idx - new_debug_idx) % mod; 63 int bump = (int)(_idx - new_debug_idx) % mod;
64 if (bump < 0) bump += mod; 64 if (bump < 0) bump += mod;
65 assert(bump >= 0 && bump < mod, ""); 65 assert(bump >= 0 && bump < mod, "");
66 new_debug_idx += bump; 66 new_debug_idx += bump;
67 } 67 }
68 Compile::set_debug_idx(new_debug_idx); 68 Compile::set_debug_idx(new_debug_idx);
69 set_debug_idx( new_debug_idx ); 69 set_debug_idx( new_debug_idx );
70 assert(Compile::current()->unique() < (uint)MaxNodeLimit, "Node limit exceeded"); 70 assert(Compile::current()->unique() < (UINT_MAX - 1), "Node limit exceeded UINT_MAX");
71 if (BreakAtNode != 0 && (_debug_idx == BreakAtNode || (int)_idx == BreakAtNode)) { 71 if (BreakAtNode != 0 && (_debug_idx == BreakAtNode || (int)_idx == BreakAtNode)) {
72 tty->print_cr("BreakAtNode: _idx=%d _debug_idx=%d", _idx, _debug_idx); 72 tty->print_cr("BreakAtNode: _idx=%d _debug_idx=%d", _idx, _debug_idx);
73 BREAKPOINT; 73 BREAKPOINT;
74 } 74 }
75 #if OPTO_DU_ITERATOR_ASSERT 75 #if OPTO_DU_ITERATOR_ASSERT
800 } 800 }
801 801
802 //-------------------------disconnect_inputs----------------------------------- 802 //-------------------------disconnect_inputs-----------------------------------
803 // NULL out all inputs to eliminate incoming Def-Use edges. 803 // NULL out all inputs to eliminate incoming Def-Use edges.
804 // Return the number of edges between 'n' and 'this' 804 // Return the number of edges between 'n' and 'this'
805 int Node::disconnect_inputs(Node *n) { 805 int Node::disconnect_inputs(Node *n, Compile* C) {
806 int edges_to_n = 0; 806 int edges_to_n = 0;
807 807
808 uint cnt = req(); 808 uint cnt = req();
809 for( uint i = 0; i < cnt; ++i ) { 809 for( uint i = 0; i < cnt; ++i ) {
810 if( in(i) == 0 ) continue; 810 if( in(i) == 0 ) continue;
822 } 822 }
823 } 823 }
824 824
825 // Node::destruct requires all out edges be deleted first 825 // Node::destruct requires all out edges be deleted first
826 // debug_only(destruct();) // no reuse benefit expected 826 // debug_only(destruct();) // no reuse benefit expected
827 if (edges_to_n == 0) {
828 C->record_dead_node(_idx);
829 }
827 return edges_to_n; 830 return edges_to_n;
828 } 831 }
829 832
830 //-----------------------------uncast--------------------------------------- 833 //-----------------------------uncast---------------------------------------
831 // %%% Temporary, until we sort out CheckCastPP vs. CastPP. 834 // %%% Temporary, until we sort out CheckCastPP vs. CastPP.