Exemple #1
0
        internal MethodEx(MethodBase method, ILMethodDecoder decoder)
        {
            this.method = method;
            ArrayList list = new ArrayList();

            locals = new LocalVariables(decoder.GetLocalVarTypes());

            while (!decoder.EndOfCode())
            {
                list.Add(new Instruction(decoder));
            }

            body = new Instruction [list.Count];
            list.CopyTo(body);

            int[] offsetsMap = new int [decoder.CodeSize];
            for (int i = 0; i < body.Length; i++)
            {
                offsetsMap[body[i].startOffset] = i;
            }

            foreach (Instruction instr in body)
            {
                instr.FixOffset(offsetsMap);
            }

            ehClauses = new EHClausesArray(decoder.GetEHDecoder(), offsetsMap);

            verified = Verifier.Check(this);
        }
Exemple #2
0
		static public int FindNextHandler(int iNum,EHClausesArray clauses)
		{
			int nearest = 1<<30;
			foreach(EHClause c in clauses)
			{
				if(c.HandlerStart > iNum && c.HandlerStart < nearest)
					nearest = c.HandlerStart;
				if(c.Kind == EHClauseKind.UserFilteredHandler && c.FilterStart > iNum && c.FilterStart < nearest)
					nearest = c.FilterStart;
			}
			return nearest;
		}
Exemple #3
0
        internal MethodEx(MethodBase method, ILMethodDecoder decoder)
        {
            this.method = method;
            ArrayList list = new ArrayList();

            locals = new LocalVariables(decoder.GetLocalVarTypes());

            while (! decoder.EndOfCode())
                list.Add(new Instruction(decoder));

            body = new Instruction [list.Count];
            list.CopyTo(body);

            int[] offsetsMap = new int [decoder.CodeSize];
            for (int i = 0; i < body.Length; i++)
                offsetsMap[body[i].startOffset] = i;

            foreach (Instruction instr in body)
                instr.FixOffset(offsetsMap);

            ehClauses = new EHClausesArray(decoder.GetEHDecoder(),offsetsMap);

            verified = Verifier.Check(this);
        }
Exemple #4
0
		static void PushExceptionOnStack(int iNum, StackTypes stack, EHClausesArray clauses)
		{
			foreach(EHClause c in clauses)
			{
				if(c.Kind == EHClauseKind.UserFilteredHandler)
				{
					if(c.FilterStart == iNum)
					{
						if(stack.Count != 0) 
							throw new VerifierException();
						stack.Push(new TypeEx(typeof(object)));
						return;
					}
				}
				if(c.HandlerStart == iNum)
				{
					if(stack.Count != 0) 
						throw new VerifierException();
					switch(c.Kind)
					{
						case EHClauseKind.FaultHandler:
						case EHClauseKind.UserFilteredHandler:
						{
							stack.Push(new TypeEx(typeof(object)));
						} break;
						case EHClauseKind.TypeFilteredHandler:
						{
							stack.Push(new TypeEx(c.ClassObject));
						} break;
					}
					return;
				}
			}
		}