From 257ee88f822954dea9dcd04d135e02c3c68a5941 Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Sat, 23 Oct 2021 21:20:14 +0900 Subject: [PATCH 1/9] Fixed newslot virtual method iteration around System.Object on linux mono environment. --- IL2C.Core/Metadata/MetadataUtilities.cs | 9 +++++---- IL2C/Properties/launchSettings.json | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/IL2C.Core/Metadata/MetadataUtilities.cs b/IL2C.Core/Metadata/MetadataUtilities.cs index a860f102..dbb792cd 100644 --- a/IL2C.Core/Metadata/MetadataUtilities.cs +++ b/IL2C.Core/Metadata/MetadataUtilities.cs @@ -507,7 +507,9 @@ public static IDictionary OrderByOverloadPriority( public static IEnumerable FilterByNewslots( this IEnumerable methods) => - methods.Where(method => method.IsVirtual && method.IsNewSlot); + methods.Where(method => method.IsVirtual && + // In mono environment, the System.Object.Finalizer method isn't marked 'newslot' ... + (method.IsNewSlot || method.DeclaringType.IsObjectType)); public static IEnumerable<(IMethodInformation newslotMethod, IMethodInformation[] reuseslotMethods)> OrderByMostOverrides( this IEnumerable methods) @@ -515,9 +517,8 @@ public static IEnumerable FilterByNewslots( var list = new List>>(); foreach (var method in methods.Where(method => method.IsVirtual)) { - if (method.IsNewSlot || - // In mono environment, the System.Object.Finalizer method is marked 'reuseslot' ... - method.DeclaringType.IsObjectType) + // In mono environment, the System.Object.Finalizer method isn't marked 'newslot' ... + if (method.IsNewSlot || method.DeclaringType.IsObjectType) { list.Add(Tuple.Create(method, new List { method })); } diff --git a/IL2C/Properties/launchSettings.json b/IL2C/Properties/launchSettings.json index da65e29c..979ea055 100644 --- a/IL2C/Properties/launchSettings.json +++ b/IL2C/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "IL2C": { "commandName": "Project", - "commandLineArgs": "-g1 $(ProjectDir)..\\samples\\Calculator\\Generated $(ProjectDir)..\\samples\\Calculator\\Calculator.Core\\bin\\Debug\\netstandard2.0\\Calculator.Core.dll" + "commandLineArgs": "-g1 $(ProjectDir)../samples/Calculator/Generated $(ProjectDir)../samples/Calculator/Calculator.Core/bin/Debug/netstandard2.0/Calculator.Core.dll" } } } \ No newline at end of file From 0d15b15d0e0d6c9896b77140f6fadda222dc481a Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Sat, 23 Oct 2021 21:35:36 +0900 Subject: [PATCH 2/9] Made better way for newslot detection. --- IL2C.Core/Metadata/MetadataUtilities.cs | 7 ++----- IL2C.Core/Metadata/MethodInformation.cs | 3 ++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/IL2C.Core/Metadata/MetadataUtilities.cs b/IL2C.Core/Metadata/MetadataUtilities.cs index dbb792cd..611dea31 100644 --- a/IL2C.Core/Metadata/MetadataUtilities.cs +++ b/IL2C.Core/Metadata/MetadataUtilities.cs @@ -507,9 +507,7 @@ public static IDictionary OrderByOverloadPriority( public static IEnumerable FilterByNewslots( this IEnumerable methods) => - methods.Where(method => method.IsVirtual && - // In mono environment, the System.Object.Finalizer method isn't marked 'newslot' ... - (method.IsNewSlot || method.DeclaringType.IsObjectType)); + methods.Where(method => method.IsVirtual && method.IsNewSlot); public static IEnumerable<(IMethodInformation newslotMethod, IMethodInformation[] reuseslotMethods)> OrderByMostOverrides( this IEnumerable methods) @@ -517,8 +515,7 @@ public static IEnumerable FilterByNewslots( var list = new List>>(); foreach (var method in methods.Where(method => method.IsVirtual)) { - // In mono environment, the System.Object.Finalizer method isn't marked 'newslot' ... - if (method.IsNewSlot || method.DeclaringType.IsObjectType) + if (method.IsNewSlot) { list.Add(Tuple.Create(method, new List { method })); } diff --git a/IL2C.Core/Metadata/MethodInformation.cs b/IL2C.Core/Metadata/MethodInformation.cs index 7f3c90bb..72318e73 100644 --- a/IL2C.Core/Metadata/MethodInformation.cs +++ b/IL2C.Core/Metadata/MethodInformation.cs @@ -184,7 +184,8 @@ private IParameterInformation ToParameterInformation(ParameterReference paramete public bool IsSealed => this.Definition.IsFinal || this.DeclaringType.IsSealed; public bool IsNewSlot => - this.Definition.IsNewSlot; + // In mono environment, the System.Object.Finalizer method isn't marked 'newslot' ... + this.Definition.IsNewSlot || (this.Definition.IsVirtual && this.DeclaringType.IsObjectType); public bool IsReuseSlot => this.Definition.IsReuseSlot; public bool IsExtern => From 787e3fedb2f4d5200f4300dfcb5cc02db0141444 Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Sun, 24 Oct 2021 22:42:07 +0900 Subject: [PATCH 3/9] Fixed aborting on ILVerify detected errors. --- tests/IL2C.Core.Test.Common/ILSupport.Standard.targets | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/IL2C.Core.Test.Common/ILSupport.Standard.targets b/tests/IL2C.Core.Test.Common/ILSupport.Standard.targets index 93586523..b27c3e24 100644 --- a/tests/IL2C.Core.Test.Common/ILSupport.Standard.targets +++ b/tests/IL2C.Core.Test.Common/ILSupport.Standard.targets @@ -180,11 +180,12 @@ @(IntermediateAssembly->'"%(FullPath)"', ' ') @(ReferencePath->'"%(FullPath)"', ' ') + + IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" + Command="dotnet "$(ILVerifyPath)" "$(TargetVerifyAssembly)" --statistics $(ILVerifyIgnoreFlags) -r $(VerifyReferenceAssemblies)" /> From 0e0ca8b6839856f99635f4a26b2fb9624a1fcaff Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Sun, 24 Oct 2021 22:43:54 +0900 Subject: [PATCH 4/9] Disabled IL error detection when abnormal invoking both virtual method and call (not callvirt) using. --- .../IL2C.Core.Test.BasicTypes/IL2C.Core.Test.BasicTypes.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/IL2C.Core.Test.BasicTypes/IL2C.Core.Test.BasicTypes.csproj b/tests/IL2C.Core.Test.BasicTypes/IL2C.Core.Test.BasicTypes.csproj index eb72134c..9bb4b5fb 100644 --- a/tests/IL2C.Core.Test.BasicTypes/IL2C.Core.Test.BasicTypes.csproj +++ b/tests/IL2C.Core.Test.BasicTypes/IL2C.Core.Test.BasicTypes.csproj @@ -25,6 +25,8 @@ full true AnyCPU + + -g ThisMismatch From 7481542d7f10cfbb9fbad1a9de45e8d93d8e61a9 Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Mon, 25 Oct 2021 18:40:42 +0900 Subject: [PATCH 5/9] Replaced from using dotnet-ilverify at build time to using IL.Verification library directly at each executing regressin test. --- IL2C.Interop/IL2C.Interop.csproj | 2 +- IL2C/IL2C.csproj | 2 +- .../IL2C.Core.Test.BasicTypes.csproj | 4 +- .../System_Object/System_Object.il | 48 ++-- .../IL2C.Core.Test.Common.csproj | 2 +- .../ILSupport.Standard.targets | 4 +- .../TestCaseAttribute.cs | 3 + .../IL2C.Core.Test.Fixture.csproj | 3 +- .../{ => Internal}/CMakeDriver.cs | 2 +- .../{ => Internal}/CMakeListsSimpleParser.cs | 2 +- .../Internal/ILVerifier.cs | 159 ++++++++++++ .../Internal/ILVerifierNameFormatter.cs | 230 ++++++++++++++++++ .../StatisticsDocumentGenerators.cs | 2 +- .../NUnitDynamicTestHandlers.cs | 3 +- .../TestCaseInformation.cs | 4 +- tests/IL2C.Core.Test.Fixture/TestFramework.cs | 25 +- tests/IL2C.Core.Test.Fixture/TestUtilities.cs | 3 +- .../IL2C.Core.Test.ILConverters.csproj | 2 +- .../IL2C.Core.Test.RuntimeSystems.csproj | 2 +- 19 files changed, 457 insertions(+), 45 deletions(-) rename tests/IL2C.Core.Test.Fixture/{ => Internal}/CMakeDriver.cs (99%) rename tests/IL2C.Core.Test.Fixture/{ => Internal}/CMakeListsSimpleParser.cs (99%) create mode 100644 tests/IL2C.Core.Test.Fixture/Internal/ILVerifier.cs create mode 100644 tests/IL2C.Core.Test.Fixture/Internal/ILVerifierNameFormatter.cs rename tests/IL2C.Core.Test.Fixture/{ => Internal}/StatisticsDocumentGenerators.cs (99%) diff --git a/IL2C.Interop/IL2C.Interop.csproj b/IL2C.Interop/IL2C.Interop.csproj index 7abb3ad0..6917bd9c 100644 --- a/IL2C.Interop/IL2C.Interop.csproj +++ b/IL2C.Interop/IL2C.Interop.csproj @@ -1,7 +1,7 @@  - net40-client;net45;net462;net48;netstandard1.0;netstandard2.0;netstandard2.1;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1;net5.0 + net20;net35;net40-client;net45;net462;net48;netstandard1.0;netstandard2.0;netstandard2.1;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1;net5.0 Library true true diff --git a/IL2C/IL2C.csproj b/IL2C/IL2C.csproj index 65f59a21..55d51840 100644 --- a/IL2C/IL2C.csproj +++ b/IL2C/IL2C.csproj @@ -1,7 +1,7 @@  - net45;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1;net5.0 + net48;netcoreapp2.1;netcoreapp3.1;net5.0 Exe true true diff --git a/tests/IL2C.Core.Test.BasicTypes/IL2C.Core.Test.BasicTypes.csproj b/tests/IL2C.Core.Test.BasicTypes/IL2C.Core.Test.BasicTypes.csproj index 9bb4b5fb..d6020938 100644 --- a/tests/IL2C.Core.Test.BasicTypes/IL2C.Core.Test.BasicTypes.csproj +++ b/tests/IL2C.Core.Test.BasicTypes/IL2C.Core.Test.BasicTypes.csproj @@ -1,7 +1,7 @@  - net462;netstandard2.0 + net48;netstandard2.0 false Library @@ -25,8 +25,6 @@ full true AnyCPU - - -g ThisMismatch diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.il b/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.il index d82294ca..dc78c1f1 100644 --- a/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.il +++ b/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.il @@ -1,50 +1,50 @@ .class public IL2C.BasicTypes.System_Object { - .method public static bool IsValueType(object v) cil managed - { - .maxstack 2 - ldarg.0 - isinst [netstandard]System.ValueType + .method public static bool IsValueType(object v) cil managed + { + .maxstack 2 + ldarg.0 + isinst [netstandard]System.ValueType brnull.s F1 ldc.i4.1 - ret + ret F1: ldc.i4.0 ret - } + } - .method public static string ToString(object v) cil managed - { - .maxstack 1 + .method public static string ToString(object v) cil managed + { + .maxstack 1 ldarg.0 - call instance string [netstandard]System.Object::ToString() // non virtual call + callvirt instance string [netstandard]System.Object::ToString() // non virtual call ret - } + } - .method public static string GetType(object v) cil managed - { - .maxstack 1 + .method public static string GetType(object v) cil managed + { + .maxstack 1 ldarg.0 call instance class [netstandard]System.Type [netstandard]System.Object::GetType() callvirt instance string [netstandard]System.Type::get_FullName() ret - } + } - .method public static bool RefEquals_Same() cil managed - { - .maxstack 2 + .method public static bool RefEquals_Same() cil managed + { + .maxstack 2 newobj instance void class [netstandard]System.Object::.ctor() dup call bool [netstandard]System.Object::ReferenceEquals(object, object) ret - } + } - .method public static bool RefEquals_NotSame() cil managed - { - .maxstack 2 + .method public static bool RefEquals_NotSame() cil managed + { + .maxstack 2 newobj instance void class [netstandard]System.Object::.ctor() newobj instance void class [netstandard]System.Object::.ctor() call bool [netstandard]System.Object::ReferenceEquals(object, object) ret - } + } } diff --git a/tests/IL2C.Core.Test.Common/IL2C.Core.Test.Common.csproj b/tests/IL2C.Core.Test.Common/IL2C.Core.Test.Common.csproj index 394ca002..6bb3be15 100644 --- a/tests/IL2C.Core.Test.Common/IL2C.Core.Test.Common.csproj +++ b/tests/IL2C.Core.Test.Common/IL2C.Core.Test.Common.csproj @@ -1,7 +1,7 @@  - net462;netstandard2.0 + net48;netstandard2.0 false Library diff --git a/tests/IL2C.Core.Test.Common/ILSupport.Standard.targets b/tests/IL2C.Core.Test.Common/ILSupport.Standard.targets index b27c3e24..9cf5b11d 100644 --- a/tests/IL2C.Core.Test.Common/ILSupport.Standard.targets +++ b/tests/IL2C.Core.Test.Common/ILSupport.Standard.targets @@ -39,7 +39,7 @@ --> - + @@ -72,7 +72,7 @@ Because will cause too long command line arguments coming from a lot of decompiled file paths. --> - + diff --git a/tests/IL2C.Core.Test.Common/TestCaseAttribute.cs b/tests/IL2C.Core.Test.Common/TestCaseAttribute.cs index 3eb723b6..733a0dd3 100644 --- a/tests/IL2C.Core.Test.Common/TestCaseAttribute.cs +++ b/tests/IL2C.Core.Test.Common/TestCaseAttribute.cs @@ -42,6 +42,7 @@ public TestCaseAttribute(object expected, string methodName, params object[] arg this.Assert = TestCaseAsserts.PerfectMatch; this.IncludeBaseTypes = false; this.IncludeTypes = Type.EmptyTypes; + this.IgnoreILErrors = Array.Empty(); } // This overload contains additional methods, those are used from the test method (first methodName is target.) @@ -54,6 +55,7 @@ public TestCaseAttribute(object expected, string[] methodNames, params object[] this.Assert = TestCaseAsserts.PerfectMatch; this.IncludeBaseTypes = false; this.IncludeTypes = Type.EmptyTypes; + this.IgnoreILErrors = Array.Empty(); } public string MethodName { get; } @@ -64,5 +66,6 @@ public TestCaseAttribute(object expected, string[] methodNames, params object[] public TestCaseAsserts Assert { get; set; } public bool IncludeBaseTypes { get; set; } public Type[] IncludeTypes { get; set; } + public string[] IgnoreILErrors { get; set; } } } diff --git a/tests/IL2C.Core.Test.Fixture/IL2C.Core.Test.Fixture.csproj b/tests/IL2C.Core.Test.Fixture/IL2C.Core.Test.Fixture.csproj index f4825745..39094674 100644 --- a/tests/IL2C.Core.Test.Fixture/IL2C.Core.Test.Fixture.csproj +++ b/tests/IL2C.Core.Test.Fixture/IL2C.Core.Test.Fixture.csproj @@ -1,4 +1,4 @@ - + net48;net5.0 @@ -43,6 +43,7 @@ + diff --git a/tests/IL2C.Core.Test.Fixture/CMakeDriver.cs b/tests/IL2C.Core.Test.Fixture/Internal/CMakeDriver.cs similarity index 99% rename from tests/IL2C.Core.Test.Fixture/CMakeDriver.cs rename to tests/IL2C.Core.Test.Fixture/Internal/CMakeDriver.cs index 8a375123..05fb473a 100644 --- a/tests/IL2C.Core.Test.Fixture/CMakeDriver.cs +++ b/tests/IL2C.Core.Test.Fixture/Internal/CMakeDriver.cs @@ -23,7 +23,7 @@ using System.Linq; using System.Threading.Tasks; -namespace IL2C +namespace IL2C.Internal { internal static class CMakeDriver { diff --git a/tests/IL2C.Core.Test.Fixture/CMakeListsSimpleParser.cs b/tests/IL2C.Core.Test.Fixture/Internal/CMakeListsSimpleParser.cs similarity index 99% rename from tests/IL2C.Core.Test.Fixture/CMakeListsSimpleParser.cs rename to tests/IL2C.Core.Test.Fixture/Internal/CMakeListsSimpleParser.cs index 0a02e8bb..2d4aef90 100644 --- a/tests/IL2C.Core.Test.Fixture/CMakeListsSimpleParser.cs +++ b/tests/IL2C.Core.Test.Fixture/Internal/CMakeListsSimpleParser.cs @@ -24,7 +24,7 @@ using System.Text; using System.Threading.Tasks; -namespace IL2C +namespace IL2C.Internal { public static class CMakeListsSimpleParser { diff --git a/tests/IL2C.Core.Test.Fixture/Internal/ILVerifier.cs b/tests/IL2C.Core.Test.Fixture/Internal/ILVerifier.cs new file mode 100644 index 00000000..f9702273 --- /dev/null +++ b/tests/IL2C.Core.Test.Fixture/Internal/ILVerifier.cs @@ -0,0 +1,159 @@ +///////////////////////////////////////////////////////////////////////////////////////////////// +// +// IL2C - A translator for ECMA-335 CIL/MSIL to C language. +// Copyright (c) 2016-2019 Kouji Matsui (@kozy_kekyo, @kekyo2) +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +///////////////////////////////////////////////////////////////////////////////////////////////// + +using ILVerify; +using Internal.IL; +using Internal.TypeSystem; +using Internal.TypeSystem.Ecma; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Reflection.Metadata; +using System.Reflection.PortableExecutable; +using System.Text; + +#pragma warning disable CS0436 + +namespace IL2C.Internal +{ + internal sealed class ILVerifier + { + private sealed class Resolver : IResolver + { + private readonly Assembly assembly; + private readonly string[] assemblyBasePaths; + + public Resolver(Assembly assembly) + { + this.assembly = assembly; + this.assemblyBasePaths = + new[] { this.assembly.Location }. + Concat(AppDomain.CurrentDomain.GetAssemblies(). + Where(a => !a.IsDynamic). + Select(a => a.Location)). + Select(Path.GetDirectoryName). + Distinct(). + ToArray(); + } + + public static PEReader GetReader(string path) + { + var reader = new PEReader( + File.OpenRead(path), + PEStreamOptions.PrefetchEntireImage | PEStreamOptions.PrefetchMetadata | PEStreamOptions.LeaveOpen); + reader.TryOpenAssociatedPortablePdb( + path, + pdbName => File.Exists(pdbName) ? File.OpenRead(pdbName) : null, + out var provider, + out var pdbPath); + return reader; + } + + public PEReader Resolve(string simpleName) + { + var path = assemblyBasePaths.SelectMany(basePath => + Directory.EnumerateFiles(basePath, "*.dll")). + FirstOrDefault(path => Path.GetFileNameWithoutExtension(path) == simpleName); + return (path != null) ? GetReader(path) : null; + } + } + + private static EcmaModule GetModule(Verifier verifier, PEReader reader) => + // DIRTY: Verifier.GetModule() marked internal... why? + (EcmaModule)verifier.GetType().GetMethod("GetModule", BindingFlags.NonPublic | BindingFlags.Instance). + Invoke(verifier, new object[] { reader }); + + private readonly Dictionary> results = new(); + + public ILVerifier() + { + } + + private static string GetTypeFullName(TypeDesc type) => + ILVerifierNameFormatter.Instance.FormatName(type, default); + + private static string GetMethodFullName(MethodDesc method) + { + var stringBuilder = new StringBuilder(); + stringBuilder.Append(GetTypeFullName(method.OwningType)); + stringBuilder.Append('.'); + stringBuilder.Append(method.DiagnosticName); + return stringBuilder.ToString(); + } + + + public (VerificationResult result, string instruction)[] Verify(MethodInfo method) + { + lock (this.results) + { + if (!this.results.TryGetValue( + method.Module.Assembly.FullName, + out var assemblyResults)) + { + var resolver = new Resolver(method.Module.Assembly); + var verifier = new Verifier(resolver, new VerifierOptions() + { + IncludeMetadataTokensInErrorMessages = false, + }); + + var san = (ThisAssembly.AssemblyMetadata.TargetFramework == "net48") ? + "mscorlib" : "netstandard"; + verifier.SetSystemModuleName(method.Module.Assembly. + GetReferencedAssemblies(). + First(an => an.Name == san)); + + var reader = Resolver.GetReader(method.Module.Assembly.Location); + + var temp = verifier.Verify(reader). + GroupBy(r => r.Method). + ToDictionary(g => g.Key, g => g.ToArray()); + + var module = GetModule(verifier, reader); + + assemblyResults = temp. + Select(e => (method: module.GetMethod(e.Key), results: e.Value)). + ToDictionary( + e => GetMethodFullName(e.method), + e => e.results.Select(r => + r.TryGetArgumentValue("Offset", out int offset) ? + (r, $"[0x{offset:x4}]: {(ILOpCode)EcmaMethodIL.Create((EcmaMethod)e.method).GetILBytes()[offset]}") : (r, "(No offset)") + ). + ToArray()); + + this.results.Add( + method.Module.Assembly.FullName, + assemblyResults); + } + + if (assemblyResults.TryGetValue( + $"{method.DeclaringType.FullName}.{method.Name}", + out var results)) + { + return results; + } + else + { + return Array.Empty<(VerificationResult result, string instruction)>(); + } + } + } + } +} diff --git a/tests/IL2C.Core.Test.Fixture/Internal/ILVerifierNameFormatter.cs b/tests/IL2C.Core.Test.Fixture/Internal/ILVerifierNameFormatter.cs new file mode 100644 index 00000000..0b79b260 --- /dev/null +++ b/tests/IL2C.Core.Test.Fixture/Internal/ILVerifierNameFormatter.cs @@ -0,0 +1,230 @@ +///////////////////////////////////////////////////////////////////////////////////////////////// +// +// IL2C - A translator for ECMA-335 CIL/MSIL to C language. +// Copyright (c) 2016-2019 Kouji Matsui (@kozy_kekyo, @kekyo2) +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +///////////////////////////////////////////////////////////////////////////////////////////////// + +using Internal.TypeSystem; +using System; +using System.Text; + +// Based on: +// https://github.com/dotnet/runtime/blob/main/src/coreclr/tools/Common/TypeSystem/Common/Utilities/DebugNameFormatter.cs#L11 + +namespace IL2C.Internal +{ + internal sealed class ILVerifierNameFormatter : + TypeNameFormatter + { + public struct Void + { + public static Void Value => default(Void); + } + + public static readonly ILVerifierNameFormatter Instance = new ILVerifierNameFormatter(); + + public override Void AppendName(StringBuilder sb, ArrayType type, Void _ = default) + { + AppendName(sb, type.ElementType, _); + if (!type.IsSzArray && type.Rank == 1) + { + sb.Append("[*]"); + } + else + { + sb.Append('['); + sb.Append(',', type.Rank - 1); + sb.Append(']'); + } + return Void.Value; + } + + public override Void AppendName(StringBuilder sb, ByRefType type, Void _ = default) + { + AppendName(sb, type.ParameterType, _); + sb.Append('&'); + return Void.Value; + } + + public override Void AppendName(StringBuilder sb, PointerType type, Void _ = default) + { + AppendName(sb, type.ParameterType, _); + sb.Append('*'); + return Void.Value; + } + + public override Void AppendName(StringBuilder sb, FunctionPointerType type, Void _ = default) + { + MethodSignature signature = type.Signature; + sb.Append("(*"); + AppendName(sb, signature.ReturnType, _); + sb.Append(")("); + for (int i = 0; i < signature.Length; i++) + { + if (i > 0) + { + sb.Append(','); + } + AppendName(sb, signature[i], _); + } + sb.Append(')'); + return Void.Value; + } + + public override Void AppendName(StringBuilder sb, GenericParameterDesc type, Void _ = default) + { + sb.Append(type.DiagnosticName); + return Void.Value; + } + + public override Void AppendName(StringBuilder sb, SignatureMethodVariable type, Void _ = default) + { + sb.Append("!!"); + sb.Append(type.Index.ToString()); + return Void.Value; + } + + public override Void AppendName(StringBuilder sb, SignatureTypeVariable type, Void _ = default) + { + sb.Append("!"); + sb.Append(type.Index.ToString()); + return Void.Value; + } + + protected override Void AppendNameForNestedType(StringBuilder sb, DefType nestedType, DefType containingType, Void _ = default) + { + AppendName(sb, containingType, _); + sb.Append('+'); + sb.Append(nestedType.DiagnosticName); + return Void.Value; + } + + protected override Void AppendNameForNamespaceType(StringBuilder sb, DefType type, Void _ = default) + { + int length = sb.Length; + try + { + switch (type.Category) + { + case TypeFlags.Void: + sb.Append("void"); + return Void.Value; + case TypeFlags.Boolean: + sb.Append("bool"); + return Void.Value; + case TypeFlags.Char: + sb.Append("char"); + return Void.Value; + case TypeFlags.SByte: + sb.Append("sbyte"); + return Void.Value; + case TypeFlags.Byte: + sb.Append("byte"); + return Void.Value; + case TypeFlags.Int16: + sb.Append("short"); + return Void.Value; + case TypeFlags.UInt16: + sb.Append("ushort"); + return Void.Value; + case TypeFlags.Int32: + sb.Append("int"); + return Void.Value; + case TypeFlags.UInt32: + sb.Append("uint"); + return Void.Value; + case TypeFlags.Int64: + sb.Append("long"); + return Void.Value; + case TypeFlags.UInt64: + sb.Append("ulong"); + return Void.Value; + case TypeFlags.IntPtr: + sb.Append("System.IntPtr"); + return Void.Value; + case TypeFlags.UIntPtr: + sb.Append("System.UIntPtr"); + return Void.Value; + case TypeFlags.Single: + sb.Append("float"); + return Void.Value; + case TypeFlags.Double: + sb.Append("double"); + return Void.Value; + default: + if (type.IsString) + { + sb.Append("string"); + return Void.Value; + } + if (type.IsObject) + { + sb.Append("object"); + return Void.Value; + } + NamespaceQualify(sb, type, _); + sb.Append(type.DiagnosticName); + break; + } + } + catch + { + sb.Length = length; + NamespaceQualify(sb, type, _); + sb.Append(type.DiagnosticName); + } + return Void.Value; + } + + private void NamespaceQualify(StringBuilder sb, DefType type, Void _ = default) + { + string diagnosticNamespace = type.DiagnosticNamespace; + if (!string.IsNullOrEmpty(diagnosticNamespace)) + { + sb.Append(diagnosticNamespace); + sb.Append('.'); + } + } + + protected override Void AppendNameForInstantiatedType(StringBuilder sb, DefType type, Void _ = default) + { + AppendName(sb, type.GetTypeDefinition(), _); + sb.Append('<'); + for (int i = 0; i < type.Instantiation.Length; i++) + { + if (i != 0) + { + sb.Append(','); + } + AppendName(sb, type.Instantiation[i], _); + } + sb.Append('>'); + return Void.Value; + } + + protected override DefType GetContainingType(DefType possibleInnerType, Void _ = default) + { + try + { + return possibleInnerType.ContainingType; + } + catch + { + return null; + } + } + } +} diff --git a/tests/IL2C.Core.Test.Fixture/StatisticsDocumentGenerators.cs b/tests/IL2C.Core.Test.Fixture/Internal/StatisticsDocumentGenerators.cs similarity index 99% rename from tests/IL2C.Core.Test.Fixture/StatisticsDocumentGenerators.cs rename to tests/IL2C.Core.Test.Fixture/Internal/StatisticsDocumentGenerators.cs index 5a5a77eb..d92cf45a 100644 --- a/tests/IL2C.Core.Test.Fixture/StatisticsDocumentGenerators.cs +++ b/tests/IL2C.Core.Test.Fixture/Internal/StatisticsDocumentGenerators.cs @@ -29,7 +29,7 @@ using IL2C.ILConverters; -namespace IL2C +namespace IL2C.Internal { [TestFixture] public sealed class StatisticsDocumentGenerators diff --git a/tests/IL2C.Core.Test.Fixture/NUnitDynamicTestHandlers.cs b/tests/IL2C.Core.Test.Fixture/NUnitDynamicTestHandlers.cs index b361cdf7..74626f62 100644 --- a/tests/IL2C.Core.Test.Fixture/NUnitDynamicTestHandlers.cs +++ b/tests/IL2C.Core.Test.Fixture/NUnitDynamicTestHandlers.cs @@ -17,13 +17,12 @@ // ///////////////////////////////////////////////////////////////////////////////////////////////// +using IL2C.Internal; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; -using IL2C.Internal; - namespace IL2C { internal sealed class TestMethod diff --git a/tests/IL2C.Core.Test.Fixture/TestCaseInformation.cs b/tests/IL2C.Core.Test.Fixture/TestCaseInformation.cs index 05320633..21e5d369 100644 --- a/tests/IL2C.Core.Test.Fixture/TestCaseInformation.cs +++ b/tests/IL2C.Core.Test.Fixture/TestCaseInformation.cs @@ -35,10 +35,11 @@ public struct TestCaseInformation public readonly object Expected; public readonly object[] Arguments; public readonly TestCaseAsserts Assert; + public readonly string[] IgnoreILErrors; public TestCaseInformation( string categoryName, string id, string name, string uniqueName, string description, object expected, TestCaseAsserts assert, - MethodInfo method, Type[] additionalTypes, MethodBase[] additionalMethods, object[] arguments) + MethodInfo method, Type[] additionalTypes, MethodBase[] additionalMethods, object[] arguments, string[] ignoreILErrors) { this.CategoryName = categoryName; this.Id = id; @@ -51,6 +52,7 @@ public TestCaseInformation( this.Expected = expected; this.Arguments = arguments; this.Assert = assert; + this.IgnoreILErrors = ignoreILErrors; } public override string ToString() diff --git a/tests/IL2C.Core.Test.Fixture/TestFramework.cs b/tests/IL2C.Core.Test.Fixture/TestFramework.cs index 4f060220..91c5154e 100644 --- a/tests/IL2C.Core.Test.Fixture/TestFramework.cs +++ b/tests/IL2C.Core.Test.Fixture/TestFramework.cs @@ -155,6 +155,8 @@ public Constant(string symbolName, ITypeInformation targetType, Type expressionT } } + private static readonly ILVerifier ilVerifier = new ILVerifier(); + public static async Task ExecuteTestAsync(TestCaseInformation caseInfo) { Assert.IsTrue(caseInfo.Method.IsPublic && caseInfo.Method.IsStatic); @@ -393,7 +395,24 @@ await TestUtilities.CopyResourceToStreamAsync( await TestUtilities.WriteTextFileAsync(sourcePath, sourceCode, replaceValues); /////////////////////////////////////////////// - // Step 2: Test and verify result by real IL code at this runtime. + // Step 2: Verify IL code. + + var verifyResults = ilVerifier.Verify(caseInfo.Method). + Where(r => !caseInfo.IgnoreILErrors.Contains(r.result.Code.ToString())). + ToArray(); + if (verifyResults.Length >= 1) + { + foreach (var resultx in verifyResults.Take(verifyResults.Length - 1)) + { + Assert.Warn($"{caseInfo.Method.DeclaringType.FullName}.{caseInfo.Method.Name}: [{resultx.result.Code}/{resultx.result.ExceptionID?.ToString() ?? "None"}]: {string.Format(resultx.result.Message, resultx.result.Args ?? Array.Empty())}: {string.Join(",", resultx.result.ErrorArguments.Select(a => $"{a.Name}={a.Value}"))}: {resultx.instruction}"); + } + + var result = verifyResults[verifyResults.Length - 1]; + Assert.Fail($"{caseInfo.Method.DeclaringType.FullName}.{caseInfo.Method.Name}: [{result.result.Code}/{result.result.ExceptionID?.ToString() ?? "None"}]: {string.Format(result.result.Message, result.result.Args ?? Array.Empty())}: {string.Join(",", result.result.ErrorArguments.Select(a => $"{a.Name}={a.Value}"))}: {result.instruction}"); + } + + /////////////////////////////////////////////// + // Step 3: Test and verify result by real IL code at this runtime. object rawResult; switch (caseInfo.Assert) @@ -412,7 +431,7 @@ await TestUtilities.CopyResourceToStreamAsync( } /////////////////////////////////////////////// - // Step 3: Test compiled C source code and execute. + // Step 4: Test compiled C source code and execute. string sanitized = null; try @@ -437,7 +456,7 @@ await TestUtilities.CopyResourceToStreamAsync( Assert.IsFalse(caseInfo.Assert == TestCaseAsserts.CauseBreak, "Code didn't break."); /////////////////////////////////////////////// - // Step 4: Verify result. + // Step 5: Verify result. Assert.AreEqual("Success", sanitized); } diff --git a/tests/IL2C.Core.Test.Fixture/TestUtilities.cs b/tests/IL2C.Core.Test.Fixture/TestUtilities.cs index e96c09c0..610d1243 100644 --- a/tests/IL2C.Core.Test.Fixture/TestUtilities.cs +++ b/tests/IL2C.Core.Test.Fixture/TestUtilities.cs @@ -113,7 +113,8 @@ public static TestCaseInformation CreateTestCaseInformation( additionalMethods, caseAttribute.Arguments. Zip(method.GetParameters().Select(p => p.ParameterType), (arg, type) => ConvertToArgumentType(arg, type)). - ToArray()); + ToArray(), + caseAttribute.IgnoreILErrors); private static IEnumerable TraverseTypes(Type targetType, bool includeBaseTypes) => includeBaseTypes ? diff --git a/tests/IL2C.Core.Test.ILConverters/IL2C.Core.Test.ILConverters.csproj b/tests/IL2C.Core.Test.ILConverters/IL2C.Core.Test.ILConverters.csproj index b895fdb2..c4782c3d 100644 --- a/tests/IL2C.Core.Test.ILConverters/IL2C.Core.Test.ILConverters.csproj +++ b/tests/IL2C.Core.Test.ILConverters/IL2C.Core.Test.ILConverters.csproj @@ -1,7 +1,7 @@  - net462;netstandard2.0 + net48;netstandard2.0 false Library diff --git a/tests/IL2C.Core.Test.RuntimeSystems/IL2C.Core.Test.RuntimeSystems.csproj b/tests/IL2C.Core.Test.RuntimeSystems/IL2C.Core.Test.RuntimeSystems.csproj index a9bcb938..d6f20a1f 100644 --- a/tests/IL2C.Core.Test.RuntimeSystems/IL2C.Core.Test.RuntimeSystems.csproj +++ b/tests/IL2C.Core.Test.RuntimeSystems/IL2C.Core.Test.RuntimeSystems.csproj @@ -1,7 +1,7 @@  - net462;netstandard2.0 + net48;netstandard2.0 false Library From b301d9693be427523bee2f26fa2914eeed623b6e Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Mon, 25 Oct 2021 22:34:46 +0900 Subject: [PATCH 6/9] Ignored causing validation error when non-virtual call at virtual method. --- .../IL2C.Core.Test.BasicTypes/System_Object/System_Object.cs | 4 ++-- .../IL2C.Core.Test.BasicTypes/System_Object/System_Object.il | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.cs b/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.cs index bac64696..13ec852c 100644 --- a/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.cs +++ b/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.cs @@ -23,8 +23,8 @@ namespace IL2C.BasicTypes { [TestCase(true, "IsValueType", 123)] [TestCase(false, "IsValueType", "ABC")] - [TestCase("System.Int32", "ToString", int.MaxValue)] - [TestCase("System.String", "ToString", "ABC")] + [TestCase("System.Int32", "ToString", int.MaxValue, IgnoreILErrors = new[] { "ThisMismatch" })] + [TestCase("System.String", "ToString", "ABC", IgnoreILErrors = new[] { "ThisMismatch" })] [TestCase("System.Int32", "GetType", int.MaxValue)] [TestCase("System.String", "GetType", "ABC")] [TestCase(true, "RefEquals_Same")] diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.il b/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.il index dc78c1f1..52d56e4b 100644 --- a/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.il +++ b/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.il @@ -17,7 +17,7 @@ { .maxstack 1 ldarg.0 - callvirt instance string [netstandard]System.Object::ToString() // non virtual call + call instance string [netstandard]System.Object::ToString() // non virtual call ret } From 11d39a608e64c4d6d47bccf603fae7424bdd522c Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Mon, 25 Oct 2021 23:16:45 +0900 Subject: [PATCH 7/9] Fixed using strict CLR name instead ILAsm registered name. --- .../System_Boolean/System_Boolean.il | 26 ++++++------ .../System_Byte/System_Byte.il | 26 ++++++------ .../System_Char/System_Char.il | 26 ++++++------ .../System_Double/System_Double.il | 26 ++++++------ .../System_Int16/System_Int16.il | 26 ++++++------ .../System_Int32/System_Int32.il | 26 ++++++------ .../System_Int64/System_Int64.il | 26 ++++++------ .../System_IntPtr/System_IntPtr.il | 26 ++++++------ .../System_Object/System_Object.il | 14 +++---- .../System_SByte/System_SByte.il | 26 ++++++------ .../System_Single/System_Single.il | 26 ++++++------ .../System_String/System_String.il | 34 +++++++-------- .../System_UInt16/System_UInt16.il | 26 ++++++------ .../System_UInt32/System_UInt32.il | 26 ++++++------ .../System_UInt64/System_UInt64.il | 26 ++++++------ .../System_UIntPtr/System_UIntPtr.il | 26 ++++++------ tests/IL2C.Core.Test.ILConverters/Box/Box.il | 38 ++++++++--------- .../Box/Box_Narrowing.il | 10 ++--- .../Box/Box_Widing.il | 12 +++--- .../Call/Call_Newslot.il | 22 +++++----- .../Call/Call_Newslot_Virtual.il | 2 +- .../Call/Call_Overload.il | 2 +- .../Call/Call_Overload_Newslot_Virtual.cs | 3 +- .../Call/Call_Overload_Newslot_Virtual.il | 34 +++++++-------- .../Call/Call_Overload_Virtual.cs | 3 +- .../Call/Call_Overload_Virtual.il | 34 +++++++-------- .../Call/Call_Virtual.cs | 2 +- .../Call/Call_Virtual.il | 22 +++++----- .../Callvirt/Callvirt_Derived1.il | 22 +++++----- .../Callvirt/Callvirt_Derived1_Newslot.il | 22 +++++----- .../Callvirt_Derived1_Newslot_Virtual.il | 2 +- .../Callvirt/Callvirt_Derived2.il | 22 +++++----- .../Callvirt/Callvirt_Derived2_Newslot.il | 32 +++++++------- .../Callvirt_Derived2_Newslot_Virtual.il | 2 +- .../Callvirt/Callvirt_Derived3_Newslot.il | 42 +++++++++---------- .../Callvirt_Derived3_Newslot_Virtual.il | 2 +- .../Isinst/Isinst.il | 42 +++++++++---------- .../Ldarga_s/Ldarga_s.il | 28 ++++++------- .../Ldloca_s/Ldloca_s.il | 30 ++++++------- .../Unbox_any/Unbox_any.il | 2 +- .../GarbageCollection/GarbageCollection.il | 14 +++---- 41 files changed, 430 insertions(+), 428 deletions(-) diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Boolean/System_Boolean.il b/tests/IL2C.Core.Test.BasicTypes/System_Boolean/System_Boolean.il index 144809cc..7b85b14d 100644 --- a/tests/IL2C.Core.Test.BasicTypes/System_Boolean/System_Boolean.il +++ b/tests/IL2C.Core.Test.BasicTypes/System_Boolean/System_Boolean.il @@ -1,23 +1,23 @@ .class public IL2C.BasicTypes.System_Boolean { - .method public static bool IsValueType() cil managed - { - .maxstack 2 - ldc.i4.s 123 - box [netstandard]System.Boolean - isinst [netstandard]System.ValueType + .method public static bool IsValueType() cil managed + { + .maxstack 2 + ldc.i4.s 123 + box bool + isinst [netstandard]System.ValueType brnull.s F1 ldc.i4.1 - ret + ret F1: ldc.i4.0 ret - } + } - .method public static int32 SizeOf() cil managed - { - .maxstack 1 - sizeof [netstandard]System.Boolean + .method public static int32 SizeOf() cil managed + { + .maxstack 1 + sizeof bool ret - } + } } diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Byte/System_Byte.il b/tests/IL2C.Core.Test.BasicTypes/System_Byte/System_Byte.il index b567fe06..9cfc5aba 100644 --- a/tests/IL2C.Core.Test.BasicTypes/System_Byte/System_Byte.il +++ b/tests/IL2C.Core.Test.BasicTypes/System_Byte/System_Byte.il @@ -1,23 +1,23 @@ .class public IL2C.BasicTypes.System_Byte { - .method public static bool IsValueType() cil managed - { - .maxstack 2 - ldc.i4.s 123 - box [netstandard]System.Byte - isinst [netstandard]System.ValueType + .method public static bool IsValueType() cil managed + { + .maxstack 2 + ldc.i4.s 123 + box uint8 + isinst [netstandard]System.ValueType brnull.s F1 ldc.i4.1 - ret + ret F1: ldc.i4.0 ret - } + } - .method public static int32 SizeOf() cil managed - { - .maxstack 1 - sizeof [netstandard]System.Byte + .method public static int32 SizeOf() cil managed + { + .maxstack 1 + sizeof uint8 ret - } + } } diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Char/System_Char.il b/tests/IL2C.Core.Test.BasicTypes/System_Char/System_Char.il index f44014d1..129eb34f 100644 --- a/tests/IL2C.Core.Test.BasicTypes/System_Char/System_Char.il +++ b/tests/IL2C.Core.Test.BasicTypes/System_Char/System_Char.il @@ -1,23 +1,23 @@ .class public IL2C.BasicTypes.System_Char { - .method public static bool IsValueType() cil managed - { - .maxstack 2 - ldc.i4 12345 - box [netstandard]System.Char - isinst [netstandard]System.ValueType + .method public static bool IsValueType() cil managed + { + .maxstack 2 + ldc.i4 12345 + box char + isinst [netstandard]System.ValueType brnull.s F1 ldc.i4.1 - ret + ret F1: ldc.i4.0 ret - } + } - .method public static int32 SizeOf() cil managed - { - .maxstack 1 - sizeof [netstandard]System.Char + .method public static int32 SizeOf() cil managed + { + .maxstack 1 + sizeof char ret - } + } } diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Double/System_Double.il b/tests/IL2C.Core.Test.BasicTypes/System_Double/System_Double.il index 4e5b6a6e..2a4024b8 100644 --- a/tests/IL2C.Core.Test.BasicTypes/System_Double/System_Double.il +++ b/tests/IL2C.Core.Test.BasicTypes/System_Double/System_Double.il @@ -1,23 +1,23 @@ .class public IL2C.BasicTypes.System_Double { - .method public static bool IsValueType() cil managed - { - .maxstack 2 - ldc.r8 1234567.890123 - box [netstandard]System.Double - isinst [netstandard]System.ValueType + .method public static bool IsValueType() cil managed + { + .maxstack 2 + ldc.r8 1234567.890123 + box float64 + isinst [netstandard]System.ValueType brnull.s F1 ldc.i4.1 - ret + ret F1: ldc.i4.0 ret - } + } - .method public static int32 SizeOf() cil managed - { - .maxstack 1 - sizeof [netstandard]System.Double + .method public static int32 SizeOf() cil managed + { + .maxstack 1 + sizeof float64 ret - } + } } diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Int16/System_Int16.il b/tests/IL2C.Core.Test.BasicTypes/System_Int16/System_Int16.il index 21efb7b6..506cea81 100644 --- a/tests/IL2C.Core.Test.BasicTypes/System_Int16/System_Int16.il +++ b/tests/IL2C.Core.Test.BasicTypes/System_Int16/System_Int16.il @@ -1,23 +1,23 @@ .class public IL2C.BasicTypes.System_Int16 { - .method public static bool IsValueType() cil managed - { - .maxstack 2 - ldc.i4 12345 - box [netstandard]System.Int16 - isinst [netstandard]System.ValueType + .method public static bool IsValueType() cil managed + { + .maxstack 2 + ldc.i4 12345 + box int16 + isinst [netstandard]System.ValueType brnull.s F1 ldc.i4.1 - ret + ret F1: ldc.i4.0 ret - } + } - .method public static int32 SizeOf() cil managed - { - .maxstack 1 - sizeof [netstandard]System.Int16 + .method public static int32 SizeOf() cil managed + { + .maxstack 1 + sizeof int16 ret - } + } } diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Int32/System_Int32.il b/tests/IL2C.Core.Test.BasicTypes/System_Int32/System_Int32.il index 5e0983b6..e70e1b64 100644 --- a/tests/IL2C.Core.Test.BasicTypes/System_Int32/System_Int32.il +++ b/tests/IL2C.Core.Test.BasicTypes/System_Int32/System_Int32.il @@ -1,23 +1,23 @@ .class public IL2C.BasicTypes.System_Int32 { - .method public static bool IsValueType() cil managed - { - .maxstack 2 - ldc.i4 1234567 - box [netstandard]System.Int32 - isinst [netstandard]System.ValueType + .method public static bool IsValueType() cil managed + { + .maxstack 2 + ldc.i4 1234567 + box int32 + isinst [netstandard]System.ValueType brnull.s F1 ldc.i4.1 - ret + ret F1: ldc.i4.0 ret - } + } - .method public static int32 SizeOf() cil managed - { - .maxstack 1 - sizeof [netstandard]System.Int32 + .method public static int32 SizeOf() cil managed + { + .maxstack 1 + sizeof int32 ret - } + } } diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Int64/System_Int64.il b/tests/IL2C.Core.Test.BasicTypes/System_Int64/System_Int64.il index 81771895..3f7a4b52 100644 --- a/tests/IL2C.Core.Test.BasicTypes/System_Int64/System_Int64.il +++ b/tests/IL2C.Core.Test.BasicTypes/System_Int64/System_Int64.il @@ -1,23 +1,23 @@ .class public IL2C.BasicTypes.System_Int64 { - .method public static bool IsValueType() cil managed - { - .maxstack 2 - ldc.i8 1234567890123 - box [netstandard]System.Int64 - isinst [netstandard]System.ValueType + .method public static bool IsValueType() cil managed + { + .maxstack 2 + ldc.i8 1234567890123 + box int64 + isinst [netstandard]System.ValueType brnull.s F1 ldc.i4.1 - ret + ret F1: ldc.i4.0 ret - } + } - .method public static int32 SizeOf() cil managed - { - .maxstack 1 - sizeof [netstandard]System.Int64 + .method public static int32 SizeOf() cil managed + { + .maxstack 1 + sizeof int64 ret - } + } } diff --git a/tests/IL2C.Core.Test.BasicTypes/System_IntPtr/System_IntPtr.il b/tests/IL2C.Core.Test.BasicTypes/System_IntPtr/System_IntPtr.il index 2c25ee6e..c48ba3d4 100644 --- a/tests/IL2C.Core.Test.BasicTypes/System_IntPtr/System_IntPtr.il +++ b/tests/IL2C.Core.Test.BasicTypes/System_IntPtr/System_IntPtr.il @@ -1,24 +1,24 @@ .class public IL2C.BasicTypes.System_IntPtr { - .method public static bool IsValueType() cil managed - { - .maxstack 2 - ldc.i4 1234567 + .method public static bool IsValueType() cil managed + { + .maxstack 2 + ldc.i4 1234567 conv.i - box [netstandard]System.IntPtr - isinst [netstandard]System.ValueType + box native int + isinst [netstandard]System.ValueType brnull.s F1 ldc.i4.1 - ret + ret F1: ldc.i4.0 ret - } + } - .method public static int32 SizeOf() cil managed - { - .maxstack 1 - sizeof [netstandard]System.IntPtr + .method public static int32 SizeOf() cil managed + { + .maxstack 1 + sizeof native int ret - } + } } diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.il b/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.il index 52d56e4b..c173a3e6 100644 --- a/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.il +++ b/tests/IL2C.Core.Test.BasicTypes/System_Object/System_Object.il @@ -17,7 +17,7 @@ { .maxstack 1 ldarg.0 - call instance string [netstandard]System.Object::ToString() // non virtual call + call instance string object::ToString() // non virtual call ret } @@ -25,7 +25,7 @@ { .maxstack 1 ldarg.0 - call instance class [netstandard]System.Type [netstandard]System.Object::GetType() + call instance class [netstandard]System.Type object::GetType() callvirt instance string [netstandard]System.Type::get_FullName() ret } @@ -33,18 +33,18 @@ .method public static bool RefEquals_Same() cil managed { .maxstack 2 - newobj instance void class [netstandard]System.Object::.ctor() + newobj instance void object::.ctor() dup - call bool [netstandard]System.Object::ReferenceEquals(object, object) + call bool object::ReferenceEquals(object, object) ret } .method public static bool RefEquals_NotSame() cil managed { .maxstack 2 - newobj instance void class [netstandard]System.Object::.ctor() - newobj instance void class [netstandard]System.Object::.ctor() - call bool [netstandard]System.Object::ReferenceEquals(object, object) + newobj instance void object::.ctor() + newobj instance void object::.ctor() + call bool object::ReferenceEquals(object, object) ret } } diff --git a/tests/IL2C.Core.Test.BasicTypes/System_SByte/System_SByte.il b/tests/IL2C.Core.Test.BasicTypes/System_SByte/System_SByte.il index 13c94195..c6e0d510 100644 --- a/tests/IL2C.Core.Test.BasicTypes/System_SByte/System_SByte.il +++ b/tests/IL2C.Core.Test.BasicTypes/System_SByte/System_SByte.il @@ -1,23 +1,23 @@ .class public IL2C.BasicTypes.System_SByte { - .method public static bool IsValueType() cil managed - { - .maxstack 2 - ldc.i4.s 123 - box [netstandard]System.SByte - isinst [netstandard]System.ValueType + .method public static bool IsValueType() cil managed + { + .maxstack 2 + ldc.i4.s 123 + box int8 + isinst [netstandard]System.ValueType brnull.s F1 ldc.i4.1 - ret + ret F1: ldc.i4.0 ret - } + } - .method public static int32 SizeOf() cil managed - { - .maxstack 1 - sizeof [netstandard]System.SByte + .method public static int32 SizeOf() cil managed + { + .maxstack 1 + sizeof int8 ret - } + } } diff --git a/tests/IL2C.Core.Test.BasicTypes/System_Single/System_Single.il b/tests/IL2C.Core.Test.BasicTypes/System_Single/System_Single.il index c1558fac..f1084224 100644 --- a/tests/IL2C.Core.Test.BasicTypes/System_Single/System_Single.il +++ b/tests/IL2C.Core.Test.BasicTypes/System_Single/System_Single.il @@ -1,23 +1,23 @@ .class public IL2C.BasicTypes.System_Single { - .method public static bool IsValueType() cil managed - { - .maxstack 2 - ldc.r4 12345.67 - box [netstandard]System.Single - isinst [netstandard]System.ValueType + .method public static bool IsValueType() cil managed + { + .maxstack 2 + ldc.r4 12345.67 + box float32 + isinst [netstandard]System.ValueType brnull.s F1 ldc.i4.1 - ret + ret F1: ldc.i4.0 ret - } + } - .method public static int32 SizeOf() cil managed - { - .maxstack 1 - sizeof [netstandard]System.Single + .method public static int32 SizeOf() cil managed + { + .maxstack 1 + sizeof float32 ret - } + } } diff --git a/tests/IL2C.Core.Test.BasicTypes/System_String/System_String.il b/tests/IL2C.Core.Test.BasicTypes/System_String/System_String.il index 42d00405..7a323566 100644 --- a/tests/IL2C.Core.Test.BasicTypes/System_String/System_String.il +++ b/tests/IL2C.Core.Test.BasicTypes/System_String/System_String.il @@ -1,32 +1,32 @@ .class public IL2C.BasicTypes.System_String { - .method public static bool IsValueType() cil managed - { - .maxstack 2 - ldstr "ABC" - isinst [netstandard]System.ValueType + .method public static bool IsValueType() cil managed + { + .maxstack 2 + ldstr "ABC" + isinst [netstandard]System.ValueType brnull.s F1 ldc.i4.1 - ret + ret F1: ldc.i4.0 ret - } + } - .method public static string ToString(string str) cil managed - { - .maxstack 1 + .method public static string ToString(string str) cil managed + { + .maxstack 1 ldarg.0 - call instance string [netstandard]System.String::ToString() + call instance string string::ToString() ret - } + } - .method public static bool Equals1(string value1, string value2) cil managed - { - .maxstack 2 + .method public static bool Equals1(string value1, string value2) cil managed + { + .maxstack 2 ldarg.0 ldarg.1 - call instance bool [netstandard]System.String::Equals(string) + call instance bool string::Equals(string) ret - } + } } diff --git a/tests/IL2C.Core.Test.BasicTypes/System_UInt16/System_UInt16.il b/tests/IL2C.Core.Test.BasicTypes/System_UInt16/System_UInt16.il index b0fa60d7..42cdd775 100644 --- a/tests/IL2C.Core.Test.BasicTypes/System_UInt16/System_UInt16.il +++ b/tests/IL2C.Core.Test.BasicTypes/System_UInt16/System_UInt16.il @@ -1,23 +1,23 @@ .class public IL2C.BasicTypes.System_UInt16 { - .method public static bool IsValueType() cil managed - { - .maxstack 2 - ldc.i4 42345 - box [netstandard]System.UInt16 - isinst [netstandard]System.ValueType + .method public static bool IsValueType() cil managed + { + .maxstack 2 + ldc.i4 42345 + box uint16 + isinst [netstandard]System.ValueType brnull.s F1 ldc.i4.1 - ret + ret F1: ldc.i4.0 ret - } + } - .method public static int32 SizeOf() cil managed - { - .maxstack 1 - sizeof [netstandard]System.UInt16 + .method public static int32 SizeOf() cil managed + { + .maxstack 1 + sizeof uint16 ret - } + } } diff --git a/tests/IL2C.Core.Test.BasicTypes/System_UInt32/System_UInt32.il b/tests/IL2C.Core.Test.BasicTypes/System_UInt32/System_UInt32.il index ca90467c..eb752fec 100644 --- a/tests/IL2C.Core.Test.BasicTypes/System_UInt32/System_UInt32.il +++ b/tests/IL2C.Core.Test.BasicTypes/System_UInt32/System_UInt32.il @@ -1,23 +1,23 @@ .class public IL2C.BasicTypes.System_UInt32 { - .method public static bool IsValueType() cil managed - { - .maxstack 2 - ldc.i4 1234567 - box [netstandard]System.UInt32 - isinst [netstandard]System.ValueType + .method public static bool IsValueType() cil managed + { + .maxstack 2 + ldc.i4 1234567 + box uint32 + isinst [netstandard]System.ValueType brnull.s F1 ldc.i4.1 - ret + ret F1: ldc.i4.0 ret - } + } - .method public static int32 SizeOf() cil managed - { - .maxstack 1 - sizeof [netstandard]System.UInt32 + .method public static int32 SizeOf() cil managed + { + .maxstack 1 + sizeof uint32 ret - } + } } diff --git a/tests/IL2C.Core.Test.BasicTypes/System_UInt64/System_UInt64.il b/tests/IL2C.Core.Test.BasicTypes/System_UInt64/System_UInt64.il index 7621b4c1..50f216f6 100644 --- a/tests/IL2C.Core.Test.BasicTypes/System_UInt64/System_UInt64.il +++ b/tests/IL2C.Core.Test.BasicTypes/System_UInt64/System_UInt64.il @@ -1,23 +1,23 @@ .class public IL2C.BasicTypes.System_UInt64 { - .method public static bool IsValueType() cil managed - { - .maxstack 2 - ldc.i8 1234567890123 - box [netstandard]System.UInt64 - isinst [netstandard]System.ValueType + .method public static bool IsValueType() cil managed + { + .maxstack 2 + ldc.i8 1234567890123 + box uint64 + isinst [netstandard]System.ValueType brnull.s F1 ldc.i4.1 - ret + ret F1: ldc.i4.0 ret - } + } - .method public static int32 SizeOf() cil managed - { - .maxstack 1 - sizeof [netstandard]System.UInt64 + .method public static int32 SizeOf() cil managed + { + .maxstack 1 + sizeof uint64 ret - } + } } diff --git a/tests/IL2C.Core.Test.BasicTypes/System_UIntPtr/System_UIntPtr.il b/tests/IL2C.Core.Test.BasicTypes/System_UIntPtr/System_UIntPtr.il index d0126afa..d3232cd3 100644 --- a/tests/IL2C.Core.Test.BasicTypes/System_UIntPtr/System_UIntPtr.il +++ b/tests/IL2C.Core.Test.BasicTypes/System_UIntPtr/System_UIntPtr.il @@ -1,24 +1,24 @@ .class public IL2C.BasicTypes.System_UIntPtr { - .method public static bool IsValueType() cil managed - { - .maxstack 2 - ldc.i4 1234567 + .method public static bool IsValueType() cil managed + { + .maxstack 2 + ldc.i4 1234567 conv.u - box [netstandard]System.UIntPtr - isinst [netstandard]System.ValueType + box native uint + isinst [netstandard]System.ValueType brnull.s F1 ldc.i4.1 - ret + ret F1: ldc.i4.0 ret - } + } - .method public static int32 SizeOf() cil managed - { - .maxstack 1 - sizeof [netstandard]System.UIntPtr + .method public static int32 SizeOf() cil managed + { + .maxstack 1 + sizeof native uint ret - } + } } diff --git a/tests/IL2C.Core.Test.ILConverters/Box/Box.il b/tests/IL2C.Core.Test.ILConverters/Box/Box.il index c3db9289..1e28460b 100644 --- a/tests/IL2C.Core.Test.ILConverters/Box/Box.il +++ b/tests/IL2C.Core.Test.ILConverters/Box/Box.il @@ -4,7 +4,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Byte + box uint8 ret } @@ -12,7 +12,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Int16 + box int16 ret } @@ -20,7 +20,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Int32 + box int32 ret } @@ -28,7 +28,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Int64 + box int64 ret } @@ -36,7 +36,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.SByte + box int8 ret } @@ -44,7 +44,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.UInt16 + box uint16 ret } @@ -52,7 +52,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.UInt32 + box uint32 ret } @@ -60,7 +60,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.UInt64 + box uint64 ret } @@ -68,7 +68,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.IntPtr + box native int ret } @@ -76,7 +76,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.UIntPtr + box native uint ret } @@ -84,7 +84,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Single + box float32 ret } @@ -92,7 +92,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Double + box float64 ret } @@ -100,7 +100,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Boolean + box bool ret } @@ -108,7 +108,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Char + box char ret } @@ -116,7 +116,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Int32 + box int32 ret } @@ -124,7 +124,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Int32 + box int32 ret } @@ -132,7 +132,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Int32 + box int32 ret } @@ -140,7 +140,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Int32 + box int32 ret } @@ -148,7 +148,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Int64 + box int64 ret } } diff --git a/tests/IL2C.Core.Test.ILConverters/Box/Box_Narrowing.il b/tests/IL2C.Core.Test.ILConverters/Box/Box_Narrowing.il index 7ab686ca..ad5911e3 100644 --- a/tests/IL2C.Core.Test.ILConverters/Box/Box_Narrowing.il +++ b/tests/IL2C.Core.Test.ILConverters/Box/Box_Narrowing.il @@ -4,7 +4,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Byte + box uint8 ret } @@ -12,7 +12,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Int16 + box int16 ret } @@ -20,7 +20,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Boolean + box bool ret } @@ -28,7 +28,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Char + box char ret } @@ -36,7 +36,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.UInt32 + box uint32 ret } } diff --git a/tests/IL2C.Core.Test.ILConverters/Box/Box_Widing.il b/tests/IL2C.Core.Test.ILConverters/Box/Box_Widing.il index 97ce71ce..837768b0 100644 --- a/tests/IL2C.Core.Test.ILConverters/Box/Box_Widing.il +++ b/tests/IL2C.Core.Test.ILConverters/Box/Box_Widing.il @@ -4,7 +4,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Int32 + box int32 ret } @@ -12,7 +12,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Int32 + box int32 ret } @@ -20,7 +20,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Int32 + box int32 ret } @@ -28,7 +28,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Int32 + box int32 ret } @@ -36,7 +36,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Int32 + box int32 ret } @@ -44,7 +44,7 @@ { .maxstack 1 ldarg.0 - box [netstandard]System.Int32 + box int32 ret } } diff --git a/tests/IL2C.Core.Test.ILConverters/Call/Call_Newslot.il b/tests/IL2C.Core.Test.ILConverters/Call/Call_Newslot.il index 9af2cc0d..749db9dd 100644 --- a/tests/IL2C.Core.Test.ILConverters/Call/Call_Newslot.il +++ b/tests/IL2C.Core.Test.ILConverters/Call/Call_Newslot.il @@ -1,18 +1,18 @@ .class public IL2C.ILConverters.Call_Newslot { - .method public static string Instance_Newslot_ToString_System_Object() cil managed - { - .maxstack 1 + .method public static string Instance_Newslot_ToString_System_Object() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Call_Newslot::.ctor() - call instance string [netstandard]System.Object::ToString() - ret - } + call instance string object::ToString() + ret + } - .method public static string Instance_Newslot_ToString_IL2C_ILConverters_Call() cil managed - { - .maxstack 1 + .method public static string Instance_Newslot_ToString_IL2C_ILConverters_Call() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Call_Newslot::.ctor() call instance string IL2C.ILConverters.Call_Newslot::ToString() - ret - } + ret + } } diff --git a/tests/IL2C.Core.Test.ILConverters/Call/Call_Newslot_Virtual.il b/tests/IL2C.Core.Test.ILConverters/Call/Call_Newslot_Virtual.il index 2aba3e20..09822096 100644 --- a/tests/IL2C.Core.Test.ILConverters/Call/Call_Newslot_Virtual.il +++ b/tests/IL2C.Core.Test.ILConverters/Call/Call_Newslot_Virtual.il @@ -4,7 +4,7 @@ { .maxstack 1 newobj instance void class IL2C.ILConverters.Call_Newslot_Virtual::.ctor() - call instance string [netstandard]System.Object::ToString() + call instance string object::ToString() ret } diff --git a/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload.il b/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload.il index 2e3913ea..10e61ab2 100644 --- a/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload.il +++ b/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload.il @@ -4,7 +4,7 @@ { .maxstack 1 newobj instance void class IL2C.ILConverters.Call_Overload::.ctor() - call instance string [netstandard]System.Object::ToString() + call instance string object::ToString() ret } diff --git a/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Newslot_Virtual.cs b/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Newslot_Virtual.cs index e04f6308..8ee75612 100644 --- a/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Newslot_Virtual.cs +++ b/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Newslot_Virtual.cs @@ -23,7 +23,8 @@ namespace IL2C.ILConverters { [TestId("Call")] - [TestCase("IL2C.ILConverters.Call_Overload_Newslot_Virtual", new[] { "Instance_Overload_Newslot_Virtual_ToString_System_Object", "ToString" })] + [TestCase("IL2C.ILConverters.Call_Overload_Newslot_Virtual", new[] { "Instance_Overload_Newslot_Virtual_ToString_System_Object", "ToString" }, IgnoreILErrors = new[] { "ThisMismatch" })] + [TestCase("CallTest", new[] { "Instance_Overload_Newslot_Virtual_ToString_NoArgument_IL2C_ILConverters_Call", "ToString" })] [TestCase("CallTestABC", new[] { "Instance_Overload_Newslot_Virtual_ToString_IL2C_ILConverters_Call", "ToString" }, "ABC")] public class Call_Overload_Newslot_Virtual { diff --git a/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Newslot_Virtual.il b/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Newslot_Virtual.il index de3a375b..1d6de346 100644 --- a/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Newslot_Virtual.il +++ b/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Newslot_Virtual.il @@ -1,27 +1,27 @@ .class public IL2C.ILConverters.Call_Overload_Newslot_Virtual { - .method public static string Instance_Overload_Newslot_Virtual_ToString_System_Object() cil managed - { - .maxstack 1 + .method public static string Instance_Overload_Newslot_Virtual_ToString_System_Object() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Call_Overload_Newslot_Virtual::.ctor() - call instance string [netstandard]System.Object::ToString() - ret - } + call instance string object::ToString() + ret + } - .method public static string Instance_Overload_Newslot_Virtual_ToString_NoArgument_IL2C_ILConverters_Call() cil managed - { - .maxstack 1 + .method public static string Instance_Overload_Newslot_Virtual_ToString_NoArgument_IL2C_ILConverters_Call() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Call_Overload_Newslot_Virtual::.ctor() call instance string IL2C.ILConverters.Call_Overload_Newslot_Virtual::ToString() - ret - } + ret + } - .method public static string Instance_Overload_Newslot_Virtual_ToString_IL2C_ILConverters_Call(string v) cil managed - { - .maxstack 2 + .method public static string Instance_Overload_Newslot_Virtual_ToString_IL2C_ILConverters_Call(string v) cil managed + { + .maxstack 2 newobj instance void class IL2C.ILConverters.Call_Overload_Newslot_Virtual::.ctor() - ldarg.0 + ldarg.0 call instance string IL2C.ILConverters.Call_Overload_Newslot_Virtual::ToString(string v) - ret - } + ret + } } diff --git a/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Virtual.cs b/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Virtual.cs index 427b6a50..fbe60e13 100644 --- a/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Virtual.cs +++ b/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Virtual.cs @@ -23,7 +23,8 @@ namespace IL2C.ILConverters { [TestId("Call")] - [TestCase("IL2C.ILConverters.Call_Overload_Virtual", new[] { "Instance_Overload_Virtual_ToString_System_Object", "ToString" })] + [TestCase("IL2C.ILConverters.Call_Overload_Virtual", new[] { "Instance_Overload_Virtual_ToString_System_Object", "ToString" }, IgnoreILErrors = new[] { "ThisMismatch" })] + [TestCase("CallTest", new[] { "Instance_Overload_Virtual_ToString_NoArgument_IL2C_ILConverters_Call", "ToString" })] [TestCase("CallTestABC", new[] { "Instance_Overload_Virtual_ToString_IL2C_ILConverters_Call", "ToString" }, "ABC")] public class Call_Overload_Virtual { diff --git a/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Virtual.il b/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Virtual.il index db295484..758003d5 100644 --- a/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Virtual.il +++ b/tests/IL2C.Core.Test.ILConverters/Call/Call_Overload_Virtual.il @@ -1,27 +1,27 @@ .class public IL2C.ILConverters.Call_Overload_Virtual { - .method public static string Instance_Overload_Virtual_ToString_System_Object() cil managed - { - .maxstack 1 + .method public static string Instance_Overload_Virtual_ToString_System_Object() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Call_Overload_Virtual::.ctor() - call instance string [netstandard]System.Object::ToString() - ret - } + call instance string object::ToString() + ret + } - .method public static string Instance_Overload_Virtual_ToString_NoArgument_IL2C_ILConverters_Call() cil managed - { - .maxstack 1 + .method public static string Instance_Overload_Virtual_ToString_NoArgument_IL2C_ILConverters_Call() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Call_Overload_Virtual::.ctor() call instance string IL2C.ILConverters.Call_Overload_Virtual::ToString() - ret - } + ret + } - .method public static string Instance_Overload_Virtual_ToString_IL2C_ILConverters_Call(string v) cil managed - { - .maxstack 2 + .method public static string Instance_Overload_Virtual_ToString_IL2C_ILConverters_Call(string v) cil managed + { + .maxstack 2 newobj instance void class IL2C.ILConverters.Call_Overload_Virtual::.ctor() - ldarg.0 + ldarg.0 call instance string IL2C.ILConverters.Call_Overload_Virtual::ToString(string v) - ret - } + ret + } } diff --git a/tests/IL2C.Core.Test.ILConverters/Call/Call_Virtual.cs b/tests/IL2C.Core.Test.ILConverters/Call/Call_Virtual.cs index 9e1500d9..2976549b 100644 --- a/tests/IL2C.Core.Test.ILConverters/Call/Call_Virtual.cs +++ b/tests/IL2C.Core.Test.ILConverters/Call/Call_Virtual.cs @@ -23,7 +23,7 @@ namespace IL2C.ILConverters { [TestId("Call")] - [TestCase("IL2C.ILConverters.Call_Virtual", new[] { "Instance_ToString_System_Object", "ToString" })] + [TestCase("IL2C.ILConverters.Call_Virtual", new[] { "Instance_ToString_System_Object", "ToString" }, IgnoreILErrors = new[] { "ThisMismatch" })] [TestCase("CallTest", new[] { "Instance_ToString_IL2C_ILConverters_Call", "ToString" })] public sealed class Call_Virtual { diff --git a/tests/IL2C.Core.Test.ILConverters/Call/Call_Virtual.il b/tests/IL2C.Core.Test.ILConverters/Call/Call_Virtual.il index a7b5893b..359a633a 100644 --- a/tests/IL2C.Core.Test.ILConverters/Call/Call_Virtual.il +++ b/tests/IL2C.Core.Test.ILConverters/Call/Call_Virtual.il @@ -1,18 +1,18 @@ .class public IL2C.ILConverters.Call_Virtual { - .method public static string Instance_ToString_System_Object() cil managed - { - .maxstack 1 + .method public static string Instance_ToString_System_Object() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Call_Virtual::.ctor() - call instance string [netstandard]System.Object::ToString() - ret - } + call instance string object::ToString() + ret + } - .method public static string Instance_ToString_IL2C_ILConverters_Call() cil managed - { - .maxstack 1 + .method public static string Instance_ToString_IL2C_ILConverters_Call() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Call_Virtual::.ctor() call instance string IL2C.ILConverters.Call_Virtual::ToString() - ret - } + ret + } } diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1.il b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1.il index 4ff274e8..33648adf 100644 --- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1.il +++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1.il @@ -1,18 +1,18 @@ .class public IL2C.ILConverters.Callvirt_Derived1 { - .method public static string Derived1_ToString_System_Object() cil managed - { - .maxstack 1 + .method public static string Derived1_ToString_System_Object() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Callvirt_Derived1::.ctor() - callvirt instance string [netstandard]System.Object::ToString() - ret - } + callvirt instance string object::ToString() + ret + } - .method public static string Derived1_ToString_IL2C_ILConverters_Callvirt() cil managed - { - .maxstack 1 + .method public static string Derived1_ToString_IL2C_ILConverters_Callvirt() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Callvirt_Derived1::.ctor() callvirt instance string IL2C.ILConverters.Callvirt_Derived1::ToString() - ret - } + ret + } } diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1_Newslot.il b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1_Newslot.il index 594b3299..9e6647c5 100644 --- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1_Newslot.il +++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1_Newslot.il @@ -1,18 +1,18 @@ .class public IL2C.ILConverters.Callvirt_Derived1_Newslot { - .method public static string Derived1_Newslot_ToString_System_Object() cil managed - { - .maxstack 1 + .method public static string Derived1_Newslot_ToString_System_Object() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Callvirt_Derived1_Newslot::.ctor() - callvirt instance string [netstandard]System.Object::ToString() - ret - } + callvirt instance string object::ToString() + ret + } - .method public static string Derived1_Newslot_ToString_IL2C_ILConverters_Callvirt() cil managed - { - .maxstack 1 + .method public static string Derived1_Newslot_ToString_IL2C_ILConverters_Callvirt() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Callvirt_Derived1_Newslot::.ctor() callvirt instance string IL2C.ILConverters.Callvirt_Derived1_Newslot::ToString() - ret - } + ret + } } diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1_Newslot_Virtual.il b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1_Newslot_Virtual.il index dcc16ab2..9e1e02a3 100644 --- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1_Newslot_Virtual.il +++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived1_Newslot_Virtual.il @@ -4,7 +4,7 @@ { .maxstack 1 newobj instance void class IL2C.ILConverters.Callvirt_Derived1_Newslot_Virtual::.ctor() - callvirt instance string [netstandard]System.Object::ToString() + callvirt instance string object::ToString() ret } diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2.il b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2.il index 14bec481..a3d94395 100644 --- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2.il +++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2.il @@ -1,18 +1,18 @@ .class public IL2C.ILConverters.Callvirt_Derived2 { - .method public static string Derived2_ToString_System_Object() cil managed - { - .maxstack 1 + .method public static string Derived2_ToString_System_Object() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Callvirt_Derived2::.ctor() - callvirt instance string [netstandard]System.Object::ToString() - ret - } + callvirt instance string object::ToString() + ret + } - .method public static string Derived2_ToString_IL2C_ILConverters_Callvirt() cil managed - { - .maxstack 1 + .method public static string Derived2_ToString_IL2C_ILConverters_Callvirt() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Callvirt_Derived2::.ctor() callvirt instance string IL2C.ILConverters.Callvirt_Derived2::ToString() - ret - } + ret + } } diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot.il b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot.il index 4a0bfbd3..141a600c 100644 --- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot.il +++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot.il @@ -1,26 +1,26 @@ .class public IL2C.ILConverters.Callvirt_Derived2_Newslot { - .method public static string Derived2_Newslot_ToString_System_Object() cil managed - { - .maxstack 1 + .method public static string Derived2_Newslot_ToString_System_Object() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Callvirt_Derived2_Newslot::.ctor() - callvirt instance string [netstandard]System.Object::ToString() - ret - } + callvirt instance string object::ToString() + ret + } - .method public static string Derived2_Newslot_ToString_IL2C_ILConverters_Callvirt_Base() cil managed - { - .maxstack 1 + .method public static string Derived2_Newslot_ToString_IL2C_ILConverters_Callvirt_Base() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Callvirt_Derived2_Newslot::.ctor() callvirt instance string IL2C.ILConverters.Callvirt_Derived2_Newslot_Base::ToString() - ret - } + ret + } - .method public static string Derived2_Newslot_ToString_IL2C_ILConverters_Callvirt() cil managed - { - .maxstack 1 + .method public static string Derived2_Newslot_ToString_IL2C_ILConverters_Callvirt() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Callvirt_Derived2_Newslot::.ctor() callvirt instance string IL2C.ILConverters.Callvirt_Derived2_Newslot::ToString() - ret - } + ret + } } diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot_Virtual.il b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot_Virtual.il index a5241b6a..ec3f4acb 100644 --- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot_Virtual.il +++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived2_Newslot_Virtual.il @@ -4,7 +4,7 @@ { .maxstack 1 newobj instance void class IL2C.ILConverters.Callvirt_Derived2_Newslot_Virtual::.ctor() - callvirt instance string [netstandard]System.Object::ToString() + callvirt instance string object::ToString() ret } diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot.il b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot.il index cd3fd22a..cfaa42bb 100644 --- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot.il +++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot.il @@ -1,34 +1,34 @@ .class public IL2C.ILConverters.Callvirt_Derived3_Newslot { - .method public static string Derived3_Newslot_ToString_System_Object() cil managed - { - .maxstack 1 + .method public static string Derived3_Newslot_ToString_System_Object() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Callvirt_Derived3_Newslot::.ctor() - callvirt instance string [netstandard]System.Object::ToString() - ret - } + callvirt instance string object::ToString() + ret + } - .method public static string Derived3_Newslot_ToString_IL2C_ILConverters_Callvirt_Base1() cil managed - { - .maxstack 1 + .method public static string Derived3_Newslot_ToString_IL2C_ILConverters_Callvirt_Base1() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Callvirt_Derived3_Newslot::.ctor() callvirt instance string IL2C.ILConverters.Callvirt_Derived3_Newslot_Base1::ToString() - ret - } + ret + } - .method public static string Derived3_Newslot_ToString_IL2C_ILConverters_Callvirt_Base2() cil managed - { - .maxstack 1 + .method public static string Derived3_Newslot_ToString_IL2C_ILConverters_Callvirt_Base2() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Callvirt_Derived3_Newslot::.ctor() callvirt instance string IL2C.ILConverters.Callvirt_Derived3_Newslot_Base2::ToString() - ret - } + ret + } - .method public static string Derived3_Newslot_ToString_IL2C_ILConverters_Callvirt() cil managed - { - .maxstack 1 + .method public static string Derived3_Newslot_ToString_IL2C_ILConverters_Callvirt() cil managed + { + .maxstack 1 newobj instance void class IL2C.ILConverters.Callvirt_Derived3_Newslot::.ctor() callvirt instance string IL2C.ILConverters.Callvirt_Derived3_Newslot::ToString() - ret - } + ret + } } diff --git a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot_Virtual.il b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot_Virtual.il index 45cc6783..5a4915f9 100644 --- a/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot_Virtual.il +++ b/tests/IL2C.Core.Test.ILConverters/Callvirt/Callvirt_Derived3_Newslot_Virtual.il @@ -4,7 +4,7 @@ { .maxstack 1 newobj instance void class IL2C.ILConverters.Callvirt_Derived3_Newslot_Virtual::.ctor() - callvirt instance string [netstandard]System.Object::ToString() + callvirt instance string object::ToString() ret } diff --git a/tests/IL2C.Core.Test.ILConverters/Isinst/Isinst.il b/tests/IL2C.Core.Test.ILConverters/Isinst/Isinst.il index f2cd374e..5d26301b 100644 --- a/tests/IL2C.Core.Test.ILConverters/Isinst/Isinst.il +++ b/tests/IL2C.Core.Test.ILConverters/Isinst/Isinst.il @@ -1,27 +1,27 @@ .class public IL2C.ILConverters.Isinst { - .method public static string ConcatIfString(object v) cil managed - { - .maxstack 2 + .method public static string ConcatIfString(object v) cil managed + { + .maxstack 2 ldarg.0 - isinst [netstandard]System.String - dup - brnull.s N1 - ldstr "DEF" - call string [netstandard]System.String::Concat(string, string) - N1: - ret - } + isinst string + dup + brnull.s N1 + ldstr "DEF" + call string string::Concat(string, string) + N1: + ret + } - .method public static string ToStringIfInt32(object v) cil managed - { - .maxstack 2 + .method public static string ToStringIfInt32(object v) cil managed + { + .maxstack 2 ldarg.0 - isinst [netstandard]System.Int32 - dup - brnull.s N1 - callvirt instance string [netstandard]System.Object::ToString() - N1: - ret - } + isinst int32 + dup + brnull.s N1 + callvirt instance string object::ToString() + N1: + ret + } } diff --git a/tests/IL2C.Core.Test.ILConverters/Ldarga_s/Ldarga_s.il b/tests/IL2C.Core.Test.ILConverters/Ldarga_s/Ldarga_s.il index c426a9fa..c9447bfe 100644 --- a/tests/IL2C.Core.Test.ILConverters/Ldarga_s/Ldarga_s.il +++ b/tests/IL2C.Core.Test.ILConverters/Ldarga_s/Ldarga_s.il @@ -5,7 +5,7 @@ { .maxstack 1 ldarga.s 4 - call instance string [netstandard]System.Boolean::ToString() + call instance string bool::ToString() ret } @@ -14,7 +14,7 @@ { .maxstack 1 ldarga.s 4 - call instance string [netstandard]System.Byte::ToString() + call instance string uint8::ToString() ret } @@ -23,7 +23,7 @@ { .maxstack 1 ldarga.s 4 - call instance string [netstandard]System.Int16::ToString() + call instance string int16::ToString() ret } @@ -32,7 +32,7 @@ { .maxstack 1 ldarga.s 4 - call instance string [netstandard]System.Int32::ToString() + call instance string int32::ToString() ret } @@ -41,7 +41,7 @@ { .maxstack 1 ldarga.s 4 - call instance string [netstandard]System.Int64::ToString() + call instance string int64::ToString() ret } @@ -50,7 +50,7 @@ { .maxstack 1 ldarga.s 4 - call instance string [netstandard]System.SByte::ToString() + call instance string int8::ToString() ret } @@ -59,7 +59,7 @@ { .maxstack 1 ldarga.s 4 - call instance string [netstandard]System.UInt16::ToString() + call instance string uint16::ToString() ret } @@ -68,7 +68,7 @@ { .maxstack 1 ldarga.s 4 - call instance string [netstandard]System.UInt32::ToString() + call instance string uint32::ToString() ret } @@ -77,7 +77,7 @@ { .maxstack 1 ldarga.s 4 - call instance string [netstandard]System.UInt64::ToString() + call instance string uint64::ToString() ret } @@ -86,7 +86,7 @@ { .maxstack 1 ldarga.s 4 - call instance string [netstandard]System.IntPtr::ToString() + call instance string native int::ToString() ret } @@ -95,7 +95,7 @@ { .maxstack 1 ldarga.s 4 - call instance string [netstandard]System.UIntPtr::ToString() + call instance string native uint::ToString() ret } @@ -104,7 +104,7 @@ { .maxstack 1 ldarga.s 4 - call instance string [netstandard]System.Single::ToString() + call instance string float32::ToString() ret } @@ -113,7 +113,7 @@ { .maxstack 1 ldarga.s 4 - call instance string [netstandard]System.Double::ToString() + call instance string float64::ToString() ret } @@ -122,7 +122,7 @@ { .maxstack 1 ldarga.s 4 - call instance string [netstandard]System.Char::ToString() + call instance string char::ToString() ret } diff --git a/tests/IL2C.Core.Test.ILConverters/Ldloca_s/Ldloca_s.il b/tests/IL2C.Core.Test.ILConverters/Ldloca_s/Ldloca_s.il index 975ac466..3024b81b 100644 --- a/tests/IL2C.Core.Test.ILConverters/Ldloca_s/Ldloca_s.il +++ b/tests/IL2C.Core.Test.ILConverters/Ldloca_s/Ldloca_s.il @@ -9,7 +9,7 @@ ldc.i4.1 stloc.s 0 ldloca.s 0 - call instance string [netstandard]System.Boolean::ToString() + call instance string bool::ToString() ret } @@ -22,7 +22,7 @@ ldc.i4.0 stloc.s 0 ldloca.s 0 - call instance string [netstandard]System.Boolean::ToString() + call instance string bool::ToString() ret } @@ -35,7 +35,7 @@ ldc.i4 255 stloc.s 0 ldloca.s 0 - call instance string [netstandard]System.Byte::ToString() + call instance string uint8::ToString() ret } @@ -48,7 +48,7 @@ ldc.i4 32767 stloc.s 0 ldloca.s 0 - call instance string [netstandard]System.Int16::ToString() + call instance string int16::ToString() ret } @@ -61,7 +61,7 @@ ldc.i4 2147483647 stloc.s 0 ldloca.s 0 - call instance string [netstandard]System.Int32::ToString() + call instance string int32::ToString() ret } @@ -74,7 +74,7 @@ ldc.i8 9223372036854775807 stloc.s 0 ldloca.s 0 - call instance string [netstandard]System.Int64::ToString() + call instance string int64::ToString() ret } @@ -87,7 +87,7 @@ ldc.i4 127 stloc.s 0 ldloca.s 0 - call instance string [netstandard]System.SByte::ToString() + call instance string int8::ToString() ret } @@ -100,7 +100,7 @@ ldc.i4 65535 stloc.s 0 ldloca.s 0 - call instance string [netstandard]System.UInt16::ToString() + call instance string uint16::ToString() ret } @@ -114,7 +114,7 @@ conv.u4 stloc.s 0 ldloca.s 0 - call instance string [netstandard]System.UInt32::ToString() + call instance string uint32::ToString() ret } @@ -128,7 +128,7 @@ conv.u8 stloc.s 0 ldloca.s 0 - call instance string [netstandard]System.UInt64::ToString() + call instance string uint64::ToString() ret } @@ -142,7 +142,7 @@ conv.i stloc.s 0 ldloca.s 0 - call instance string [netstandard]System.IntPtr::ToString() + call instance string native int::ToString() ret } @@ -156,7 +156,7 @@ conv.u stloc.s 0 ldloca.s 0 - call instance string [netstandard]System.UIntPtr::ToString() + call instance string native uint::ToString() ret } @@ -169,7 +169,7 @@ ldc.r4 3.14159274 stloc.s 0 ldloca.s 0 - call instance string [netstandard]System.Single::ToString() + call instance string float32::ToString() ret } @@ -182,7 +182,7 @@ ldc.r8 3.1415926535897931 stloc.s 0 ldloca.s 0 - call instance string [netstandard]System.Double::ToString() + call instance string float64::ToString() ret } @@ -195,7 +195,7 @@ ldc.i4.s 0x41 stloc.s 0 ldloca.s 0 - call instance string [netstandard]System.Char::ToString() + call instance string char::ToString() ret } diff --git a/tests/IL2C.Core.Test.ILConverters/Unbox_any/Unbox_any.il b/tests/IL2C.Core.Test.ILConverters/Unbox_any/Unbox_any.il index 0346a25f..bcf32831 100644 --- a/tests/IL2C.Core.Test.ILConverters/Unbox_any/Unbox_any.il +++ b/tests/IL2C.Core.Test.ILConverters/Unbox_any/Unbox_any.il @@ -4,7 +4,7 @@ { .maxstack 1 ldarg.0 - unbox.any [netstandard]System.Int32 + unbox.any int32 ret } } diff --git a/tests/IL2C.Core.Test.RuntimeSystems/GarbageCollection/GarbageCollection.il b/tests/IL2C.Core.Test.RuntimeSystems/GarbageCollection/GarbageCollection.il index 1bc01b53..84d07130 100644 --- a/tests/IL2C.Core.Test.RuntimeSystems/GarbageCollection/GarbageCollection.il +++ b/tests/IL2C.Core.Test.RuntimeSystems/GarbageCollection/GarbageCollection.il @@ -9,7 +9,7 @@ ldstr "ABC" ldstr "DEF" - call string [netstandard]System.String::Concat(string, string) + call string string::Concat(string, string) newobj instance void IL2C.RuntimeSystems.ObjRefInsideObjRefType::.ctor(string) stloc.0 @@ -37,7 +37,7 @@ ldloca.s 0 ldstr "ABC" ldstr "DEF" - call string [netstandard]System.String::Concat(string, string) + call string string::Concat(string, string) call instance void IL2C.RuntimeSystems.ObjRefInsideValueTypeType::.ctor(string) // Release concat string from the evaluation stack @@ -63,7 +63,7 @@ ldstr "ABC" ldstr "DEF" - call string [netstandard]System.String::Concat(string, string) + call string string::Concat(string, string) newobj instance void IL2C.RuntimeSystems.ObjRefInsideValueTypeInsideObjRefType::.ctor(string) stloc.0 @@ -92,7 +92,7 @@ ldloca.s 0 ldstr "ABC" ldstr "DEF" - call string [netstandard]System.String::Concat(string, string) + call string string::Concat(string, string) call instance void IL2C.RuntimeSystems.ObjRefInsideObjRefInsideValueTypeType::.ctor(string) // Release concat string from the evaluation stack @@ -120,13 +120,13 @@ ldloca.s 0 ldstr "ABC" ldstr "DEF1" - call string [netstandard]System.String::Concat(string, string) + call string string::Concat(string, string) ldstr "ABC" ldstr "DEF2" - call string [netstandard]System.String::Concat(string, string) + call string string::Concat(string, string) ldstr "ABC" ldstr "DEF3" - call string [netstandard]System.String::Concat(string, string) + call string string::Concat(string, string) call instance void IL2C.RuntimeSystems.MultipleInsideValueTypeType::.ctor(string, string, string) // Release concat string from the evaluation stack From 968941c742c3d3429e8a0ed5d30f84202bcb1cd5 Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Mon, 25 Oct 2021 23:17:44 +0900 Subject: [PATCH 8/9] Fixed causing NRE at producing no error arguments. --- tests/IL2C.Core.Test.Fixture/Internal/ILVerifier.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/IL2C.Core.Test.Fixture/Internal/ILVerifier.cs b/tests/IL2C.Core.Test.Fixture/Internal/ILVerifier.cs index f9702273..bc472550 100644 --- a/tests/IL2C.Core.Test.Fixture/Internal/ILVerifier.cs +++ b/tests/IL2C.Core.Test.Fixture/Internal/ILVerifier.cs @@ -133,7 +133,8 @@ private static string GetMethodFullName(MethodDesc method) ToDictionary( e => GetMethodFullName(e.method), e => e.results.Select(r => - r.TryGetArgumentValue("Offset", out int offset) ? + ((r.ErrorArguments != null) && // BUG? + r.TryGetArgumentValue("Offset", out int offset)) ? (r, $"[0x{offset:x4}]: {(ILOpCode)EcmaMethodIL.Create((EcmaMethod)e.method).GetILBytes()[offset]}") : (r, "(No offset)") ). ToArray()); From 36c9ee9b8bea5e265c41be4f0a0730654671cbb0 Mon Sep 17 00:00:00 2001 From: Kouji Matsui Date: Sun, 31 Oct 2021 22:20:36 +0900 Subject: [PATCH 9/9] Switched IL.Verification related warnings to NUnit normal log. --- tests/IL2C.Core.Test.Fixture/TestFramework.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/IL2C.Core.Test.Fixture/TestFramework.cs b/tests/IL2C.Core.Test.Fixture/TestFramework.cs index 91c5154e..b5266e00 100644 --- a/tests/IL2C.Core.Test.Fixture/TestFramework.cs +++ b/tests/IL2C.Core.Test.Fixture/TestFramework.cs @@ -28,6 +28,9 @@ using IL2C.Metadata; using IL2C.Internal; +using NUnit.Framework.Internal; +using NUnit.Framework.Interfaces; +using ILVerify; #pragma warning disable CS0436 @@ -402,13 +405,19 @@ await TestUtilities.CopyResourceToStreamAsync( ToArray(); if (verifyResults.Length >= 1) { - foreach (var resultx in verifyResults.Take(verifyResults.Length - 1)) + // TODO: ILVerify (IL.Verification library comes portable version of PEVerify) + // produces a lot of minor or invalid result. + // So currently IL2C doesn't make error message. + static void RecordInformation(string message) { - Assert.Warn($"{caseInfo.Method.DeclaringType.FullName}.{caseInfo.Method.Name}: [{resultx.result.Code}/{resultx.result.ExceptionID?.ToString() ?? "None"}]: {string.Format(resultx.result.Message, resultx.result.Args ?? Array.Empty())}: {string.Join(",", resultx.result.ErrorArguments.Select(a => $"{a.Name}={a.Value}"))}: {resultx.instruction}"); + var currentResult = TestExecutionContext.CurrentContext.CurrentResult; + currentResult.OutWriter.WriteLine(message); } - var result = verifyResults[verifyResults.Length - 1]; - Assert.Fail($"{caseInfo.Method.DeclaringType.FullName}.{caseInfo.Method.Name}: [{result.result.Code}/{result.result.ExceptionID?.ToString() ?? "None"}]: {string.Format(result.result.Message, result.result.Args ?? Array.Empty())}: {string.Join(",", result.result.ErrorArguments.Select(a => $"{a.Name}={a.Value}"))}: {result.instruction}"); + foreach (var resultx in verifyResults) + { + RecordInformation($"IL.Verification: {caseInfo.Method.DeclaringType.FullName}.{caseInfo.Method.Name}: [{resultx.result.Code}/{resultx.result.ExceptionID?.ToString() ?? "None"}]: {string.Format(resultx.result.Message, resultx.result.Args ?? Array.Empty())}: {string.Join(",", resultx.result.ErrorArguments?.Select(a => $"{a.Name}={a.Value}") ?? Array.Empty())}: {resultx.instruction}"); + } } ///////////////////////////////////////////////