Exemplo n.º 1
0
        internal unsafe DynamicILGenerator(DynamicMethod method, byte[] methodSignature, int size)
            : base(method, size)
        {
            m_scope = new DynamicScope();

            m_methodSigToken = m_scope.GetTokenFor(methodSignature);
        }
 internal DynamicResolver(DynamicILInfo dynamicILInfo)
 {
     this.m_stackSize = dynamicILInfo.MaxStackSize;
     this.m_code = dynamicILInfo.Code;
     this.m_localSignature = dynamicILInfo.LocalSignature;
     this.m_exceptionHeader = dynamicILInfo.Exceptions;
     this.m_scope = dynamicILInfo.DynamicScope;
     this.m_method = dynamicILInfo.DynamicMethod;
     this.m_method.m_resolver = this;
 }
 internal DynamicResolver(DynamicILGenerator ilGenerator)
 {
     this.m_stackSize = ilGenerator.GetMaxStackSize();
     this.m_exceptions = ilGenerator.GetExceptions();
     this.m_code = ilGenerator.BakeByteArray();
     this.m_localSignature = ilGenerator.m_localSignature.InternalGetSignatureArray();
     this.m_scope = ilGenerator.m_scope;
     this.m_method = (DynamicMethod) ilGenerator.m_methodBuilder;
     this.m_method.m_resolver = this;
 }
Exemplo n.º 4
0
        internal DynamicResolver(DynamicILGenerator ilGenerator)
        {
            m_stackSize      = ilGenerator.GetMaxStackSize();
            m_exceptions     = ilGenerator.GetExceptions() !;
            m_code           = ilGenerator.BakeByteArray() !;
            m_localSignature = ilGenerator.m_localSignature.InternalGetSignatureArray();
            m_scope          = ilGenerator.m_scope;

            m_method            = (DynamicMethod)ilGenerator.m_methodBuilder;
            m_method.m_resolver = this;
        }
Exemplo n.º 5
0
        [System.Security.SecurityCritical]  // auto-generated
        internal DynamicILInfo GetDynamicILInfo(DynamicScope scope)
        {
            if (m_DynamicILInfo == null)
            {
                byte[] methodSignature = SignatureHelper.GetMethodSigHelper(
                    null, CallingConvention, ReturnType, null, null, m_parameterTypes, null, null).GetSignature(true);
                m_DynamicILInfo = new DynamicILInfo(scope, this, methodSignature);
            }

            return(m_DynamicILInfo);
        }
Exemplo n.º 6
0
        internal DynamicResolver(DynamicILInfo dynamicILInfo)
        {
            m_stackSize       = dynamicILInfo.MaxStackSize;
            m_code            = dynamicILInfo.Code;
            m_localSignature  = dynamicILInfo.LocalSignature;
            m_exceptionHeader = dynamicILInfo.Exceptions;
            //m_exceptions = dynamicILInfo.Exceptions;
            m_scope = dynamicILInfo.DynamicScope;

            m_method            = dynamicILInfo.DynamicMethod;
            m_method.m_resolver = this;
        }
Exemplo n.º 7
0
        internal unsafe DynamicILGenerator(DynamicMethod method, byte[] methodSignature, int size) 
            : base(method, size)
        {
            m_scope = new DynamicScope();
 
            // Token #1
            int dmMethodToken = m_scope.GetTokenFor(method); 
            Contract.Assert((dmMethodToken & 0x00FFFFFF) == DynamicResolver.TOKENFORDYNAMICMETHOD, "Bad token number!"); 

            // Token #2 
            m_methodSigToken = m_scope.GetTokenFor(methodSignature);
        }
Exemplo n.º 8
0
        [System.Security.SecurityCritical]  // auto-generated
        internal DynamicILInfo GetDynamicILInfo(DynamicScope scope)
        {
            if (m_DynamicILInfo == null)
            {
                byte[] methodSignature = SignatureHelper.GetMethodSigHelper(
                        null, CallingConvention, ReturnType, null, null, m_parameterTypes, null, null).GetSignature(true);
                m_DynamicILInfo = new DynamicILInfo(scope, this, methodSignature);
            }

            return m_DynamicILInfo;
        }
Exemplo n.º 9
0
 internal DynamicILInfo(DynamicScope scope, DynamicMethod method, byte[] methodSignature)
 {
     m_method = method;
     m_scope = scope;
     m_methodSignature = m_scope.GetTokenFor(methodSignature);
     m_exceptions = EmptyArray<Byte>.Value;
     m_code = EmptyArray<Byte>.Value;
     m_localSignature = EmptyArray<Byte>.Value;
 }
Exemplo n.º 10
0
 internal DynamicILGenerator(DynamicMethod method, byte[] methodSignature, int size) : base(method, size)
 {
     this.m_scope = new DynamicScope();
     this.m_scope.GetTokenFor(method);
     this.m_methodSigToken = this.m_scope.GetTokenFor(methodSignature);
 }
 internal DynamicILInfo(DynamicScope scope, DynamicMethod method, byte[] methodSignature)
 {
     m_method = method;
     m_scope = scope;
     m_methodSignature = m_scope.GetTokenFor(methodSignature);
     m_exceptions = new byte[0];
     m_code = new byte[0];
     m_localSignature = new byte[0];
 }
Exemplo n.º 12
0
        internal void AddDynamicArgument(DynamicScope dynamicScope, Type clsArgument, Type[]?requiredCustomModifiers, Type[]?optionalCustomModifiers)
        {
            IncrementArgCounts();

            Debug.Assert(clsArgument != null);

            if (optionalCustomModifiers != null)
            {
                for (int i = 0; i < optionalCustomModifiers.Length; i++)
                {
                    Type t = optionalCustomModifiers[i];

                    if (t is not RuntimeType rtType)
                    {
                        throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(optionalCustomModifiers));
                    }

                    if (t.HasElementType)
                    {
                        throw new ArgumentException(SR.Argument_ArraysInvalid, nameof(optionalCustomModifiers));
                    }

                    if (t.ContainsGenericParameters)
                    {
                        throw new ArgumentException(SR.Argument_GenericsInvalid, nameof(optionalCustomModifiers));
                    }

                    AddElementType(CorElementType.ELEMENT_TYPE_CMOD_OPT);

                    int token = dynamicScope.GetTokenFor(rtType.TypeHandle);
                    Debug.Assert(!MetadataToken.IsNullToken(token));
                    AddToken(token);
                }
            }

            if (requiredCustomModifiers != null)
            {
                for (int i = 0; i < requiredCustomModifiers.Length; i++)
                {
                    Type t = requiredCustomModifiers[i];

                    if (t is not RuntimeType rtType)
                    {
                        throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(requiredCustomModifiers));
                    }

                    if (t.HasElementType)
                    {
                        throw new ArgumentException(SR.Argument_ArraysInvalid, nameof(requiredCustomModifiers));
                    }

                    if (t.ContainsGenericParameters)
                    {
                        throw new ArgumentException(SR.Argument_GenericsInvalid, nameof(requiredCustomModifiers));
                    }

                    AddElementType(CorElementType.ELEMENT_TYPE_CMOD_REQD);

                    int token = dynamicScope.GetTokenFor(rtType.TypeHandle);
                    Debug.Assert(!MetadataToken.IsNullToken(token));
                    AddToken(token);
                }
            }

            AddOneArgTypeHelper(clsArgument);
        }
 internal unsafe DynamicILGenerator(DynamicMethod method, byte[] methodSignature, int size)
     : base(method, size)
 {
     m_scope          = new DynamicScope();
     m_methodSigToken = m_scope.GetTokenFor(methodSignature);
 }
 internal DynamicILGenerator(DynamicMethod method, byte[] methodSignature, int size) : base(method, size)
 {
     this.m_scope = new DynamicScope();
     this.m_scope.GetTokenFor(method);
     this.m_methodSigToken = this.m_scope.GetTokenFor(methodSignature);
 }