private void RedirectSuccessor(InstructionBlock theBlock, InstructionBlock oldSuccessor, InstructionBlock newSuccessor)
 {
     dummyVar0 = oldSuccessor.get_Predecessors().Remove(theBlock);
     V_1       = 0;
     while (V_1 < (int)theBlock.get_Successors().Length)
     {
         if (InstructionBlock.op_Equality(theBlock.get_Successors()[V_1], oldSuccessor))
         {
             theBlock.get_Successors()[V_1] = newSuccessor;
         }
         V_1 = V_1 + 1;
     }
     dummyVar1 = newSuccessor.get_Predecessors().Add(theBlock);
     if (!this.theCFG.get_SwitchBlocksInformation().TryGetValue(theBlock, out V_0))
     {
         return;
     }
     V_2 = 0;
     while (V_2 < (int)V_0.get_OrderedCasesArray().Length)
     {
         if (InstructionBlock.op_Equality(V_0.get_OrderedCasesArray()[V_2], oldSuccessor))
         {
             V_0.get_OrderedCasesArray()[V_2] = newSuccessor;
         }
         V_2 = V_2 + 1;
     }
     if (InstructionBlock.op_Equality(V_0.get_DefaultCase(), oldSuccessor))
     {
         V_0.set_DefaultCase(newSuccessor);
     }
     return;
 }
Ejemplo n.º 2
0
        private bool MarkPredecessorsAsYieldReturns(InstructionBlock theBlock)
        {
            dummyVar0 = this.toBeRemoved.Add(theBlock);
            V_0       = (new HashSet <InstructionBlock>(theBlock.get_Predecessors())).GetEnumerator();
            try
            {
                while (V_0.MoveNext())
                {
                    V_1 = V_0.get_Current();
                    if ((object)V_1.get_Last() != (object)V_1.get_First())
                    {
                        if (this.TryAddToYieldReturningBlocks(V_1))
                        {
                            continue;
                        }
                        V_2 = false;
                        goto Label1;
                    }
                    else
                    {
                        if (StateMachineUtilities.IsUnconditionalBranch(V_1.get_Last()) && this.MarkPredecessorsAsYieldReturns(V_1))
                        {
                            continue;
                        }
                        V_2 = false;
                        goto Label1;
                    }
                }
                goto Label0;
            }
            finally
            {
                ((IDisposable)V_0).Dispose();
            }
Label1:
            return(V_2);

Label0:
            return(true);
        }
 private void RedirectNonControllerPredecessors(InstructionBlock controllerBlock, InstructionBlock successor)
 {
     V_0 = (new List <InstructionBlock>(controllerBlock.get_Predecessors())).GetEnumerator();
     try
     {
         while (V_0.MoveNext())
         {
             V_1 = V_0.get_Current();
             if (this.toBeRemoved.Contains(V_1))
             {
                 continue;
             }
             dummyVar0 = successor.get_Predecessors().Remove(controllerBlock);
             this.RedirectSuccessor(V_1, controllerBlock, successor);
         }
     }
     finally
     {
         ((IDisposable)V_0).Dispose();
     }
     return;
 }
 private bool TryRemoveStateSavingBlock(InstructionBlock theBlock)
 {
     V_0 = this.GetFirst <InstructionBlock>(theBlock.get_Predecessors());
     if ((int)V_0.get_Successors().Length != 2 || !this.CheckForIsCompletedCall(V_0))
     {
         return(false);
     }
     if (InstructionBlock.op_Equality(V_0.get_Successors()[0], theBlock))
     {
         stackVariable22 = V_0.get_Successors()[1];
     }
     else
     {
         stackVariable22 = V_0.get_Successors()[0];
     }
     V_1 = stackVariable22;
     theBlock.set_Successors(new InstructionBlock[0]);
     stackVariable28    = new InstructionBlock[1];
     stackVariable28[0] = V_1;
     V_0.set_Successors(stackVariable28);
     dummyVar0 = this.toBeRemoved.Add(theBlock);
     return(true);
 }
Ejemplo n.º 5
0
        private bool MarkTrueReturningPredecessorsAsYieldReturn(InstructionBlock theBlock)
        {
            V_0 = (new HashSet <InstructionBlock>(theBlock.get_Predecessors())).GetEnumerator();
            try
            {
                while (V_0.MoveNext())
                {
                    V_1 = V_0.get_Current();
                    if ((object)V_1.get_Last() != (object)V_1.get_First())
                    {
                        V_2 = null;
                        V_3 = V_1.get_Last();
                        if (StateMachineUtilities.IsUnconditionalBranch(V_3))
                        {
                            V_3 = V_3.get_Previous();
                        }
                        if (!this.IsFinallyMethodInvocationBlock(V_1))
                        {
                            if (!this.TryGetVariableFromInstruction(V_3, out V_2) || !this.CheckAndSaveReturnFlagVariable(V_2) || !StateMachineUtilities.TryGetOperandOfLdc(V_3.get_Previous(), out V_4))
                            {
                                V_5 = false;
                                goto Label1;
                            }
                            else
                            {
                                if (V_4 != 1)
                                {
                                    if (V_4 == 0)
                                    {
                                        continue;
                                    }
                                    V_5 = false;
                                    goto Label1;
                                }
                                else
                                {
                                    if (this.TryAddToYieldReturningBlocks(V_1))
                                    {
                                        continue;
                                    }
                                    V_5 = false;
                                    goto Label1;
                                }
                            }
                        }
                        else
                        {
                            if (this.MarkTrueReturningPredecessorsAsYieldReturn(V_1))
                            {
                                continue;
                            }
                            V_5 = false;
                            goto Label1;
                        }
                    }
                    else
                    {
                        if (!StateMachineUtilities.IsUnconditionalBranch(V_1.get_Last()))
                        {
                            V_5 = false;
                            goto Label1;
                        }
                        else
                        {
                            dummyVar0 = this.toBeRemoved.Add(V_1);
                            if (this.MarkTrueReturningPredecessorsAsYieldReturn(V_1))
                            {
                                continue;
                            }
                            V_5 = false;
                            goto Label1;
                        }
                    }
                }
                goto Label0;
            }
            finally
            {
                ((IDisposable)V_0).Dispose();
            }
Label1:
            return(V_5);

Label0:
            return(true);
        }