From 488348e79839745d4be694157e6acea515ba24cb Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sun, 17 Feb 2019 17:37:49 +0100 Subject: [PATCH] Add old MultidimensionalArrays test to pretty test runner. --- .../ICSharpCode.Decompiler.Tests.csproj | 1 + .../PrettyTestRunner.cs | 6 + .../Pretty}/MultidimensionalArray.cs | 56 +++-- .../TestCases/Pretty/MultidimensionalArray.il | 214 +++++++++++++++++ .../Pretty/MultidimensionalArray.opt.il | 197 ++++++++++++++++ .../MultidimensionalArray.opt.roslyn.il | 201 ++++++++++++++++ .../Pretty/MultidimensionalArray.roslyn.il | 219 ++++++++++++++++++ 7 files changed, 865 insertions(+), 29 deletions(-) rename ICSharpCode.Decompiler.Tests/{ => TestCases/Pretty}/MultidimensionalArray.cs (66%) create mode 100644 ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.il create mode 100644 ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.opt.il create mode 100644 ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.opt.roslyn.il create mode 100644 ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.roslyn.il diff --git a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj index 2f2dcf880..c775d10e6 100644 --- a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj +++ b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj @@ -67,6 +67,7 @@ + diff --git a/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs b/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs index bfbada319..ed4130677 100644 --- a/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs +++ b/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs @@ -383,6 +383,12 @@ namespace ICSharpCode.Decompiler.Tests RunForLibrary(cscOptions: cscOptions); } + [Test] + public void MultidimensionalArray([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions) + { + RunForLibrary(cscOptions: cscOptions); + } + [Test] public void EnumTests([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions) { diff --git a/ICSharpCode.Decompiler.Tests/MultidimensionalArray.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.cs similarity index 66% rename from ICSharpCode.Decompiler.Tests/MultidimensionalArray.cs rename to ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.cs index c3557cee4..916e825c6 100644 --- a/ICSharpCode.Decompiler.Tests/MultidimensionalArray.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.cs @@ -16,43 +16,41 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System; - -public class MultidimensionalArray +namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty { - internal class Generic where T : new() + public class MultidimensionalArray { - private T[,] a = new T[20, 20]; - private S[,][] b = new S[20, 20][]; - - public T this[int i, int j] + internal class Generic where T : new() { - get + private T[,] a = new T[20, 20]; + private S[,][] b = new S[20, 20][]; + + public T this[int i, int j] { + get { + return a[i, j]; + } + set { + a[i, j] = value; + } + } + + public void TestB(S x, ref S y) { - return this.a[i, j]; + b[5, 3] = new S[10]; + b[5, 3][0] = default(S); + b[5, 3][1] = x; + b[5, 3][2] = y; } - set + + public void PassByReference(ref T arr) { - this.a[i, j] = value; + PassByReference(ref a[10, 10]); } } - - public void TestB(S x, ref S y) - { - this.b[5, 3] = new S[10]; - this.b[5, 3][0] = default(S); - this.b[5, 3][1] = x; - this.b[5, 3][2] = y; - } - - public void PassByReference(ref T arr) + + public int[][,] MakeArray() { - this.PassByReference(ref this.a[10, 10]); + return new int[10][,]; } } - - public int[][,] MakeArray() - { - return new int[10][,]; - } -} +} \ No newline at end of file diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.il new file mode 100644 index 000000000..f200447dd --- /dev/null +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.il @@ -0,0 +1,214 @@ + + + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly MultidimensionalArray +{ + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx + 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. + .permissionset reqmin + = {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}} + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module MultidimensionalArray.dll +.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 ) +.imagebase 0x10000000 +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 // WINDOWS_CUI +.corflags 0x00000001 // ILONLY + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray + extends [mscorlib]System.Object +{ + .class auto ansi nested assembly beforefieldinit Generic`2<.ctor T,S> + extends [mscorlib]System.Object + { + .custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) = ( 01 00 04 49 74 65 6D 00 00 ) // ...Item.. + .field private !T[0...,0...] a + .field private !S[][0...,0...] b + .method public hidebysig specialname + instance !T get_Item(int32 i, + int32 j) cil managed + { + // Code size 19 (0x13) + .maxstack 3 + .locals init (!T V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::a + IL_0007: ldarg.1 + IL_0008: ldarg.2 + IL_0009: call instance !T !T[0...,0...]::Get(int32, + int32) + IL_000e: stloc.0 + IL_000f: br.s IL_0011 + + IL_0011: ldloc.0 + IL_0012: ret + } // end of method Generic`2::get_Item + + .method public hidebysig specialname + instance void set_Item(int32 i, + int32 j, + !T 'value') cil managed + { + // Code size 16 (0x10) + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::a + IL_0007: ldarg.1 + IL_0008: ldarg.2 + IL_0009: ldarg.3 + IL_000a: call instance void !T[0...,0...]::Set(int32, + int32, + !T) + IL_000f: ret + } // end of method Generic`2::set_Item + + .method public hidebysig instance void + TestB(!S x, + !S& y) cil managed + { + // Code size 95 (0x5f) + .maxstack 4 + .locals init (!S V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::b + IL_0007: ldc.i4.5 + IL_0008: ldc.i4.3 + IL_0009: ldc.i4.s 10 + IL_000b: newarr !S + IL_0010: call instance void !S[][0...,0...]::Set(int32, + int32, + !S[]) + IL_0015: ldarg.0 + IL_0016: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::b + IL_001b: ldc.i4.5 + IL_001c: ldc.i4.3 + IL_001d: call instance !S[] !S[][0...,0...]::Get(int32, + int32) + IL_0022: ldc.i4.0 + IL_0023: ldloca.s V_0 + IL_0025: initobj !S + IL_002b: ldloc.0 + IL_002c: stelem !S + IL_0031: ldarg.0 + IL_0032: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::b + IL_0037: ldc.i4.5 + IL_0038: ldc.i4.3 + IL_0039: call instance !S[] !S[][0...,0...]::Get(int32, + int32) + IL_003e: ldc.i4.1 + IL_003f: ldarg.1 + IL_0040: stelem !S + IL_0045: ldarg.0 + IL_0046: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::b + IL_004b: ldc.i4.5 + IL_004c: ldc.i4.3 + IL_004d: call instance !S[] !S[][0...,0...]::Get(int32, + int32) + IL_0052: ldc.i4.2 + IL_0053: ldarg.2 + IL_0054: ldobj !S + IL_0059: stelem !S + IL_005e: ret + } // end of method Generic`2::TestB + + .method public hidebysig instance void + PassByReference(!T& arr) cil managed + { + // Code size 24 (0x18) + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldarg.0 + IL_0003: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::a + IL_0008: ldc.i4.s 10 + IL_000a: ldc.i4.s 10 + IL_000c: call instance !T& !T[0...,0...]::Address(int32, + int32) + IL_0011: call instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::PassByReference(!0&) + IL_0016: nop + IL_0017: ret + } // end of method Generic`2::PassByReference + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 38 (0x26) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.s 20 + IL_0003: ldc.i4.s 20 + IL_0005: newobj instance void !T[0...,0...]::.ctor(int32, + int32) + IL_000a: stfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::a + IL_000f: ldarg.0 + IL_0010: ldc.i4.s 20 + IL_0012: ldc.i4.s 20 + IL_0014: newobj instance void !S[][0...,0...]::.ctor(int32, + int32) + IL_0019: stfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::b + IL_001e: ldarg.0 + IL_001f: call instance void [mscorlib]System.Object::.ctor() + IL_0024: nop + IL_0025: ret + } // end of method Generic`2::.ctor + + .property instance !T Item(int32, + int32) + { + .get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::get_Item(int32, + int32) + .set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::set_Item(int32, + int32, + !T) + } // end of property Generic`2::Item + } // end of class Generic`2 + + .method public hidebysig instance int32[0...,0...][] + MakeArray() cil managed + { + // Code size 13 (0xd) + .maxstack 1 + .locals init (int32[0...,0...][] V_0) + IL_0000: nop + IL_0001: ldc.i4.s 10 + IL_0003: newarr int32[0...,0...] + IL_0008: stloc.0 + IL_0009: br.s IL_000b + + IL_000b: ldloc.0 + IL_000c: ret + } // end of method MultidimensionalArray::MakeArray + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method MultidimensionalArray::.ctor + +} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.opt.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.opt.il new file mode 100644 index 000000000..1f6150253 --- /dev/null +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.opt.il @@ -0,0 +1,197 @@ + + + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly MultidimensionalArray.opt +{ + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx + 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. + .permissionset reqmin + = {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}} + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module MultidimensionalArray.opt.dll +.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 ) +.imagebase 0x10000000 +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 // WINDOWS_CUI +.corflags 0x00000001 // ILONLY + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray + extends [mscorlib]System.Object +{ + .class auto ansi nested assembly beforefieldinit Generic`2<.ctor T,S> + extends [mscorlib]System.Object + { + .custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) = ( 01 00 04 49 74 65 6D 00 00 ) // ...Item.. + .field private !T[0...,0...] a + .field private !S[][0...,0...] b + .method public hidebysig specialname + instance !T get_Item(int32 i, + int32 j) cil managed + { + // Code size 14 (0xe) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::a + IL_0006: ldarg.1 + IL_0007: ldarg.2 + IL_0008: call instance !T !T[0...,0...]::Get(int32, + int32) + IL_000d: ret + } // end of method Generic`2::get_Item + + .method public hidebysig specialname + instance void set_Item(int32 i, + int32 j, + !T 'value') cil managed + { + // Code size 15 (0xf) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::a + IL_0006: ldarg.1 + IL_0007: ldarg.2 + IL_0008: ldarg.3 + IL_0009: call instance void !T[0...,0...]::Set(int32, + int32, + !T) + IL_000e: ret + } // end of method Generic`2::set_Item + + .method public hidebysig instance void + TestB(!S x, + !S& y) cil managed + { + // Code size 94 (0x5e) + .maxstack 4 + .locals init (!S V_0) + IL_0000: ldarg.0 + IL_0001: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::b + IL_0006: ldc.i4.5 + IL_0007: ldc.i4.3 + IL_0008: ldc.i4.s 10 + IL_000a: newarr !S + IL_000f: call instance void !S[][0...,0...]::Set(int32, + int32, + !S[]) + IL_0014: ldarg.0 + IL_0015: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::b + IL_001a: ldc.i4.5 + IL_001b: ldc.i4.3 + IL_001c: call instance !S[] !S[][0...,0...]::Get(int32, + int32) + IL_0021: ldc.i4.0 + IL_0022: ldloca.s V_0 + IL_0024: initobj !S + IL_002a: ldloc.0 + IL_002b: stelem !S + IL_0030: ldarg.0 + IL_0031: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::b + IL_0036: ldc.i4.5 + IL_0037: ldc.i4.3 + IL_0038: call instance !S[] !S[][0...,0...]::Get(int32, + int32) + IL_003d: ldc.i4.1 + IL_003e: ldarg.1 + IL_003f: stelem !S + IL_0044: ldarg.0 + IL_0045: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::b + IL_004a: ldc.i4.5 + IL_004b: ldc.i4.3 + IL_004c: call instance !S[] !S[][0...,0...]::Get(int32, + int32) + IL_0051: ldc.i4.2 + IL_0052: ldarg.2 + IL_0053: ldobj !S + IL_0058: stelem !S + IL_005d: ret + } // end of method Generic`2::TestB + + .method public hidebysig instance void + PassByReference(!T& arr) cil managed + { + // Code size 22 (0x16) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.0 + IL_0002: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::a + IL_0007: ldc.i4.s 10 + IL_0009: ldc.i4.s 10 + IL_000b: call instance !T& !T[0...,0...]::Address(int32, + int32) + IL_0010: call instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::PassByReference(!0&) + IL_0015: ret + } // end of method Generic`2::PassByReference + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 37 (0x25) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.s 20 + IL_0003: ldc.i4.s 20 + IL_0005: newobj instance void !T[0...,0...]::.ctor(int32, + int32) + IL_000a: stfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::a + IL_000f: ldarg.0 + IL_0010: ldc.i4.s 20 + IL_0012: ldc.i4.s 20 + IL_0014: newobj instance void !S[][0...,0...]::.ctor(int32, + int32) + IL_0019: stfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::b + IL_001e: ldarg.0 + IL_001f: call instance void [mscorlib]System.Object::.ctor() + IL_0024: ret + } // end of method Generic`2::.ctor + + .property instance !T Item(int32, + int32) + { + .get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::get_Item(int32, + int32) + .set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::set_Item(int32, + int32, + !T) + } // end of property Generic`2::Item + } // end of class Generic`2 + + .method public hidebysig instance int32[0...,0...][] + MakeArray() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldc.i4.s 10 + IL_0002: newarr int32[0...,0...] + IL_0007: ret + } // end of method MultidimensionalArray::MakeArray + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method MultidimensionalArray::.ctor + +} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.opt.roslyn.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.opt.roslyn.il new file mode 100644 index 000000000..d5692811e --- /dev/null +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.opt.roslyn.il @@ -0,0 +1,201 @@ + + + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly MultidimensionalArray +{ + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx + 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. + + // --- The following custom attribute is added automatically, do not uncomment ------- + // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 02 00 00 00 00 00 ) + + .permissionset reqmin + = {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}} + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module MultidimensionalArray.dll +.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 ) +.imagebase 0x10000000 +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 // WINDOWS_CUI +.corflags 0x00000001 // ILONLY + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray + extends [mscorlib]System.Object +{ + .class auto ansi nested assembly beforefieldinit Generic`2<.ctor T,S> + extends [mscorlib]System.Object + { + .custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) = ( 01 00 04 49 74 65 6D 00 00 ) // ...Item.. + .field private !T[0...,0...] a + .field private !S[][0...,0...] b + .method public hidebysig specialname + instance !T get_Item(int32 i, + int32 j) cil managed + { + // Code size 14 (0xe) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::a + IL_0006: ldarg.1 + IL_0007: ldarg.2 + IL_0008: call instance !T !T[0...,0...]::Get(int32, + int32) + IL_000d: ret + } // end of method Generic`2::get_Item + + .method public hidebysig specialname + instance void set_Item(int32 i, + int32 j, + !T 'value') cil managed + { + // Code size 15 (0xf) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::a + IL_0006: ldarg.1 + IL_0007: ldarg.2 + IL_0008: ldarg.3 + IL_0009: call instance void !T[0...,0...]::Set(int32, + int32, + !T) + IL_000e: ret + } // end of method Generic`2::set_Item + + .method public hidebysig instance void + TestB(!S x, + !S& y) cil managed + { + // Code size 94 (0x5e) + .maxstack 4 + .locals init (!S V_0) + IL_0000: ldarg.0 + IL_0001: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::b + IL_0006: ldc.i4.5 + IL_0007: ldc.i4.3 + IL_0008: ldc.i4.s 10 + IL_000a: newarr !S + IL_000f: call instance void !S[][0...,0...]::Set(int32, + int32, + !S[]) + IL_0014: ldarg.0 + IL_0015: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::b + IL_001a: ldc.i4.5 + IL_001b: ldc.i4.3 + IL_001c: call instance !S[] !S[][0...,0...]::Get(int32, + int32) + IL_0021: ldc.i4.0 + IL_0022: ldloca.s V_0 + IL_0024: initobj !S + IL_002a: ldloc.0 + IL_002b: stelem !S + IL_0030: ldarg.0 + IL_0031: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::b + IL_0036: ldc.i4.5 + IL_0037: ldc.i4.3 + IL_0038: call instance !S[] !S[][0...,0...]::Get(int32, + int32) + IL_003d: ldc.i4.1 + IL_003e: ldarg.1 + IL_003f: stelem !S + IL_0044: ldarg.0 + IL_0045: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::b + IL_004a: ldc.i4.5 + IL_004b: ldc.i4.3 + IL_004c: call instance !S[] !S[][0...,0...]::Get(int32, + int32) + IL_0051: ldc.i4.2 + IL_0052: ldarg.2 + IL_0053: ldobj !S + IL_0058: stelem !S + IL_005d: ret + } // end of method Generic`2::TestB + + .method public hidebysig instance void + PassByReference(!T& arr) cil managed + { + // Code size 22 (0x16) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.0 + IL_0002: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::a + IL_0007: ldc.i4.s 10 + IL_0009: ldc.i4.s 10 + IL_000b: call instance !T& !T[0...,0...]::Address(int32, + int32) + IL_0010: call instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::PassByReference(!0&) + IL_0015: ret + } // end of method Generic`2::PassByReference + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 37 (0x25) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.s 20 + IL_0003: ldc.i4.s 20 + IL_0005: newobj instance void !T[0...,0...]::.ctor(int32, + int32) + IL_000a: stfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::a + IL_000f: ldarg.0 + IL_0010: ldc.i4.s 20 + IL_0012: ldc.i4.s 20 + IL_0014: newobj instance void !S[][0...,0...]::.ctor(int32, + int32) + IL_0019: stfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::b + IL_001e: ldarg.0 + IL_001f: call instance void [mscorlib]System.Object::.ctor() + IL_0024: ret + } // end of method Generic`2::.ctor + + .property instance !T Item(int32, + int32) + { + .get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::get_Item(int32, + int32) + .set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::set_Item(int32, + int32, + !T) + } // end of property Generic`2::Item + } // end of class Generic`2 + + .method public hidebysig instance int32[0...,0...][] + MakeArray() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldc.i4.s 10 + IL_0002: newarr int32[0...,0...] + IL_0007: ret + } // end of method MultidimensionalArray::MakeArray + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method MultidimensionalArray::.ctor + +} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.roslyn.il b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.roslyn.il new file mode 100644 index 000000000..fc1d066c9 --- /dev/null +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/MultidimensionalArray.roslyn.il @@ -0,0 +1,219 @@ + + + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly MultidimensionalArray +{ + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx + 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. + + // --- The following custom attribute is added automatically, do not uncomment ------- + // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 ) + + .permissionset reqmin + = {[mscorlib]System.Security.Permissions.SecurityPermissionAttribute = {property bool 'SkipVerification' = bool(true)}} + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module MultidimensionalArray.dll +.custom instance void [mscorlib]System.Security.UnverifiableCodeAttribute::.ctor() = ( 01 00 00 00 ) +.imagebase 0x10000000 +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 // WINDOWS_CUI +.corflags 0x00000001 // ILONLY + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class public auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray + extends [mscorlib]System.Object +{ + .class auto ansi nested assembly beforefieldinit Generic`2<.ctor T,S> + extends [mscorlib]System.Object + { + .custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) = ( 01 00 04 49 74 65 6D 00 00 ) // ...Item.. + .field private !T[0...,0...] a + .field private !S[][0...,0...] b + .method public hidebysig specialname + instance !T get_Item(int32 i, + int32 j) cil managed + { + // Code size 19 (0x13) + .maxstack 3 + .locals init (!T V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::a + IL_0007: ldarg.1 + IL_0008: ldarg.2 + IL_0009: call instance !T !T[0...,0...]::Get(int32, + int32) + IL_000e: stloc.0 + IL_000f: br.s IL_0011 + + IL_0011: ldloc.0 + IL_0012: ret + } // end of method Generic`2::get_Item + + .method public hidebysig specialname + instance void set_Item(int32 i, + int32 j, + !T 'value') cil managed + { + // Code size 16 (0x10) + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::a + IL_0007: ldarg.1 + IL_0008: ldarg.2 + IL_0009: ldarg.3 + IL_000a: call instance void !T[0...,0...]::Set(int32, + int32, + !T) + IL_000f: ret + } // end of method Generic`2::set_Item + + .method public hidebysig instance void + TestB(!S x, + !S& y) cil managed + { + // Code size 95 (0x5f) + .maxstack 4 + .locals init (!S V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::b + IL_0007: ldc.i4.5 + IL_0008: ldc.i4.3 + IL_0009: ldc.i4.s 10 + IL_000b: newarr !S + IL_0010: call instance void !S[][0...,0...]::Set(int32, + int32, + !S[]) + IL_0015: ldarg.0 + IL_0016: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::b + IL_001b: ldc.i4.5 + IL_001c: ldc.i4.3 + IL_001d: call instance !S[] !S[][0...,0...]::Get(int32, + int32) + IL_0022: ldc.i4.0 + IL_0023: ldloca.s V_0 + IL_0025: initobj !S + IL_002b: ldloc.0 + IL_002c: stelem !S + IL_0031: ldarg.0 + IL_0032: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::b + IL_0037: ldc.i4.5 + IL_0038: ldc.i4.3 + IL_0039: call instance !S[] !S[][0...,0...]::Get(int32, + int32) + IL_003e: ldc.i4.1 + IL_003f: ldarg.1 + IL_0040: stelem !S + IL_0045: ldarg.0 + IL_0046: ldfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::b + IL_004b: ldc.i4.5 + IL_004c: ldc.i4.3 + IL_004d: call instance !S[] !S[][0...,0...]::Get(int32, + int32) + IL_0052: ldc.i4.2 + IL_0053: ldarg.2 + IL_0054: ldobj !S + IL_0059: stelem !S + IL_005e: ret + } // end of method Generic`2::TestB + + .method public hidebysig instance void + PassByReference(!T& arr) cil managed + { + // Code size 24 (0x18) + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldarg.0 + IL_0003: ldfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::a + IL_0008: ldc.i4.s 10 + IL_000a: ldc.i4.s 10 + IL_000c: call instance !T& !T[0...,0...]::Address(int32, + int32) + IL_0011: call instance void class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::PassByReference(!0&) + IL_0016: nop + IL_0017: ret + } // end of method Generic`2::PassByReference + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 38 (0x26) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.s 20 + IL_0003: ldc.i4.s 20 + IL_0005: newobj instance void !T[0...,0...]::.ctor(int32, + int32) + IL_000a: stfld !0[0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::a + IL_000f: ldarg.0 + IL_0010: ldc.i4.s 20 + IL_0012: ldc.i4.s 20 + IL_0014: newobj instance void !S[][0...,0...]::.ctor(int32, + int32) + IL_0019: stfld !1[][0...,0...] class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::b + IL_001e: ldarg.0 + IL_001f: call instance void [mscorlib]System.Object::.ctor() + IL_0024: nop + IL_0025: ret + } // end of method Generic`2::.ctor + + .property instance !T Item(int32, + int32) + { + .get instance !T ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::get_Item(int32, + int32) + .set instance void ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray/Generic`2::set_Item(int32, + int32, + !T) + } // end of property Generic`2::Item + } // end of class Generic`2 + + .method public hidebysig instance int32[0...,0...][] + MakeArray() cil managed + { + // Code size 13 (0xd) + .maxstack 1 + .locals init (int32[0...,0...][] V_0) + IL_0000: nop + IL_0001: ldc.i4.s 10 + IL_0003: newarr int32[0...,0...] + IL_0008: stloc.0 + IL_0009: br.s IL_000b + + IL_000b: ldloc.0 + IL_000c: ret + } // end of method MultidimensionalArray::MakeArray + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method MultidimensionalArray::.ctor + +} // end of class ICSharpCode.Decompiler.Tests.TestCases.Pretty.MultidimensionalArray + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE ***********************