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

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>2017-12-08 11:47:28 +0300
committerGitHub <noreply@github.com>2017-12-08 11:47:28 +0300
commitbcd832e5dce4ae297e8fe445ee749883098f02a1 (patch)
tree6555bfb588cac852c14dbba2441598601cf7dd42 /src/ILCompiler.TypeSystem
parent7ee9fb354edee4fb0846e2a3d5e64e7ec02c7f71 (diff)
Overhaul ToString in the type system (#5065)
This is fixing several problems with how we did `ToString`: * The existing scheme required every `TypeDesc`/`MethodDesc`/`FieldDesc` descendant to override `ToString`. Of course we were not consistent with this and as a result, most of our synthetic type system entities had non-existent representation in the debugger. Overriding is a lot of boilerplate. * We were not flexible with the stringified names. E.g. instantiated types became too long because we were module- and namespace- qualifying everything. * (Minor) The runtime type loader was shipping with ToString support in retail configuration that was largely unused. With the new scheme, besides fixing the problems above, I'm adding a bunch of conveniences: * `MethodDesc` now also have signatures in their `ToString`. * Well-known primitive types have short aliases * System.Private prefix is shortened to S.P. I tested that the `TYPE_LOADER_TRACE` still works after this. The runtime type loader overrides the `ToString` in all the places that matter.
Diffstat (limited to 'src/ILCompiler.TypeSystem')
-rw-r--r--src/ILCompiler.TypeSystem/src/ILCompiler.TypeSystem.csproj12
-rw-r--r--src/ILCompiler.TypeSystem/tests/SyntheticVirtualOverrideTests.cs5
2 files changed, 12 insertions, 5 deletions
diff --git a/src/ILCompiler.TypeSystem/src/ILCompiler.TypeSystem.csproj b/src/ILCompiler.TypeSystem/src/ILCompiler.TypeSystem.csproj
index 227d6b4be..af067a0ad 100644
--- a/src/ILCompiler.TypeSystem/src/ILCompiler.TypeSystem.csproj
+++ b/src/ILCompiler.TypeSystem/src/ILCompiler.TypeSystem.csproj
@@ -121,6 +121,9 @@
<Compile Include="..\..\Common\src\TypeSystem\Common\Utilities\CustomAttributeTypeNameParser.cs">
<Link>Utilities\CustomAttributeTypeNameParser.cs</Link>
</Compile>
+ <Compile Include="..\..\Common\src\TypeSystem\Common\Utilities\DebugNameFormatter.cs">
+ <Link>Utilities\DebugNameFormatter.cs</Link>
+ </Compile>
<Compile Include="..\..\Common\src\TypeSystem\Common\Utilities\GCPointerMap.Algorithm.cs">
<Link>Utilities\GCPointerMap.Algorithm.cs</Link>
</Compile>
@@ -154,6 +157,9 @@
<Compile Include="..\..\Common\src\TypeSystem\Common\FieldDesc.cs">
<Link>TypeSystem\Common\FieldDesc.cs</Link>
</Compile>
+ <Compile Include="..\..\Common\src\TypeSystem\Common\FieldDesc.ToString.cs">
+ <Link>TypeSystem\Common\FieldDesc.ToString.cs</Link>
+ </Compile>
<Compile Include="..\..\Common\src\TypeSystem\Common\FieldDesc.FieldLayout.cs">
<Link>TypeSystem\Common\FieldDesc.FieldLayout.cs</Link>
</Compile>
@@ -250,12 +256,18 @@
<Compile Include="..\..\Common\src\TypeSystem\Common\MethodDesc.cs">
<Link>TypeSystem\Common\MethodDesc.cs</Link>
</Compile>
+ <Compile Include="..\..\Common\src\TypeSystem\Common\MethodDesc.ToString.cs">
+ <Link>TypeSystem\Common\MethodDesc.ToString.cs</Link>
+ </Compile>
<Compile Include="..\..\Common\src\TypeSystem\Common\MetadataVirtualMethodAlgorithm.cs">
<Link>TypeSystem\Common\StandardVirtualMethodAlgorithm.cs</Link>
</Compile>
<Compile Include="..\..\Common\src\TypeSystem\Common\TypeDesc.cs">
<Link>TypeSystem\Common\TypeDesc.cs</Link>
</Compile>
+ <Compile Include="..\..\Common\src\TypeSystem\Common\TypeDesc.ToString.cs">
+ <Link>TypeSystem\Common\TypeDesc.ToString.cs</Link>
+ </Compile>
<Compile Include="..\..\Common\src\TypeSystem\Common\TypeDesc.Interfaces.cs">
<Link>TypeSystem\Common\TypeDesc.Interfaces.cs</Link>
</Compile>
diff --git a/src/ILCompiler.TypeSystem/tests/SyntheticVirtualOverrideTests.cs b/src/ILCompiler.TypeSystem/tests/SyntheticVirtualOverrideTests.cs
index 66c387bf3..0058db8a6 100644
--- a/src/ILCompiler.TypeSystem/tests/SyntheticVirtualOverrideTests.cs
+++ b/src/ILCompiler.TypeSystem/tests/SyntheticVirtualOverrideTests.cs
@@ -226,11 +226,6 @@ namespace TypeSystemTests
{
return false;
}
-
- public override string ToString()
- {
- return "[::Synthetic]" + _owningType.ToString() + "." + _name;
- }
}
}
}