Esempio n. 1
0
        private Emit(CallingConventions callConvention, Type returnType, Type[] parameterTypes, bool allowUnverifiable, bool doVerify, bool strictBranchVerification)
        {
            CallingConventions = callConvention;

            AllowsUnverifiableCIL = allowUnverifiable;

            IsVerifying = doVerify;
            UsesStrictBranchVerification = strictBranchVerification;

            ReturnType     = TypeOnStack.Get(returnType);
            ParameterTypes = parameterTypes;

            IL = new BufferedILGenerator <DelegateType>();

            Trackers = new LinqList <VerifiableTracker>();

            AllLocals = new LinqList <Local>();

            UnusedLocals   = new LinqHashSet <Local>();
            UnusedLabels   = new LinqHashSet <Label>();
            UnmarkedLabels = new LinqHashSet <Label>();

            Branches = new LinqList <SigilTuple <OpCode, Label, int> >();
            Marks    = new LinqDictionary <Label, int>();
            Returns  = new LinqList <int>();
            Throws   = new LinqList <int>();

            BranchPatches = new LinqDictionary <int, SigilTuple <Label, UpdateOpCodeDelegate, OpCode> >();

            CurrentExceptionBlock = new Stack <ExceptionBlock>();

            TryBlocks     = new LinqDictionary <ExceptionBlock, SigilTuple <int, int> >();
            CatchBlocks   = new LinqDictionary <CatchBlock, SigilTuple <int, int> >();
            FinallyBlocks = new LinqDictionary <FinallyBlock, SigilTuple <int, int> >();

            ReadonlyPatches = new LinqList <SigilTuple <int, TypeOnStack> >();

            Shorthand = new EmitShorthand <DelegateType>(this);

            FreedLocals = new LinqList <Local>();

            CurrentLocals = new LinqDictionary <string, Local>();
            Locals        = new LocalLookup(CurrentLocals);

            CurrentLabels = new LinqDictionary <string, Label>();
            Labels        = new LabelLookup(CurrentLabels);

            ElidableCasts = new LinqList <int>();

            TypesProducedAtIndex = new LinqDictionary <int, LinqList <TypeOnStack> >();

            var start = DefineLabel("__start");

            CurrentVerifiers = IsVerifying ? new RollingVerifier(start, UsesStrictBranchVerification) : new RollingVerifierWithoutVerification(start);
            MarkLabel(start);
        }
Esempio n. 2
0
        public RollingVerifier(Label beginAt)
        {
            RestoreOnMark = new LinqDictionary<Label, LinqList<VerifiableTracker>>();
            RestoreStacksOnMark = new LinqDictionary<Label, LinqList<LinqStack<LinqList<TypeOnStack>>>>();
            VerifyFromLabel = new LinqDictionary<Label, LinqList<VerifiableTracker>>();

            StacksAtLabels = new LinqDictionary<Label, SigilTuple<bool, LinqStack<LinqList<TypeOnStack>>>>();
            ExpectedStacksAtLabels = new LinqDictionary<Label, LinqList<SigilTuple<bool, LinqStack<LinqList<TypeOnStack>>>>>();

            EmptyCurrentScope();

            Add(new VerifiableTracker(beginAt), new LinqStack<LinqList<TypeOnStack>>());
        }
Esempio n. 3
0
        public RollingVerifier(Label beginAt, bool strictBranchVerification)
        {
            UsesStrictBranchVerification = strictBranchVerification;

            RestoreOnMark = new LinqDictionary<Label, LinqList<VerifiableTracker>>();
            RestoreStacksOnMark = new LinqDictionary<Label, LinqList<LinqStack<LinqList<TypeOnStack>>>>();
            VerifyFromLabel = new LinqDictionary<Label, LinqList<VerifiableTracker>>();

            StacksAtLabels = new LinqDictionary<Label, SigilTuple<bool, LinqStack<LinqList<TypeOnStack>>>>();
            ExpectedStacksAtLabels = new LinqDictionary<Label, LinqList<SigilTuple<bool, LinqStack<LinqList<TypeOnStack>>>>>();

            MustBeEmptyWhenBranchedTo = new LinqHashSet<Label>();

            EmptyCurrentScope();
            
            Add(new VerifiableTracker(beginAt), new LinqStack<LinqList<TypeOnStack>>());
        }
Esempio n. 4
0
 internal LabelLookup(LinqDictionary <string, Label> innerLookup)
 {
     InnerLookup = innerLookup;
 }
Esempio n. 5
0
 internal LabelLookup(LinqDictionary<string, Label> innerLookup)
 {
     InnerLookup = innerLookup;
 }