Ejemplo n.º 1
0
        public static HeapElemWrapper getHeapElemW(Instruction inst, IFieldReference fldRef, IMethodDefinition meth)
        {
            if (InstFldRefToHeapElemWrapperMap.ContainsKey(inst))
            {
                IDictionary <IFieldReference, HeapElemWrapper> innerDict = InstFldRefToHeapElemWrapperMap[inst];

                if (innerDict != null && innerDict.ContainsKey(fldRef))
                {
                    return(innerDict[fldRef]);
                }
                if (innerDict == null)
                {
                    InstFldRefToHeapElemWrapperMap[inst] = new Dictionary <IFieldReference, HeapElemWrapper>(frc);
                }
            }
            else
            {
                IDictionary <IFieldReference, HeapElemWrapper> innerDict = new Dictionary <IFieldReference, HeapElemWrapper>(frc);
                InstFldRefToHeapElemWrapperMap.Add(inst, innerDict);
            }
            InstructionWrapper instW = getInstW(inst, meth);
            FieldRefWrapper    fldW  = getFieldRefW(fldRef);
            HeapElemWrapper    hpW   = new HeapElemWrapper(instW, fldW);

            InstFldRefToHeapElemWrapperMap[inst][fldRef] = hpW;
            return(hpW);
        }
Ejemplo n.º 2
0
 public static HeapElemWrapper getHeapElemW(Instruction inst, IMethodDefinition meth, bool createArrayElem)
 {
     if (createArrayElem)
     {
         if (InstToHeapArrayElemWrapperMap.ContainsKey(inst))
         {
             return(InstToHeapArrayElemWrapperMap[inst]);
         }
         else
         {
             InstructionWrapper instW = getInstW(inst, meth);
             HeapElemWrapper    hpW   = new HeapElemWrapper(instW, true);
             InstToHeapArrayElemWrapperMap[inst] = hpW;
             return(hpW);
         }
     }
     else
     {
         if (InstToHeapElemWrapperMap.ContainsKey(inst))
         {
             return(InstToHeapElemWrapperMap[inst]);
         }
         else
         {
             InstructionWrapper instW = getInstW(inst, meth);
             HeapElemWrapper    hpW   = new HeapElemWrapper(instW, false);
             InstToHeapElemWrapperMap[inst] = hpW;
             return(hpW);
         }
     }
 }
Ejemplo n.º 3
0
 public static InstructionWrapper getInstW(Instruction inst, IMethodDefinition meth)
 {
     if (InstToWrapperMap.ContainsKey(inst))
     {
         return(InstToWrapperMap[inst]);
     }
     else
     {
         InstructionWrapper instW = new InstructionWrapper(inst, meth);
         InstToWrapperMap.Add(inst, instW);
         return(instW);
     }
 }
Ejemplo n.º 4
0
 public static ExHandlerWrapper getExHandlerW(Instruction inst, IMethodDefinition meth)
 {
     if (InstToExHandlerWrapperMap.ContainsKey(inst))
     {
         return(InstToExHandlerWrapperMap[inst]);
     }
     else
     {
         InstructionWrapper instW = getInstW(inst, meth);
         ExHandlerWrapper   ehW   = new ExHandlerWrapper(instW);
         InstToExHandlerWrapperMap[inst] = ehW;
         return(ehW);
     }
 }
Ejemplo n.º 5
0
 public static AddressWrapper getAddrW(Instruction newArrInst, IMethodDefinition meth)
 {
     if (ArrayToAddrWrapperMap.ContainsKey(newArrInst))
     {
         return(ArrayToAddrWrapperMap[newArrInst]);
     }
     else
     {
         InstructionWrapper instW = getInstW(newArrInst, meth);
         FieldRefWrapper    fldW  = ProgramDoms.domF.GetVal(0);
         AddressWrapper     addW  = new AddressWrapper(instW, fldW);
         ArrayToAddrWrapperMap[newArrInst] = addW;
         return(addW);
     }
 }
Ejemplo n.º 6
0
 public HeapElemWrapper(InstructionWrapper instW, FieldRefWrapper fldW)
 {
     this.instW = instW;
     this.fldW  = fldW;
     kind       = HeapElemKind.InstFldStructObj;
 }
Ejemplo n.º 7
0
 public HeapElemWrapper(InstructionWrapper instW, bool createArrayElem)
 {
     this.instW = instW;
     kind       = createArrayElem ? HeapElemKind.ArrElemStructObj : HeapElemKind.RefObj;
 }
Ejemplo n.º 8
0
 public ExHandlerWrapper(InstructionWrapper instW)
 {
     this.instW = instW;
 }
Ejemplo n.º 9
0
 public AddressWrapper(InstructionWrapper instW, FieldRefWrapper fldRefW)
 {
     this.instW   = instW;
     this.fldRefW = fldRefW;
     kind         = AddressKind.AddrHF;
 }