@@ -40,6 +40,7 @@ public static BlockKey[] ComputeKeys(ControlFlowGraph graph, IRandomGenerator ra
4040 key . Type = BlockKeyType . Incremental ;
4141 keys [ block . Id ] = key ;
4242 }
43+
4344 ProcessBlocks ( keys , graph , random ) ;
4445 return keys ;
4546 }
@@ -68,13 +69,15 @@ static void ProcessBlocks(BlockKey[] keys, ControlFlowGraph graph, IRandomGenera
6869 updated = true ;
6970 }
7071 }
72+
7173 if ( block . Targets . Count > 0 ) {
7274 uint newExit = block . Targets . Select ( b => keys [ b . Id ] . EntryState ) . Max ( ) ;
7375 if ( key . ExitState != newExit ) {
7476 key . ExitState = newExit ;
7577 updated = true ;
7678 }
7779 }
80+
7881 if ( block . Footer . OpCode . Code == Code . Endfilter || block . Footer . OpCode . Code == Code . Endfinally ) {
7982 // Match the exit state within finally/fault/filter
8083 List < ExceptionHandler > ehs ;
@@ -84,18 +87,20 @@ static void ProcessBlocks(BlockKey[] keys, ControlFlowGraph graph, IRandomGenera
8487 foreach ( var eh in graph . Body . ExceptionHandlers ) {
8588 if ( eh . FilterStart != null && block . Footer . OpCode . Code == Code . Endfilter ) {
8689 if ( footerIndex >= graph . IndexOf ( eh . FilterStart ) &&
87- footerIndex < graph . IndexOf ( eh . HandlerStart ) )
90+ footerIndex < graph . IndexOf ( eh . HandlerStart ) )
8891 ehs . Add ( eh ) ;
8992 }
9093 else if ( eh . HandlerType == ExceptionHandlerType . Finally ||
91- eh . HandlerType == ExceptionHandlerType . Fault ) {
94+ eh . HandlerType == ExceptionHandlerType . Fault ) {
9295 if ( footerIndex >= graph . IndexOf ( eh . HandlerStart ) &&
93- ( eh . HandlerEnd == null || footerIndex < graph . IndexOf ( eh . HandlerEnd ) ) )
96+ ( eh . HandlerEnd == null || footerIndex < graph . IndexOf ( eh . HandlerEnd ) ) )
9497 ehs . Add ( eh ) ;
9598 }
9699 }
100+
97101 ehMap [ block ] = ehs ;
98102 }
103+
99104 foreach ( var eh in ehs ) {
100105 uint ehVal ;
101106 if ( finallyIds . TryGetValue ( eh , out ehVal ) ) {
@@ -122,9 +127,10 @@ static void ProcessBlocks(BlockKey[] keys, ControlFlowGraph graph, IRandomGenera
122127 int footerIndex = graph . IndexOf ( block . Footer ) ;
123128 foreach ( var eh in graph . Body . ExceptionHandlers ) {
124129 if ( footerIndex >= graph . IndexOf ( eh . TryStart ) &&
125- ( eh . TryEnd == null || footerIndex < graph . IndexOf ( eh . TryEnd ) ) )
130+ ( eh . TryEnd == null || footerIndex < graph . IndexOf ( eh . TryEnd ) ) )
126131 ehs . Add ( eh ) ;
127132 }
133+
128134 ehMap [ block ] = ehs ;
129135 }
130136
@@ -137,6 +143,7 @@ static void ProcessBlocks(BlockKey[] keys, ControlFlowGraph graph, IRandomGenera
137143 maxVal = ehVal ;
138144 }
139145 }
146+
140147 if ( maxVal != null ) {
141148 if ( key . ExitState > maxVal . Value ) {
142149 maxVal = key . ExitState ;
@@ -146,10 +153,12 @@ static void ProcessBlocks(BlockKey[] keys, ControlFlowGraph graph, IRandomGenera
146153 key . ExitState = maxVal . Value ;
147154 updated = true ;
148155 }
156+
149157 foreach ( var eh in ehs )
150158 finallyIds [ eh ] = maxVal . Value ;
151159 }
152160 }
161+
153162 keys [ block . Id ] = key ;
154163 }
155164 } while ( updated ) ;
0 commit comments