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; }
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); }
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); }
public CustomModifier(Microsoft.Cci.ITypeReference modifier, bool isOptional) { Contract.ThrowIfNull(modifier); this.modifier = modifier; this.isOptional = isOptional; }
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); }
public ModifiedTypeReference(Microsoft.Cci.ITypeReference modifiedType, IEnumerable <Microsoft.Cci.ICustomModifier> customModifiers) { Contract.ThrowIfNull(modifiedType); Contract.ThrowIfNull(customModifiers); this.modifiedType = modifiedType; this.customModifiers = customModifiers; }
public ModifiedTypeReference(Microsoft.Cci.ITypeReference modifiedType, IEnumerable<Microsoft.Cci.ICustomModifier> customModifiers) { Contract.ThrowIfNull(modifiedType); Contract.ThrowIfNull(customModifiers); this.modifiedType = modifiedType; this.customModifiers = customModifiers; }
protected abstract LocalDefinition DeclareLocalInternal( Microsoft.Cci.ITypeReference type, object identity, string name, bool isCompilerGenerated, LocalSlotConstraints constraints, bool isDynamic, ImmutableArray <TypedConstant> dynamicTransformFlags);
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); } } }
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); } }
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; }
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); }
/// <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; }
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); }
/// <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; }
/// <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); }
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); } }
public LocalDefinition(string name, Microsoft.Cci.ITypeReference type) { this.name = name; this.type = type; }
public AliasForType(Microsoft.Cci.ITypeReference aliasedType) { Contract.ThrowIfNull(aliasedType); this.aliasedType = aliasedType; }
internal ExplicitSizeStruct(uint size, PrivateImplementationDetails containingType, Microsoft.Cci.ITypeReference sysValueType) { this.size = size; this.containingType = containingType; this.sysValueType = sysValueType; }
public ArgListParameterTypeInformation(int ordinal, bool isByRef, Microsoft.Cci.ITypeReference type) { this.ordinal = (ushort)ordinal; this.isByRef = isByRef; this.type = type; }
internal LocalSignature(Microsoft.Cci.ITypeReference valType, LocalSlotConstraints constraints) { this.Constraints = constraints; this.Type = valType; }