Пример #1
0
 internal virtual void Free()
 {
     if (lazyRegularInstructions != null)
     {
         lazyRegularInstructions.Free();
         lazyRegularInstructions = null;
     }
 }
Пример #2
0
 public MethodBody(Microsoft.Cci.MemoryStream ilBits,
                   ushort maxStack,
                   Microsoft.Cci.IMethodDefinition parent,
                   IEnumerable <LocalDefinition> locals,
                   Microsoft.Cci.SequencePoint[] sequencePoints)
 {
     this.ilBits         = ilBits;
     this.maxStack       = maxStack;
     this.parent         = parent;
     this.locals         = locals;
     this.sequencePoints = sequencePoints;
 }
 public MethodBody(Microsoft.Cci.MemoryStream ilBits,
     ushort maxStack,
     Microsoft.Cci.IMethodDefinition parent,
     IEnumerable<LocalDefinition> locals,
     Microsoft.Cci.SequencePoint[] sequencePoints)
 {
     this.ilBits = ilBits;
     this.maxStack = maxStack;
     this.parent = parent;
     this.locals = locals;
     this.sequencePoints = sequencePoints;
 }
Пример #4
0
        /// <summary>
        /// Produces a serialized blob of all constant initializers.
        /// Nonconstat initializers are matched with a zero of corresponding size.
        /// </summary>
        private byte[] GetRawData(ImmutableArray <BoundExpression> inits)
        {
            // the initial size is a guess.
            // there is no point to be precise here as MemoryStream always has N + 1 storage
            // and will need to be trimmed regardless
            var ms = new Microsoft.Cci.MemoryStream((uint)(inits.Length * 4));
            var bw = new Microsoft.Cci.BinaryWriter(ms);

            SerializeArrayRecursive(bw, inits);

            byte[] data = ms.Buffer;
            // trim
            Array.Resize(ref data, (int)ms.Position);

            return(data);
        }
Пример #5
0
 internal virtual void Free()
 {
     if (_lazyRegularInstructions != null)
     {
         _lazyRegularInstructions.Free();
         _lazyRegularInstructions = null;
     }
 }
Пример #6
0
 public MethodILBuilder(Emit.Module moduleBeingBuilt)
 {
     this.ilBits           = new Microsoft.Cci.MemoryStream();
     this.writer           = new Microsoft.Cci.BinaryWriter(this.ilBits);
     this.moduleBeingBuilt = moduleBeingBuilt;
 }
 public ILBuilder(Emit.Module moduleBeingBuilt)
 {
     this.ilBits = new Microsoft.Cci.MemoryStream();
     this.writer = new Microsoft.Cci.BinaryWriter(this.ilBits);
     this.moduleBeingBuilt = moduleBeingBuilt;
 }
Пример #8
0
        /// <summary>
        /// Produces a serialized blob of all constant initializers.
        /// Nonconstat initializers are matched with a zero of corresponding size.
        /// </summary>
        private byte[] GetRawData(ImmutableArray<BoundExpression> inits)
        {
            // the initial size is a guess.
            // there is no point to be precise here as MemoryStream always has N + 1 storage 
            // and will need to be trimmed regardless
            var ms = new Microsoft.Cci.MemoryStream((uint)(inits.Length * 4));
            var bw = new Microsoft.Cci.BinaryWriter(ms);

            SerializeArrayRecursive(bw, inits);

            byte[] data = ms.Buffer;
            // trim
            Array.Resize(ref data, (int)ms.Position);

            return data;
        }