X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FPEAPI%2FMetadata.cs;h=1e08ff38590bddf4950a8e3c9b03d0d8f2586051;hb=97bfbacd0c45821d525bab25dd2a8d17bf6e5a79;hp=1fc9144fd47c0aff4e7a99c9fd68adee84192e48;hpb=a8b22e0e864c03b8cfd2f2cb5a8075b6611c5553;p=mono.git diff --git a/mcs/class/PEAPI/Metadata.cs b/mcs/class/PEAPI/Metadata.cs index 1fc9144fd47..1e08ff38590 100644 --- a/mcs/class/PEAPI/Metadata.cs +++ b/mcs/class/PEAPI/Metadata.cs @@ -55,6 +55,7 @@ namespace PEAPI { PublicSealed = 0x101, SpecialName = 0x400, RTSpecialName = 0x800, Import = 0x1000, Serializable = 0x2000, UnicodeClass = 0x10000, AutoClass = 0x20000, HasSecurity = 0x40000, BeforeFieldInit = 0x100000, + Forwarder = 0x200000, VisibilityMask = 0x07 } /// @@ -72,7 +73,7 @@ namespace PEAPI { Family, FamOrAssem, Public, Static = 0x0010, PublicStatic = 0x16, Final = 0x0020, PublicStaticFinal = 0x36, Virtual = 0x0040, PrivateVirtual, PublicVirtual = 0x0046, HideBySig = 0x0080, - NewSlot = 0x0100, Abstract = 0x0400, SpecialName = 0x0800, + NewSlot = 0x0100, Strict = 0x200, Abstract = 0x0400, SpecialName = 0x0800, RTSpecialName = 0x1000, SpecialRTSpecialName = 0x1800, HasSecurity = 0x4000, RequireSecObject = 0x8000} @@ -428,7 +429,6 @@ namespace PEAPI { public class CustomAttribute : MetaDataElement { - private static readonly ushort prolog = 0x0001; MetaDataElement parent; Method type; uint valIx; @@ -672,7 +672,6 @@ namespace PEAPI { { PEAPI.SecurityAction sec_action; ArrayList permissions; - PEAPI.PermissionSet ps; public PermissionSet (PEAPI.SecurityAction sec_action) { @@ -1580,8 +1579,6 @@ namespace PEAPI { /// public class ClassDef : Class { - private static readonly byte ElementType_Class = 0x12; - Class superType; ArrayList fields = new ArrayList(); ArrayList methods = new ArrayList(); @@ -1589,7 +1586,6 @@ namespace PEAPI { ArrayList properties; bool typeIndexChecked = true; uint fieldIx = 0, methodIx = 0; - byte[] securityActions; uint flags; ClassLayout layout; ClassDef parentClass; @@ -1959,7 +1955,6 @@ namespace PEAPI { public class ClassRef : Class, IExternRef, IResolutionScope { protected IResolutionScope parent; - ExternClass externClass; protected MetaData metaData; internal ClassRef(string nsName, string name, MetaData md) : base(nsName, name, md) @@ -2096,9 +2091,9 @@ namespace PEAPI { ExternClass externClass; internal ExternClassRef(TypeAttr attrs, string nsName, string name, - FileRef declFile, MetaData md) : base(nsName,name,md) + MetaDataElement declRef, MetaData md) : base(nsName,name,md) { - externClass = new ExternClass(attrs,nameSpaceIx,nameIx,declFile); + externClass = new ExternClass(attrs,nameSpaceIx,nameIx,declRef); metaData.AddToTable(MDTable.ExportedType,externClass); } @@ -3825,7 +3820,6 @@ namespace PEAPI { MetaData metaData; CILInstructions code; - ArrayList securityActions = new ArrayList(); Param[] parList; Local[] locals; bool initLocals; @@ -4332,7 +4326,6 @@ namespace PEAPI { public class FixedArray : NativeType { - NativeType elemType; uint numElem; //public FixedArray(NativeType elemType, int numElems) : base(0x1E) { @@ -4723,7 +4716,7 @@ namespace PEAPI { private readonly string systemName = "System"; private Class[] systemClasses = new Class[valueTypeIx+2]; private PrimitiveType[] systemTypes = new PrimitiveType[valueTypeIx]; - private TypeSpec[] specialTypeSpecs = new TypeSpec[valueTypeIx]; + private static int[] specialNames = { PrimitiveType.Void.GetName().GetHashCode(), PrimitiveType.Boolean.GetName().GetHashCode(), @@ -4934,11 +4927,7 @@ namespace PEAPI { private static readonly uint max3BitSmlIx = 0x1FFF; private static readonly uint max5BitSmlIx = 0x7FF; // NOTE: version and stream name strings MUST always be quad padded -#if NET_2_0 || BOOTSTRAP_NET_2_0 - private static readonly string version = "v2.0.50727\0\0"; -#else - private static readonly string version = "v1.1.4322\0\0\0"; -#endif + private static readonly string version = "v4.0.30319\0\0"; private static readonly char[] tildeName = {'#','~','\0','\0'}; private static readonly char[] stringsName = {'#','S','t','r','i','n','g','s','\0','\0','\0','\0'}; private static readonly char[] usName = {'#','U','S','\0'}; @@ -4948,7 +4937,6 @@ namespace PEAPI { private static readonly uint TildeHeaderSize = 24; private static readonly uint StreamHeaderSize = 8; private static readonly uint numMetaDataTables = (int)MDTable.GenericParamConstraint + 1; - private static readonly uint tildeHeaderSize = 8 + (uint)tildeName.Length; MetaDataStream strings, us, guid, blob; @@ -5341,26 +5329,23 @@ namespace PEAPI { internal void WriteTildeStream(FileImage output) { - long startTilde = output.Seek(0,SeekOrigin.Current); + output.Seek(0,SeekOrigin.Current); output.Write((uint)0); // Reserved -#if NET_2_0 || BOOTSTRAP_NET_2_0 output.Write((byte)2); // MajorVersion output.Write((byte)0); // MinorVersion -#else - output.Write((byte)1); // MajorVersion - output.Write((byte)0); // MinorVersion -#endif output.Write(heapSizes); output.Write((byte)1); // Reserved output.Write(valid); output.Write(sorted); + for (int i=0; i < numMetaDataTables; i++) { if (metaDataTables[i] != null) { uint count = (uint)metaDataTables[i].Count; output.Write(count); } } - long tabStart = output.Seek(0,SeekOrigin.Current); + + output.Seek(0,SeekOrigin.Current); // Console.WriteLine("Starting metaData tables at " + tabStart); for (int i=0; i < numMetaDataTables; i++) { if (metaDataTables[i] != null) { @@ -5398,11 +5383,9 @@ namespace PEAPI { BuildTable(metaDataTables[(int)MDTable.TypeDef]); BuildTable(metaDataTables[(int)MDTable.TypeSpec]); BuildTable(metaDataTables[(int)MDTable.MemberRef]); -#if NET_2_0 || BOOTSTRAP_NET_2_0 BuildTable(metaDataTables[(int)MDTable.GenericParam]); BuildTable(metaDataTables[(int)MDTable.MethodSpec]); BuildTable(metaDataTables[(int)MDTable.GenericParamConstraint]); -#endif BuildTable(metaDataTables[(int)MDTable.ManifestResource]); if (cattr_list != null) { @@ -5447,7 +5430,6 @@ namespace PEAPI { SortTable(metaDataTables[(int)MDTable.DeclSecurity]); SortTable(metaDataTables[(int)MDTable.MethodSemantics]); SortTable(metaDataTables[(int)MDTable.ImplMap]); -#if NET_2_0 || BOOTSTRAP_NET_2_0 if (metaDataTables[(int)MDTable.GenericParam] != null) { SortTable(metaDataTables[(int)MDTable.GenericParam]); // Now add GenericParamConstraints @@ -5456,7 +5438,6 @@ namespace PEAPI { }*/ } SortTable(metaDataTables[(int)MDTable.GenericParamConstraint]); -#endif SortTable(metaDataTables[(int)MDTable.InterfaceImpl]); SortTable(metaDataTables[(int)MDTable.CustomAttribute]);