Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2017-08-29 20:47:37 +0300
committerMarek Safar <marek.safar@gmail.com>2017-08-29 20:51:08 +0300
commit5b612c5dc5f2fad700c965ea8c52eb067baf0c02 (patch)
tree0c83801b413e560d9b31971391819be2e811c568 /mcs/class/PEAPI
parent50490aaa7f5e987e02a82f0b4c0bcf8f2ebc60d0 (diff)
[PEAPI] Don't add mscorlib reference when no type needs it
Diffstat (limited to 'mcs/class/PEAPI')
-rw-r--r--mcs/class/PEAPI/Metadata.cs31
1 files changed, 23 insertions, 8 deletions
diff --git a/mcs/class/PEAPI/Metadata.cs b/mcs/class/PEAPI/Metadata.cs
index 8132ecab518..eca297380bc 100644
--- a/mcs/class/PEAPI/Metadata.cs
+++ b/mcs/class/PEAPI/Metadata.cs
@@ -1641,6 +1641,7 @@ namespace PEAPI {
public class ClassDef : Class {
Class superType;
+ bool setSuperType;
ArrayList fields = new ArrayList();
ArrayList methods = new ArrayList();
ArrayList events;
@@ -1656,9 +1657,6 @@ namespace PEAPI {
MetaData md) : base(nsName, name, md)
{
metaData = md;
- if (! ((nsName == "" && name == "<Module>") || (nsName == "System" && name == "Object")) ) {
- superType = metaData.mscorlib.GetSpecialSystemClass(PrimitiveType.Object);
- }
flags = (uint)attrSet;
tabIx = MDTable.TypeDef;
}
@@ -1666,6 +1664,7 @@ namespace PEAPI {
internal void SetSuper(Class sClass)
{
superType = sClass;
+ setSuperType = true;
if (! (sClass is GenericTypeInst))
typeIndexChecked = false;
}
@@ -1677,12 +1676,13 @@ namespace PEAPI {
else
superType = metaData.mscorlib.ValueType();
+ setSuperType = true;
typeIndex = PrimitiveType.ValueType.GetTypeIndex ();
}
public void SpecialNoSuper()
{
- superType = null;
+ setSuperType = true;
}
/// <summary>
@@ -1924,8 +1924,13 @@ namespace PEAPI {
internal sealed override void BuildTables(MetaData md)
{
- if (done) return;
- if ((flags & (uint)TypeAttr.Interface) != 0) { superType = null; }
+ if (done)
+ return;
+
+ if ((flags & (uint)TypeAttr.Interface) != 0) {
+ superType = null;
+ setSuperType = true;
+ }
// Console.WriteLine("Building tables for " + name);
if (layout != null) md.AddToTable(MDTable.ClassLayout,layout);
// Console.WriteLine("adding methods " + methods.Count);
@@ -1958,6 +1963,10 @@ namespace PEAPI {
((Property)properties[0]).Row,MDTable.Property));
}
// Console.WriteLine("End of building tables");
+
+ if (!setSuperType)
+ superType = metaData.mscorlib.GetSpecialSystemClass(PrimitiveType.Object);
+
done = true;
}
@@ -5052,7 +5061,7 @@ namespace PEAPI {
private byte heapSizes = 0;
MetaDataElement entryPoint;
BinaryWriter output;
- public MSCorLib mscorlib;
+ MSCorLib _mscorlib;
private TypeSpec[] systemTypeSpecs = new TypeSpec[PrimitiveType.NumSystemTypes];
long mdStart;
private ArrayList cattr_list;
@@ -5077,9 +5086,15 @@ namespace PEAPI {
for (int i=0; i < lgeCIx.Length; i++) {
lgeCIx[i] = false;
}
- mscorlib = new MSCorLib(this);
}
+ public MSCorLib mscorlib {
+ get {
+ return _mscorlib ?? (_mscorlib = new MSCorLib (this));
+ }
+ }
+
+
internal TypeSpec GetPrimitiveTypeSpec(int ix)
{
return systemTypeSpecs[ix];