Exemplo n.º 1
0
 private void SplitJsrExceptionRanges(HashSet <BasicBlock> common_blocks, IDictionary
                                      <int, BasicBlock> mapNewNodes)
 {
     for (int i = exceptions.Count - 1; i >= 0; i--)
     {
         ExceptionRangeCFG    range    = exceptions[i];
         List <BasicBlock>    lstRange = range.GetProtectedRange();
         HashSet <BasicBlock> setBoth  = new HashSet <BasicBlock>(common_blocks);
         setBoth.IntersectWith(lstRange);
         if (setBoth.Count > 0)
         {
             List <BasicBlock> lstNewRange;
             if (setBoth.Count == lstRange.Count)
             {
                 lstNewRange = new List <BasicBlock>();
                 ExceptionRangeCFG newRange = new ExceptionRangeCFG(lstNewRange, mapNewNodes.GetOrNull
                                                                        (range.GetHandler().id), range.GetExceptionTypes());
                 exceptions.Add(newRange);
             }
             else
             {
                 lstNewRange = lstRange;
             }
             foreach (BasicBlock block in setBoth)
             {
                 lstNewRange.Add(mapNewNodes.GetOrNull(block.id));
             }
         }
     }
 }
Exemplo n.º 2
0
 public virtual ExceptionRangeCFG GetExceptionRange(BasicBlock handler, BasicBlock
                                                    block)
 {
     //List<ExceptionRangeCFG> ranges = new ArrayList<ExceptionRangeCFG>();
     for (int i = exceptions.Count - 1; i >= 0; i--)
     {
         ExceptionRangeCFG range = exceptions[i];
         if (range.GetHandler() == handler && range.GetProtectedRange().Contains(block))
         {
             return(range);
         }
     }
     //ranges.add(range);
     return(null);
 }
Exemplo n.º 3
0
 public virtual void RemoveBlock(BasicBlock block)
 {
     while (block.GetSuccs().Count > 0)
     {
         block.RemoveSuccessor(block.GetSuccs()[0]);
     }
     while (block.GetSuccExceptions().Count > 0)
     {
         block.RemoveSuccessorException(block.GetSuccExceptions()[0]);
     }
     while (block.GetPreds().Count > 0)
     {
         block.GetPreds()[0].RemoveSuccessor(block);
     }
     while (block.GetPredExceptions().Count > 0)
     {
         block.GetPredExceptions()[0].RemoveSuccessorException(block);
     }
     last.RemovePredecessor(block);
     blocks.RemoveWithKey(block.id);
     for (int i = exceptions.Count - 1; i >= 0; i--)
     {
         ExceptionRangeCFG range = exceptions[i];
         if (range.GetHandler() == block)
         {
             exceptions.RemoveAtReturningValue(i);
         }
         else
         {
             List <BasicBlock> lstRange = range.GetProtectedRange();
             lstRange.Remove(block);
             if ((lstRange.Count == 0))
             {
                 exceptions.RemoveAtReturningValue(i);
             }
         }
     }
     subroutines.RemoveIf(ent => ent.Key == block ||
                          ent.Value == block);
 }