コード例 #1
0
 internal MappedField(string name, Microsoft.Cci.INamedTypeDefinition containingType, Microsoft.Cci.ITypeReference type, Microsoft.Cci.ISectionBlock block)
 {
     this.containingType = containingType;
     this.type           = type;
     this.block          = block;
     this.name           = name;
 }
コード例 #2
0
        internal PrivateImplementationDetails(
            Microsoft.Cci.IModule module,
            int submissionSlotIndex,
            Microsoft.Cci.ITypeReference systemObject,
            Microsoft.Cci.ITypeReference systemValueType,
            Microsoft.Cci.ITypeReference systemInt8Type,
            Microsoft.Cci.ITypeReference systemInt16Type,
            Microsoft.Cci.ITypeReference systemInt32Type,
            Microsoft.Cci.ITypeReference systemInt64Type,
            Microsoft.Cci.ICustomAttribute compilerGeneratedAttribute)
        {
            Debug.Assert(module != null);
            Debug.Assert(systemObject != null);
            Debug.Assert(systemValueType != null);

            this.module          = module;
            this.systemObject    = systemObject;
            this.systemValueType = systemValueType;

            this.systemInt8Type  = systemInt8Type;
            this.systemInt16Type = systemInt16Type;
            this.systemInt32Type = systemInt32Type;
            this.systemInt64Type = systemInt64Type;

            this.compilerGeneratedAttribute = compilerGeneratedAttribute;
            this.name = GetClassName(submissionSlotIndex);
        }
コード例 #3
0
        internal PrivateImplementationDetails(
            Microsoft.Cci.IModule module,
            Microsoft.Cci.ITypeReference systemObject,
            Microsoft.Cci.ITypeReference systemValueType,
            Microsoft.Cci.ITypeReference systemInt8Type,
            Microsoft.Cci.ITypeReference systemInt16Type,
            Microsoft.Cci.ITypeReference systemInt32Type,
            Microsoft.Cci.ITypeReference systemInt64Type,
            Microsoft.Cci.ICustomAttribute compilerGeneratedAttribute)
        {
            Debug.Assert(module != null);
            Debug.Assert(systemObject != null);
            Debug.Assert(systemValueType != null);

            this.module = module;
            this.systemObject = systemObject;
            this.systemValueType = systemValueType;

            this.systemInt8Type = systemInt8Type;
            this.systemInt16Type = systemInt16Type;
            this.systemInt32Type = systemInt32Type;
            this.systemInt64Type = systemInt64Type;

            this.compilerGeneratedAttribute = compilerGeneratedAttribute;
            this.name = GetClassName(module.PersistentIdentifier);
        }
コード例 #4
0
ファイル: CustomModifier.cs プロジェクト: sperling/cskarp
        public CustomModifier(Microsoft.Cci.ITypeReference modifier, bool isOptional)
        {
            Contract.ThrowIfNull(modifier);

            this.modifier   = modifier;
            this.isOptional = isOptional;
        }
コード例 #5
0
        protected override LocalDefinition DeclareLocalInternal(
            Microsoft.Cci.ITypeReference type,
            object identity,
            string name,
            bool isCompilerGenerated,
            LocalSlotConstraints constraints,
            bool isDynamic,
            ImmutableArray <TypedConstant> dynamicTransformFlags)
        {
            if (allLocals == null)
            {
                allLocals = ImmutableArray.CreateBuilder <LocalDefinition>(1);
            }

            var local = new LocalDefinition(
                identity: identity,
                name: name,
                type: type,
                slot: this.allLocals.Count,
                isCompilerGenerated: isCompilerGenerated,
                constraints: constraints,
                isDynamic: isDynamic,
                dynamicTransformFlags: dynamicTransformFlags);

            this.allLocals.Add(local);
            return(local);
        }
コード例 #6
0
ファイル: CustomModifier.cs プロジェクト: EkardNT/Roslyn
        public CustomModifier(Microsoft.Cci.ITypeReference modifier, bool isOptional)
        {
            Contract.ThrowIfNull(modifier);

            this.modifier = modifier;
            this.isOptional = isOptional;
        }
コード例 #7
0
        public ModifiedTypeReference(Microsoft.Cci.ITypeReference modifiedType, IEnumerable <Microsoft.Cci.ICustomModifier> customModifiers)
        {
            Contract.ThrowIfNull(modifiedType);
            Contract.ThrowIfNull(customModifiers);

            this.modifiedType    = modifiedType;
            this.customModifiers = customModifiers;
        }
コード例 #8
0
        public ModifiedTypeReference(Microsoft.Cci.ITypeReference modifiedType, IEnumerable<Microsoft.Cci.ICustomModifier> customModifiers)
        {
            Contract.ThrowIfNull(modifiedType);
            Contract.ThrowIfNull(customModifiers);

            this.modifiedType = modifiedType;
            this.customModifiers = customModifiers;
        }
コード例 #9
0
 protected abstract LocalDefinition DeclareLocalInternal(
     Microsoft.Cci.ITypeReference type,
     object identity,
     string name,
     bool isCompilerGenerated,
     LocalSlotConstraints constraints,
     bool isDynamic,
     ImmutableArray <TypedConstant> dynamicTransformFlags);
コード例 #10
0
        private static void VisitTypeReference(Microsoft.Cci.ITypeReference typeReference, Microsoft.CodeAnalysis.Emit.Context context)
        {
            Debug.Assert(typeReference != null);

            Microsoft.Cci.IArrayTypeReference arrayType = typeReference as Microsoft.Cci.IArrayTypeReference;
            if (arrayType != null)
            {
                VisitTypeReference(arrayType.GetElementType(context), context);
                return;
            }

            Microsoft.Cci.IPointerTypeReference pointerType = typeReference as Microsoft.Cci.IPointerTypeReference;
            if (pointerType != null)
            {
                VisitTypeReference(pointerType.GetTargetType(context), context);
                return;
            }

            Debug.Assert(!(typeReference is Microsoft.Cci.IManagedPointerTypeReference));
            //Microsoft.Cci.IManagedPointerTypeReference managedPointerType = typeReference as Microsoft.Cci.IManagedPointerTypeReference;
            //if (managedPointerType != null)
            //{
            //    VisitTypeReference(managedPointerType.GetTargetType(this.context));
            //    return;
            //}

            Microsoft.Cci.IModifiedTypeReference modifiedType = typeReference as Microsoft.Cci.IModifiedTypeReference;
            if (modifiedType != null)
            {
                foreach (var custModifier in modifiedType.CustomModifiers)
                {
                    VisitTypeReference(custModifier.GetModifier(context), context);
                }
                VisitTypeReference(modifiedType.UnmodifiedType, context);
                return;
            }

            // Visit containing type
            Microsoft.Cci.INestedTypeReference nestedType = typeReference.AsNestedTypeReference;
            if (nestedType != null)
            {
                VisitTypeReference(nestedType.GetContainingType(context), context);
            }

            // Visit generic arguments
            Microsoft.Cci.IGenericTypeInstanceReference genericInstance = typeReference.AsGenericTypeInstanceReference;
            if (genericInstance != null)
            {
                foreach (var arg in genericInstance.GetGenericArguments(context))
                {
                    VisitTypeReference(arg, context);
                }
            }
        }
コード例 #11
0
        internal void OpenLocalScope(ScopeType scopeType = ScopeType.Variable, Microsoft.Cci.ITypeReference exceptionType = null)
        {
            if (scopeType == ScopeType.TryCatchFinally && IsJustPastLabel())
            {
                DefineHiddenSeqPoint();
                EmitOpCode(ILOpCode.Nop);
            }

            if (scopeType == ScopeType.Finally)
            {
                // WORKAROUND:
                // This is a workaround to an unexpected consequence of a CLR update that causes try nested in finally not verify
                // if there is no code before try. ( DevDiv: 563799 )
                // If we will treat finally as a label, the code above will force a nop before try starts.
                this.instructionCountAtLastLabel = this.emitState.InstructionsEmitted;
            }

            EndBlock();  //blocks should not cross scope boundaries.
            var scope = scopeManager.OpenScope(scopeType, exceptionType);

            // Exception handler scopes must have a leader block, even
            // if the exception handler is empty, and created before any
            // other block (before nested scope blocks in particular).
            switch (scopeType)
            {
            case ScopeType.Try:
                Debug.Assert(!this.pendingBlockCreate);
                this.pendingBlockCreate = true;
                break;

            case ScopeType.Catch:
            case ScopeType.Filter:
            case ScopeType.Finally:
            case ScopeType.Fault:
                Debug.Assert(!this.pendingBlockCreate);
                this.pendingBlockCreate = true;

                // this is the actual start of the handler.
                // since it is reachable by an implicit jump (via exception handling)
                // we need to put a hidden point to ensure that debugger does not associate
                // this location with some previous sequence point
                DefineHiddenSeqPoint();

                break;

            case ScopeType.Variable:
            case ScopeType.TryCatchFinally:
            case ScopeType.IteratorVariable:
                break;

            default:
                throw ExceptionUtilities.UnexpectedValue(scopeType);
            }
        }
コード例 #12
0
 public EncLocalDefinition(
     object identity,
     string name,
     Microsoft.Cci.ITypeReference type,
     int slot,
     bool isCompilerGenerated,
     bool isPinned,
     bool isReference,
     bool isDynamic,
     ImmutableArray <CommonTypedConstant> dynamicTransformFlags) :
     base(name, type, slot, isCompilerGenerated: isCompilerGenerated, isPinned: isPinned, isReference: isReference, isDynamic: isDynamic, dynamicTransformFlags: dynamicTransformFlags)
 {
     this.identity = identity;
 }
コード例 #13
0
        protected override LocalDefinition DeclareLocalInternal(
            Microsoft.Cci.ITypeReference type,
            object identity,
            string name,
            bool isCompilerGenerated,
            LocalSlotConstraints constraints,
            bool isDynamic,
            ImmutableArray <TypedConstant> dynamicTransformFlags)
        {
            LocalDefinition local;

            if (identity != null)
            {
                int slot = this.getPreviousLocalSlot(identity, type, constraints);
                if (slot >= 0)
                {
                    Debug.Assert(this.allLocals[slot].Identity == null);

                    local = new LocalDefinition(
                        identity: identity,
                        name: name,
                        type: type,
                        slot: slot,
                        isCompilerGenerated: isCompilerGenerated,
                        constraints: constraints,
                        isDynamic: isDynamic,
                        dynamicTransformFlags: dynamicTransformFlags);
                    this.allLocals[slot] = local;
                    return(local);
                }
            }

            local = new LocalDefinition(
                identity: identity,
                name: name,
                type: type,
                slot: this.allLocals.Count,
                isCompilerGenerated: isCompilerGenerated,
                constraints: constraints,
                isDynamic: isDynamic,
                dynamicTransformFlags: dynamicTransformFlags);
            this.allLocals.Add(local);
            return(local);
        }
コード例 #14
0
ファイル: LocalDefinition.cs プロジェクト: riversky/roslyn
 /// <summary>
 /// Creates a new LocalDefinition.
 /// </summary>
 /// <param name="identity">Local symbol, used by edit and continue only, null otherwise.</param>
 /// <param name="name">Name associated with the slot.</param>
 /// <param name="type">Type associated with the slot.</param>
 /// <param name="slot">Slot position in the signature.</param>
 /// <param name="dynamicTransformFlags">Contains the synthesized dynamic attributes of the local</param>
 /// <param name="isCompilerGenerated">True if the local was not declared in source.</param>
 /// <param name="constraints">Specifies whether slot type should have pinned modifier and whether slot should have byref constraint.</param>
 /// <param name="isDynamic">Specifies if the type is Dynamic.</param>
 public LocalDefinition(
     object identity,
     string name,
     Microsoft.Cci.ITypeReference type,
     int slot,
     bool isCompilerGenerated,
     LocalSlotConstraints constraints,
     bool isDynamic,
     ImmutableArray<TypedConstant> dynamicTransformFlags)
 {
     this.identity = identity;
     this.name = name;
     this.type = type;
     this.slot = slot;
     this.isCompilerGenerated = isCompilerGenerated;
     this.dynamicTransformFlags = dynamicTransformFlags;
     this.constraints = constraints;
     this.isDynamic = isDynamic;
 }
コード例 #15
0
        internal LocalDefinition DeclareLocal(
            Microsoft.Cci.ITypeReference type,
            object identity,
            string name,
            bool isCompilerGenerated,
            LocalSlotConstraints constraints,
            bool isDynamic,
            ImmutableArray <TypedConstant> dynamicTransformFlags)
        {
            LocalDefinition local;

            if ((name != null) || !FreeSlots.TryPop(new LocalSignature(type, constraints), out local))
            {
                local = this.DeclareLocalInternal(type, identity, name, isCompilerGenerated, constraints, isDynamic, dynamicTransformFlags);
            }

            LocalMap.Add(identity, local);
            return(local);
        }
コード例 #16
0
 /// <summary>
 /// Creates a new LocalDefinition.
 /// </summary>
 /// <param name="identity">Local symbol, used by edit and continue only, null otherwise.</param>
 /// <param name="name">Name associated with the slot.</param>
 /// <param name="type">Type associated with the slot.</param>
 /// <param name="slot">Slot position in the signature.</param>
 /// <param name="dynamicTransformFlags">Contains the synthesized dynamic attributes of the local</param>
 /// <param name="isCompilerGenerated">True if the local was not declared in source.</param>
 /// <param name="constraints">Specifies whether slot type should have pinned modifier and whether slot should have byref constraint.</param>
 /// <param name="isDynamic">Specifies if the type is Dynamic.</param>
 public LocalDefinition(
     object identity,
     string name,
     Microsoft.Cci.ITypeReference type,
     int slot,
     bool isCompilerGenerated,
     LocalSlotConstraints constraints,
     bool isDynamic,
     ImmutableArray <TypedConstant> dynamicTransformFlags)
 {
     this.identity              = identity;
     this.name                  = name;
     this.type                  = type;
     this.slot                  = slot;
     this.isCompilerGenerated   = isCompilerGenerated;
     this.dynamicTransformFlags = dynamicTransformFlags;
     this.constraints           = constraints;
     this.isDynamic             = isDynamic;
 }
コード例 #17
0
        /// <summary>
        /// Gets a local slot.
        /// </summary>
        internal LocalDefinition AllocateSlot(
            Microsoft.Cci.ITypeReference type,
            LocalSlotConstraints constraints,
            ImmutableArray <TypedConstant> dynamicTransformFlags = default(ImmutableArray <TypedConstant>))
        {
            LocalDefinition local;

            if (!FreeSlots.TryPop(new LocalSignature(type, constraints), out local))
            {
                local = this.DeclareLocalInternal(
                    type: type,
                    identity: null,
                    name: null,
                    isCompilerGenerated: true,
                    constraints: constraints,
                    isDynamic: false,
                    dynamicTransformFlags: dynamicTransformFlags);
            }
            return(local);
        }
コード例 #18
0
        internal Microsoft.Cci.IFieldReference CreateDataField(byte[] data)
        {
            Debug.Assert(!IsFrozen);

            Microsoft.Cci.ITypeReference type = this.proxyTypes.GetOrAdd((uint)data.Length, size => GetStorageStruct(size));

            DebuggerUtilities.CallBeforeAcquiringLock(); //see method comment

            var block = new MetadataBlock(data);

            //This object may be accessed concurrently
            //it is not expected to have a lot of contention here so we will just use lock
            //if it becomes an issue we can switch to lock-free data structures.
            lock (this.mappedFields)
            {
                var name     = GenerateDataFieldName(this.mappedFields.Count);
                var newField = new MappedField(name, this, type, block);
                this.mappedFields.Add(newField);

                return(newField);
            }
        }
コード例 #19
0
ファイル: LocalDefinition.cs プロジェクト: EkardNT/Roslyn
 public LocalDefinition(string name, Microsoft.Cci.ITypeReference type)
 {
     this.name = name;
     this.type = type;
 }
コード例 #20
0
ファイル: AliasForType.cs プロジェクト: sperling/cskarp
        public AliasForType(Microsoft.Cci.ITypeReference aliasedType)
        {
            Contract.ThrowIfNull(aliasedType);

            this.aliasedType = aliasedType;
        }
コード例 #21
0
 internal MappedField(string name, Microsoft.Cci.INamedTypeDefinition containingType, Microsoft.Cci.ITypeReference type, Microsoft.Cci.ISectionBlock block)
 {
     this.containingType = containingType;
     this.type = type;
     this.block = block;
     this.name = name;
 }
コード例 #22
0
        public AliasForType(Microsoft.Cci.ITypeReference aliasedType)
        {
            Contract.ThrowIfNull(aliasedType);

            this.aliasedType = aliasedType;
        }
コード例 #23
0
ファイル: LocalDefinition.cs プロジェクト: sperling/cskarp
 public LocalDefinition(string name, Microsoft.Cci.ITypeReference type)
 {
     this.name = name;
     this.type = type;
 }
コード例 #24
0
 internal ExplicitSizeStruct(uint size, PrivateImplementationDetails containingType, Microsoft.Cci.ITypeReference sysValueType)
 {
     this.size           = size;
     this.containingType = containingType;
     this.sysValueType   = sysValueType;
 }
コード例 #25
0
 public ArgListParameterTypeInformation(int ordinal, bool isByRef, Microsoft.Cci.ITypeReference type)
 {
     this.ordinal = (ushort)ordinal;
     this.isByRef = isByRef;
     this.type = type;
 }
コード例 #26
0
 public ArgListParameterTypeInformation(int ordinal, bool isByRef, Microsoft.Cci.ITypeReference type)
 {
     this.ordinal = (ushort)ordinal;
     this.isByRef = isByRef;
     this.type    = type;
 }
コード例 #27
0
 internal ExplicitSizeStruct(uint size, PrivateImplementationDetails containingType, Microsoft.Cci.ITypeReference sysValueType)
 {
     this.size = size;
     this.containingType = containingType;
     this.sysValueType = sysValueType;
 }
コード例 #28
0
 internal LocalSignature(Microsoft.Cci.ITypeReference valType, LocalSlotConstraints constraints)
 {
     this.Constraints = constraints;
     this.Type        = valType;
 }