Exemplo n.º 1
0
 /// <summary>
 /// Initializes <see cref="otherMethods"/>, <see cref="getMethods"/>,
 /// and <see cref="setMethods"/>.
 /// </summary>
 protected virtual void InitializePropertyMethods_NoLock()
 {
     getMethods = ThreadSafeListCreator.Create<MethodDef>();
     setMethods = ThreadSafeListCreator.Create<MethodDef>();
     otherMethods = ThreadSafeListCreator.Create<MethodDef>();
 }
Exemplo n.º 2
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="local1">Local type #1</param>
		/// <param name="local2">Local type #2</param>
		/// <param name="local3">Local type #3</param>
		public LocalSig(TypeSig local1, TypeSig local2, TypeSig local3) {
			this.callingConvention = CallingConvention.LocalSig;
			this.locals = ThreadSafeListCreator.Create<TypeSig>(local1, local2, local3);
		}
Exemplo n.º 3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="flags">Flags</param>
 public VTable(VTableFlags flags)
 {
     this.flags   = flags;
     this.methods = ThreadSafeListCreator.Create <IMethod>();
 }
Exemplo n.º 4
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="genericType">The generic type</param>
		/// <param name="genArgs">Generic arguments</param>
		public GenericInstSig(ClassOrValueTypeSig genericType, IList<TypeSig> genArgs) {
			this.genericType = genericType;
			this.genericArgs = ThreadSafeListCreator.Create<TypeSig>(genArgs);
		}
Exemplo n.º 5
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="callingConvention">Calling convention (must have GenericInst set)</param>
		/// <param name="size">Number of generic args</param>
		internal GenericInstMethodSig(CallingConvention callingConvention, uint size) {
			this.callingConvention = callingConvention;
			this.genericArgs = ThreadSafeListCreator.Create<TypeSig>((int)size);
		}
Exemplo n.º 6
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ctor">Custom attribute constructor</param>
 /// <param name="arguments">Constructor arguments. The list is now owned by this instance.</param>
 /// <param name="namedArguments">Named arguments. The list is now owned by this instance.</param>
 /// <param name="blobReader">A reader that returns the original custom attribute blob data</param>
 internal CustomAttribute(ICustomAttributeType ctor, List<CAArgument> arguments, List<CANamedArgument> namedArguments, IBinaryReader blobReader)
 {
     this.ctor = ctor;
     this.arguments = arguments == null ? ThreadSafeListCreator.Create<CAArgument>() : ThreadSafeListCreator.MakeThreadSafe(arguments);
     this.namedArguments = namedArguments == null ? ThreadSafeListCreator.Create<CANamedArgument>() : ThreadSafeListCreator.MakeThreadSafe(namedArguments);
     this.blobReader = blobReader;
 }
Exemplo n.º 7
0
 /// <summary>Reset <see cref="AddMethod"/>, <see cref="InvokeMethod"/>, <see cref="RemoveMethod"/>, <see cref="OtherMethods"/></summary>
 protected void ResetMethods()
 {
     otherMethods = null;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="capacity">Initial capacity of <see cref="UsingCounts"/></param>
 public PdbUsingGroupsCustomDebugInfo(int capacity)
 {
     usingCounts = ThreadSafeListCreator.Create <ushort>(capacity);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="capacity">Initial capacity of <see cref="Scopes"/></param>
 public PdbStateMachineHoistedLocalScopesCustomDebugInfo(int capacity)
 {
     scopes = ThreadSafeListCreator.Create <StateMachineHoistedLocalScope>(capacity);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="stepInfosCapacity">Default capacity for <see cref="StepInfos"/></param>
 public PdbAsyncMethodCustomDebugInfo(int stepInfosCapacity)
 {
     asyncStepInfos = ThreadSafeListCreator.Create <PdbAsyncStepInfo>(stepInfosCapacity);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Constructor
 /// </summary>
 public PdbUsingGroupsCustomDebugInfo()
 {
     usingCounts = ThreadSafeListCreator.Create <ushort>();
 }
Exemplo n.º 12
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public VTableFixups()
 {
     this.vtables = ThreadSafeListCreator.Create <VTable>();
 }
Exemplo n.º 13
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="rva">RVA of this vtable</param>
 /// <param name="flags">Flgas</param>
 /// <param name="methods">Vtable methods</param>
 public VTable(RVA rva, VTableFlags flags, IEnumerable <IMethod> methods)
 {
     this.rva     = rva;
     this.flags   = flags;
     this.methods = ThreadSafeListCreator.Create <IMethod>(methods);
 }
Exemplo n.º 14
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="rva">RVA of this vtable</param>
 /// <param name="flags">Flgas</param>
 /// <param name="numSlots">Number of methods in vtable</param>
 public VTable(RVA rva, VTableFlags flags, int numSlots)
 {
     this.rva     = rva;
     this.flags   = flags;
     this.methods = ThreadSafeListCreator.Create <IMethod>(numSlots);
 }
Exemplo n.º 15
0
		void InitializePropertyMethods_NoLock() {
			if (otherMethods != null)
				return;
#if THREAD_SAFE
			theLock.EnterWriteLock(); try {
			if (otherMethods != null) return;
#endif
			ThreadSafe.IList<MethodDef> newOtherMethods;
			var dt = DeclaringType2_NoLock as TypeDefMD;
			if (dt == null)
				newOtherMethods = ThreadSafeListCreator.Create<MethodDef>();
			else
				dt.InitializeProperty(this, out getMethod, out setMethod, out newOtherMethods);
			otherMethods = newOtherMethods;
#if THREAD_SAFE
			} finally { theLock.ExitWriteLock(); }
#endif
		}
Exemplo n.º 16
0
 /// <summary>
 /// Constructor
 /// </summary>
 public PdbDynamicLocalsCustomDebugInfo()
 {
     locals = ThreadSafeListCreator.Create <PdbDynamicLocal>();
 }
Exemplo n.º 17
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="initLocals">Init locals flag</param>
		/// <param name="instructions">All instructions. This instance will own the list.</param>
		/// <param name="exceptionHandlers">All exception handlers. This instance will own the list.</param>
		/// <param name="locals">All locals. This instance will own the locals in the list.</param>
		public CilBody(bool initLocals, IList<Instruction> instructions, IList<ExceptionHandler> exceptionHandlers, IList<Local> locals) {
			this.initLocals = initLocals;
			this.instructions = ThreadSafeListCreator.MakeThreadSafe(instructions);
			this.exceptionHandlers = ThreadSafeListCreator.MakeThreadSafe(exceptionHandlers);
			this.localList = new LocalList(locals);
		}
Exemplo n.º 18
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="capacity">Initial capacity of <see cref="Locals"/></param>
 public PdbDynamicLocalsCustomDebugInfo(int capacity)
 {
     locals = ThreadSafeListCreator.Create <PdbDynamicLocal>(capacity);
 }
Exemplo n.º 19
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="peImage">The PE image</param>
 /// <param name="cor20Header">The .NET header</param>
 /// <param name="mdHeader">The MD header</param>
 protected MetaData(IPEImage peImage, ImageCor20Header cor20Header, MetaDataHeader mdHeader)
 {
     try {
         this.allStreams = ThreadSafeListCreator.Create<DotNetStream>();
         this.peImage = peImage;
         this.cor20Header = cor20Header;
         this.mdHeader = mdHeader;
     }
     catch {
         if (peImage != null)
             peImage.Dispose();
         throw;
     }
 }
Exemplo n.º 20
0
 /// <summary>
 /// Constructor
 /// </summary>
 public PdbDynamicLocal()
 {
     flags = ThreadSafeListCreator.Create <byte>();
 }
Exemplo n.º 21
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="genericType">The generic type</param>
		/// <param name="genArgCount">Number of generic arguments</param>
		public GenericInstSig(ClassOrValueTypeSig genericType, uint genArgCount) {
			this.genericType = genericType;
			this.genericArgs = ThreadSafeListCreator.Create<TypeSig>((int)genArgCount);
		}
Exemplo n.º 22
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="capacity">Initial capacity of <see cref="Flags"/></param>
 public PdbDynamicLocal(int capacity)
 {
     flags = ThreadSafeListCreator.Create <byte>(capacity);
 }
Exemplo n.º 23
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="arrayType">Array type</param>
		/// <param name="rank">Array rank</param>
		/// <param name="sizes">Sizes list. <c>This instance will be the owner of this list.</c></param>
		/// <param name="lowerBounds">Lower bounds list. <c>This instance will be the owner of this list.</c></param>
		public ArraySig(TypeSig arrayType, uint rank, IEnumerable<uint> sizes, IEnumerable<int> lowerBounds)
			: base(arrayType) {
			this.rank = rank;
			this.sizes = ThreadSafeListCreator.Create<uint>(sizes);
			this.lowerBounds = ThreadSafeListCreator.Create<int>(lowerBounds);
		}
Exemplo n.º 24
0
 /// <summary>
 /// Constructor
 /// </summary>
 public PdbTupleElementNamesCustomDebugInfo()
 {
     names = ThreadSafeListCreator.Create <PdbTupleElementNames>();
 }
Exemplo n.º 25
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="args">Generic args</param>
		public GenericInstMethodSig(IList<TypeSig> args) {
			this.callingConvention = CallingConvention.GenericInst;
			this.genericArgs = ThreadSafeListCreator.Create<TypeSig>(args);
		}
Exemplo n.º 26
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="capacity">Initial capacity of <see cref="Names"/></param>
 public PdbTupleElementNamesCustomDebugInfo(int capacity)
 {
     names = ThreadSafeListCreator.Create <PdbTupleElementNames>(capacity);
 }
Exemplo n.º 27
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="locals">All locals (this instance now owns it)</param>
		/// <param name="dummy">Dummy</param>
		internal LocalSig(IList<TypeSig> locals, bool dummy) {
			this.callingConvention = CallingConvention.LocalSig;
			this.locals = ThreadSafeListCreator.MakeThreadSafe(locals);
		}
Exemplo n.º 28
0
 /// <summary>
 /// Constructor
 /// </summary>
 public PdbTupleElementNames()
 {
     tupleElementNames = ThreadSafeListCreator.Create <string>();
 }
Exemplo n.º 29
0
        internal void InitializeProperty(CorPropertyDef prop, out ThreadSafe.IList <MethodDef> getMethods, out ThreadSafe.IList <MethodDef> setMethods, out ThreadSafe.IList <MethodDef> otherMethods)
        {
            getMethods   = ThreadSafeListCreator.Create <MethodDef>();
            setMethods   = ThreadSafeListCreator.Create <MethodDef>();
            otherMethods = ThreadSafeListCreator.Create <MethodDef>();
            if (prop == null)
            {
                return;
            }

            var  mdi   = readerModule.MetaDataImport;
            uint token = prop.OriginalToken.Raw;

            uint getToken, setToken;

            MDAPI.GetPropertyGetterSetter(mdi, token, out getToken, out setToken);
            var otherTokens = MDAPI.GetPropertyOtherMethodTokens(mdi, token);

            var dict = CreateMethodDict();

            Add(dict, getMethods, getToken);
            Add(dict, setMethods, setToken);
            foreach (uint otherToken in otherTokens)
            {
                Add(dict, otherMethods, otherToken);
            }
        }
Exemplo n.º 30
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="capacity">Initial capacity of <see cref="TupleElementNames"/></param>
 public PdbTupleElementNames(int capacity)
 {
     tupleElementNames = ThreadSafeListCreator.Create <string>(capacity);
 }
Exemplo n.º 31
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="action">The security action</param>
 /// <param name="securityAttrs">The security attributes (now owned by this)</param>
 public DeclSecurityUser(SecurityAction action, IList<SecurityAttribute> securityAttrs)
 {
     this.action = action;
     this.securityAttrs = ThreadSafeListCreator.MakeThreadSafe(securityAttrs);
 }
Exemplo n.º 32
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="capacity">Initial capacity of <see cref="Names"/></param>
 public PortablePdbTupleElementNamesCustomDebugInfo(int capacity)
 {
     names = ThreadSafeListCreator.Create <string>(capacity);
 }
Exemplo n.º 33
0
		/// <summary>
		/// Default constructor
		/// </summary>
		public CilBody() {
			this.initLocals = true;
			this.instructions = ThreadSafeListCreator.Create<Instruction>();
			this.exceptionHandlers = ThreadSafeListCreator.Create<ExceptionHandler>();
			this.localList = new LocalList();
		}
Exemplo n.º 34
0
 /// <summary>
 /// Constructor
 /// </summary>
 public PdbAsyncMethodSteppingInformationCustomDebugInfo()
 {
     asyncStepInfos = ThreadSafeListCreator.Create <PdbAsyncStepInfo>();
 }
Exemplo n.º 35
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ctor">Custom attribute constructor</param>
 /// <param name="arguments">Constructor arguments or <c>null</c> if none</param>
 /// <param name="namedArguments">Named arguments or <c>null</c> if none</param>
 /// <param name="blobReader">A reader that returns the original custom attribute blob data</param>
 public CustomAttribute(ICustomAttributeType ctor, IEnumerable<CAArgument> arguments, IEnumerable<CANamedArgument> namedArguments, IBinaryReader blobReader)
 {
     this.ctor = ctor;
     this.arguments = arguments == null ? ThreadSafeListCreator.Create<CAArgument>() : ThreadSafeListCreator.Create<CAArgument>(arguments);
     this.namedArguments = namedArguments == null ? ThreadSafeListCreator.Create<CANamedArgument>() : ThreadSafeListCreator.Create<CANamedArgument>(namedArguments);
     this.blobReader = blobReader;
 }
Exemplo n.º 36
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="local1">Local type #1</param>
 /// <param name="local2">Local type #2</param>
 /// <param name="local3">Local type #3</param>
 public LocalSig(TypeSig local1, TypeSig local2, TypeSig local3)
 {
     this.callingConvention = CallingConvention.LocalSig;
     this.locals            = ThreadSafeListCreator.Create <TypeSig>(local1, local2, local3);
 }
Exemplo n.º 37
0
 /// <summary>
 /// Dispose method
 /// </summary>
 /// <param name="disposing"><c>true</c> if called by <see cref="Dispose()"/></param>
 protected virtual void Dispose(bool disposing)
 {
     if (!disposing)
         return;
     Dispose(peImage);
     Dispose(stringsStream);
     Dispose(usStream);
     Dispose(blobStream);
     Dispose(guidStream);
     Dispose(tablesStream);
     var as2 = allStreams;
     if (as2 != null) {
         foreach (var stream in as2.GetSafeEnumerable())
             Dispose(stream);
     }
     peImage = null;
     cor20Header = null;
     mdHeader = null;
     stringsStream = null;
     usStream = null;
     blobStream = null;
     guidStream = null;
     tablesStream = null;
     allStreams = null;
     fieldRidToTypeDefRid = null;
     methodRidToTypeDefRid = null;
     typeDefRidToNestedClasses = null;
 }
Exemplo n.º 38
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="locals">All locals</param>
 public LocalSig(params TypeSig[] locals)
 {
     this.callingConvention = CallingConvention.LocalSig;
     this.locals            = ThreadSafeListCreator.Create <TypeSig>(locals);
 }
Exemplo n.º 39
0
 /// <summary>
 /// Initializes <see cref="otherMethods"/>, <see cref="addMethod"/>,
 /// <see cref="invokeMethod"/> and <see cref="removeMethod"/>.
 /// </summary>
 protected virtual void InitializeEventMethods_NoLock()
 {
     otherMethods = ThreadSafeListCreator.Create<MethodDef>();
 }
Exemplo n.º 40
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="locals">All locals (this instance now owns it)</param>
 /// <param name="dummy">Dummy</param>
 internal LocalSig(IList <TypeSig> locals, bool dummy)
 {
     this.callingConvention = CallingConvention.LocalSig;
     this.locals            = ThreadSafeListCreator.MakeThreadSafe(locals);
 }
Exemplo n.º 41
0
		/// <summary>
		/// Default constructor
		/// </summary>
		public GenericInstSig() {
			this.genericArgs = ThreadSafeListCreator.Create<TypeSig>();
		}
Exemplo n.º 42
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="callingConvention">Calling convention (must have GenericInst set)</param>
 /// <param name="size">Number of generic args</param>
 internal GenericInstMethodSig(CallingConvention callingConvention, uint size)
 {
     this.callingConvention = callingConvention;
     this.genericArgs       = ThreadSafeListCreator.Create <TypeSig>((int)size);
 }
Exemplo n.º 43
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="genericType">The generic type</param>
		/// <param name="genArg1">Generic argument #1</param>
		/// <param name="genArg2">Generic argument #2</param>
		/// <param name="genArg3">Generic argument #3</param>
		public GenericInstSig(ClassOrValueTypeSig genericType, TypeSig genArg1, TypeSig genArg2, TypeSig genArg3) {
			this.genericType = genericType;
			this.genericArgs = ThreadSafeListCreator.Create<TypeSig>(genArg1, genArg2, genArg3);
		}
Exemplo n.º 44
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="arg1">Generic arg #1</param>
 /// <param name="arg2">Generic arg #2</param>
 /// <param name="arg3">Generic arg #3</param>
 public GenericInstMethodSig(TypeSig arg1, TypeSig arg2, TypeSig arg3)
 {
     this.callingConvention = CallingConvention.GenericInst;
     this.genericArgs       = ThreadSafeListCreator.Create <TypeSig>(arg1, arg2, arg3);
 }
Exemplo n.º 45
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="arrayType">Array type</param>
		/// <param name="rank">Array rank</param>
		public ArraySig(TypeSig arrayType, uint rank)
			: base(arrayType) {
			this.rank = rank;
			this.sizes = ThreadSafeListCreator.Create<uint>();
			this.lowerBounds = ThreadSafeListCreator.Create<int>();
		}
Exemplo n.º 46
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="args">Generic args</param>
 public GenericInstMethodSig(IList <TypeSig> args)
 {
     this.callingConvention = CallingConvention.GenericInst;
     this.genericArgs       = ThreadSafeListCreator.Create <TypeSig>(args);
 }
Exemplo n.º 47
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="arrayType">Array type</param>
		/// <param name="rank">Array rank</param>
		/// <param name="sizes">Sizes list. <c>This instance will be the owner of this list.</c></param>
		/// <param name="lowerBounds">Lower bounds list. <c>This instance will be the owner of this list.</c></param>
		internal ArraySig(TypeSig arrayType, uint rank, IList<uint> sizes, IList<int> lowerBounds)
			: base(arrayType) {
			this.rank = rank;
			this.sizes = ThreadSafeListCreator.MakeThreadSafe(sizes);
			this.lowerBounds = ThreadSafeListCreator.MakeThreadSafe(lowerBounds);
		}
Exemplo n.º 48
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public LocalSig()
 {
     this.callingConvention = CallingConvention.LocalSig;
     this.locals            = ThreadSafeListCreator.Create <TypeSig>();
 }
Exemplo n.º 49
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="arg1">Generic arg #1</param>
		/// <param name="arg2">Generic arg #2</param>
		/// <param name="arg3">Generic arg #3</param>
		public GenericInstMethodSig(TypeSig arg1, TypeSig arg2, TypeSig arg3) {
			this.callingConvention = CallingConvention.GenericInst;
			this.genericArgs = ThreadSafeListCreator.Create<TypeSig>(arg1, arg2, arg3);
		}
Exemplo n.º 50
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="callingConvention">Calling convention (must have LocalSig set)</param>
 /// <param name="count">Number of locals</param>
 internal LocalSig(CallingConvention callingConvention, uint count)
 {
     this.callingConvention = callingConvention;
     this.locals            = ThreadSafeListCreator.Create <TypeSig>((int)count);
 }
Exemplo n.º 51
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="callingConvention">Calling convention (must have LocalSig set)</param>
		/// <param name="count">Number of locals</param>
		internal LocalSig(CallingConvention callingConvention, uint count) {
			this.callingConvention = callingConvention;
			this.locals = ThreadSafeListCreator.Create<TypeSig>((int)count);
		}
Exemplo n.º 52
0
 /// <summary>Reset <see cref="GetMethods"/>, <see cref="SetMethods"/>, <see cref="OtherMethods"/></summary>
 protected void ResetMethods()
 {
     otherMethods = null;
 }
Exemplo n.º 53
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="locals">All locals</param>
		public LocalSig(IList<TypeSig> locals) {
			this.callingConvention = CallingConvention.LocalSig;
			this.locals = ThreadSafeListCreator.Create<TypeSig>(locals);
		}
Exemplo n.º 54
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="attrType">Attribute type</param>
 /// <param name="namedArguments">Named arguments that will be owned by this instance</param>
 public SecurityAttribute(ITypeDefOrRef attrType, IList <CANamedArgument> namedArguments)
 {
     this.attrType       = attrType;
     this.namedArguments = ThreadSafeListCreator.MakeThreadSafe(namedArguments ?? new List <CANamedArgument>());
 }
Exemplo n.º 55
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="attrType">Attribute type</param>
		/// <param name="namedArguments">Named arguments that will be owned by this instance</param>
		public SecurityAttribute(ITypeDefOrRef attrType, IList<CANamedArgument> namedArguments) {
			this.attrType = attrType;
			this.namedArguments = ThreadSafeListCreator.MakeThreadSafe(namedArguments ?? new List<CANamedArgument>());
		}
Exemplo n.º 56
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public VTable()
 {
     this.methods = ThreadSafeListCreator.Create <IMethod>();
 }