Ejemplo n.º 1
0
        public BasicBlock(ControlFlowGraph cfg, int nBlock, int at_instruction, EHInfo copy_ehState_from)
        {
            ControlFlowGraph = cfg;
            InputBlockNum = nBlock;
            FromInstruction = at_instruction;
            ToInstruction = at_instruction;
            Instructions = new List<FlatStatement>();
            if (at_instruction>=0)
                Instructions.Add(ControlFlowGraph.InputInstructions[at_instruction]);

            if (copy_ehState_from != null)
            {
                EHInfo = new LS2IL.EHInfo(copy_ehState_from);
            }

            ResetRegisterScan();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds a BasicBlock HEAD instruction to the graph (always a new BasicBlock)
 /// </summary>
 /// <param name="nInstruction"></param>
 /// <param name="ehinfo"></param>
 void HeadInstruction(int nInstruction, EHInfo ehinfo)
 {
     CurrentBasicBlock = new BasicBlock(this, BasicBlocks.Count, nInstruction, ehinfo);
     BasicBlocks.Add(CurrentBasicBlock);
 }
Ejemplo n.º 3
0
 public EHInfo(EHInfo oldState,int numTryInstruction, FlatOperand catchesLabel, string ehendLabel)
 {
     CatchesLabel = catchesLabel.ImmediateValue.ValueText;
     ehEndLabel = ehendLabel;
     PreviousState = oldState;
     EHPart = EHPart.Try;
     NumTryInstruction = numTryInstruction;
 }
Ejemplo n.º 4
0
 public EHInfo(EHInfo oldState,int numTryInstruction, FlatOperand catchesLabel, FlatOperand finallyLabel)
 {
     CatchesLabel = catchesLabel.ImmediateValue.ValueText;
     FinallyLabel = finallyLabel.ImmediateValue.ValueText;
     PreviousState = oldState;
     NumTryInstruction = numTryInstruction;
     EHPart = EHPart.Try;
 }
Ejemplo n.º 5
0
        public EHInfo(EHInfo copyfrom)
        {
            if (copyfrom == null)
            {
                EHPart = LS2IL.EHPart.None;
                NumTryInstruction = -1;
                return;
            }

            EHPart = copyfrom.EHPart;
            CatchesLabel = copyfrom.CatchesLabel;
            ehEndLabel = copyfrom.ehEndLabel;
            FinallyLabel = copyfrom.FinallyLabel;
            PreviousState = copyfrom.PreviousState;
            NumTryInstruction = copyfrom.NumTryInstruction;
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Adds a BasicBlock TAIL instruction to the graph (terminates the current BasicBlock after adding this instruction)
 /// </summary>
 /// <param name="nInstruction"></param>
 /// <param name="ehinfo"></param>
 void TailInstruction(int nInstruction, EHInfo ehinfo)
 {
     NormalInstruction(nInstruction, ehinfo);
     CurrentBasicBlock = null;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// When hitting a new TRY instruction, this provides stacking behavior with the current exception handling
 /// </summary>
 /// <param name="nInstruction"></param>
 /// <param name="tryInstruction"></param>
 void PushFinallyState(int nInstruction, FlatStatement tryInstruction)
 {
     EHInfo CurrentState = EHState;
     if (tryInstruction.Operands.Count == 1)
     {
         EHState = new EHInfo(CurrentState, nInstruction,tryInstruction.Operands[0], tryInstruction.Comment);
     }
     else
         EHState = new EHInfo(CurrentState, nInstruction, tryInstruction.Operands[0], tryInstruction.Operands[1]);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// This closes out an exception handler on the stack
 /// </summary>
 void PopFinallyState()
 {
     EHState = EHState.PreviousState;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Adds a normal instruction to the graph (new BasicBlock only if we're not already in one)
 /// </summary>
 /// <param name="nInstruction"></param>
 /// <param name="ehinfo"></param>
 void NormalInstruction(int nInstruction, EHInfo ehinfo)
 {
     if (CurrentBasicBlock == null)
     {
         HeadInstruction(nInstruction, ehinfo);
     }
     else
         CurrentBasicBlock.Touch(nInstruction);
 }