GetSignature() public method

public GetSignature ( ) : byte[]
return byte[]
Esempio n. 1
0
        internal void GenerateDebugInfo(ISymbolWriter symbolWriter)
        {
            if (sequencePointLists != null)
            {
                SequencePointList first = (SequencePointList)sequencePointLists [0];
                SequencePointList last  = (SequencePointList)sequencePointLists [sequencePointLists.Count - 1];
                symbolWriter.SetMethodSourceRange(first.Document, first.StartLine, first.StartColumn, last.Document, last.EndLine, last.EndColumn);

                foreach (SequencePointList list in sequencePointLists)
                {
                    symbolWriter.DefineSequencePoints(list.Document, list.GetOffsets(), list.GetLines(), list.GetColumns(), list.GetEndLines(), list.GetEndColumns());
                }

                if (locals != null)
                {
                    foreach (LocalBuilder local in locals)
                    {
                        if (local.Name != null && local.Name.Length > 0)
                        {
                            SignatureHelper sighelper = SignatureHelper.GetLocalVarSigHelper(module as ModuleBuilder);
                            sighelper.AddArgument(local.LocalType);
                            byte[] signature = sighelper.GetSignature();
                            symbolWriter.DefineLocalVariable(local.Name, FieldAttributes.Public, signature, SymAddressKind.ILOffset, local.position, 0, 0, local.StartOffset, local.EndOffset);
                        }
                    }
                }
                sequencePointLists = null;
            }
        }
Esempio n. 2
0
        public override void Emit(OpCode opcode, SignatureHelper signature)
        {
            if (signature == null)
            {
                throw new ArgumentNullException(nameof(signature));
            }

            int stackchange = 0;

            EnsureCapacity(7);
            InternalEmit(opcode);

            // The only IL instruction that has VarPop behaviour, that takes a
            // Signature token as a parameter is calli.  Pop the parameters and
            // the native function pointer.  To be conservative, do not pop the
            // this pointer since this information is not easily derived from
            // SignatureHelper.
            if (opcode.StackBehaviourPop == StackBehaviour.Varpop)
            {
                Debug.Assert(opcode.Equals(OpCodes.Calli),
                             "Unexpected opcode encountered for StackBehaviour VarPop.");
                // Pop the arguments..
                stackchange -= signature.ArgumentCount;
                // Pop native function pointer off the stack.
                stackchange--;
                UpdateStackSize(opcode, stackchange);
            }

            int token = GetTokenForSig(signature.GetSignature(true));

            PutInteger4(token);
        }
Esempio n. 3
0
        public override void EmitCalli(OpCode opcode, CallingConvention unmanagedCallConv, Type?returnType, Type[]?parameterTypes)
        {
            int stackchange = 0;
            int cParams     = 0;

            if (parameterTypes != null)
            {
                cParams = parameterTypes.Length;
            }

            SignatureHelper sig = GetMethodSigHelper(unmanagedCallConv, returnType, parameterTypes);

            // If there is a non-void return type, push one.
            if (returnType != typeof(void))
            {
                stackchange++;
            }

            // Pop off arguments if any.
            if (parameterTypes != null)
            {
                stackchange -= cParams;
            }

            // Pop the native function pointer.
            stackchange--;
            UpdateStackSize(OpCodes.Calli, stackchange);

            EnsureCapacity(7);
            Emit(OpCodes.Calli);

            int token = GetTokenForSig(sig.GetSignature(true));

            PutInteger4(token);
        }
Esempio n. 4
0
        //
        //
        // Signature related calls (vararg, calli)
        //
        //
        public override void EmitCalli(OpCode opcode,
                                       CallingConventions callingConvention,
                                       Type?returnType,
                                       Type[]?parameterTypes,
                                       Type[]?optionalParameterTypes)
        {
            int stackchange = 0;

            if (optionalParameterTypes != null)
            {
                if ((callingConvention & CallingConventions.VarArgs) == 0)
                {
                    throw new InvalidOperationException(SR.InvalidOperation_NotAVarArgCallingConvention);
                }
            }


            SignatureHelper sig = GetMethodSigHelper(callingConvention,
                                                     returnType,
                                                     parameterTypes,
                                                     null,
                                                     null,
                                                     optionalParameterTypes);

            EnsureCapacity(7);
            Emit(OpCodes.Calli);

            // If there is a non-void return type, push one.
            if (returnType != typeof(void))
            {
                stackchange++;
            }
            // Pop off arguments if any.
            if (parameterTypes != null)
            {
                stackchange -= parameterTypes.Length;
            }
            // Pop off vararg arguments.
            if (optionalParameterTypes != null)
            {
                stackchange -= optionalParameterTypes.Length;
            }
            // Pop the this parameter if the method has a this parameter.
            if ((callingConvention & CallingConventions.HasThis) == CallingConventions.HasThis)
            {
                stackchange--;
            }
            // Pop the native function pointer.
            stackchange--;
            UpdateStackSize(OpCodes.Calli, stackchange);

            int token = GetTokenForSig(sig.GetSignature(true));

            PutInteger4(token);
        }
Esempio n. 5
0
        public override void Emit(OpCode opcode, SignatureHelper signature)
        {
            if (signature == null)
            {
                throw new ArgumentNullException("signature");
            }
            int num = 0;

            this.EnsureCapacity(7);
            this.InternalEmit(opcode);
            if (opcode.StackBehaviourPop == StackBehaviour.Varpop)
            {
                int stackchange = num - signature.ArgumentCount - 1;
                this.UpdateStackSize(opcode, stackchange);
            }
            this.PutInteger4(this.GetTokenForSig(signature.GetSignature(true)));
        }
Esempio n. 6
0
        public override void Emit(OpCode opcode, SignatureHelper signature)
        {
            if (signature == null)
            {
                throw new ArgumentNullException("signature");
            }
            int stackchange = 0;

            base.EnsureCapacity(7);
            base.InternalEmit(opcode);
            if (opcode.m_pop == StackBehaviour.Varpop)
            {
                stackchange -= signature.ArgumentCount;
                stackchange--;
                base.UpdateStackSize(opcode, stackchange);
            }
            int num2 = this.AddSignature(signature.GetSignature(true));

            base.PutInteger4(num2);
        }
Esempio n. 7
0
        // Token: 0x060048C3 RID: 18627 RVA: 0x00106BD8 File Offset: 0x00104DD8
        public override void Emit(OpCode opcode, SignatureHelper signature)
        {
            if (signature == null)
            {
                throw new ArgumentNullException("signature");
            }
            int num = 0;

            base.EnsureCapacity(7);
            base.InternalEmit(opcode);
            if (opcode.StackBehaviourPop == StackBehaviour.Varpop)
            {
                num -= signature.ArgumentCount;
                num--;
                base.UpdateStackSize(opcode, num);
            }
            int tokenForSig = this.GetTokenForSig(signature.GetSignature(true));

            base.PutInteger4(tokenForSig);
        }
        public override void Emit(OpCode opcode, SignatureHelper signature)
        {
            if (signature == null)
                throw new ArgumentNullException(nameof(signature));
            Contract.EndContractBlock();

            int stackchange = 0;
            EnsureCapacity(7);
            InternalEmit(opcode);

            // The only IL instruction that has VarPop behaviour, that takes a
            // Signature token as a parameter is calli.  Pop the parameters and
            // the native function pointer.  To be conservative, do not pop the
            // this pointer since this information is not easily derived from
            // SignatureHelper.
            if (opcode.StackBehaviourPop == StackBehaviour.Varpop)
            {
                Contract.Assert(opcode.Equals(OpCodes.Calli),
                                "Unexpected opcode encountered for StackBehaviour VarPop.");
                // Pop the arguments..
                stackchange -= signature.ArgumentCount;
                // Pop native function pointer off the stack.
                stackchange--;
                UpdateStackSize(opcode, stackchange);
            }

            int token = GetTokenForSig(signature.GetSignature(true)); ;
            PutInteger4(token);
        }
 public override void Emit(OpCode opcode, SignatureHelper signature)
 {
     if (signature == null)
     {
         throw new ArgumentNullException("signature");
     }
     int stackchange = 0;
     base.EnsureCapacity(7);
     base.InternalEmit(opcode);
     if (opcode.m_pop == StackBehaviour.Varpop)
     {
         stackchange -= signature.ArgumentCount;
         stackchange--;
         base.UpdateStackSize(opcode, stackchange);
     }
     int num2 = this.AddSignature(signature.GetSignature(true));
     base.PutInteger4(num2);
 }