Browse Source

Add test case for foreach over int pointer array

pull/946/head
Siegfried Pammer 8 years ago
parent
commit
a0e2d131b6
  1. 10
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.cs
  2. 61
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.il
  3. 51
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.opt.il
  4. 42
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.opt.roslyn.il
  5. 51
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.roslyn.il

10
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.cs

@ -409,7 +409,6 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -409,7 +409,6 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
}
return result;
}
#endregion
public void ForEachOverArray(string[] array)
{
@ -418,6 +417,15 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -418,6 +417,15 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
}
}
public unsafe void ForEachOverArrayOfPointers(int*[] array)
{
foreach (int* value in array) {
Console.WriteLine(new IntPtr(value));
Console.WriteLine(new IntPtr(value));
}
}
#endregion
public void ForOverArray(string[] array)
{
for (int i = 0; i < array.Length; i++) {

61
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.il

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. Alle Rechte vorbehalten.
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly ev4s5oix
.assembly vsvybxtk
{
.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
@ -20,15 +20,15 @@ @@ -20,15 +20,15 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module ev4s5oix.dll
// MVID: {2CE88082-2B99-4514-B562-457B10DE03C1}
.module vsvybxtk.dll
// MVID: {6C5236E6-826F-4D2D-AF03-574254796A89}
.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
// Image base: 0x02F30000
// Image base: 0x02F80000
// =============== CLASS MEMBERS DECLARATION ===================
@ -1545,6 +1545,55 @@ @@ -1545,6 +1545,55 @@
IL_0033: ret
} // end of method Loops::ForEachOverArray
.method public hidebysig instance void
ForEachOverArrayOfPointers(int32*[] 'array') cil managed
{
// Code size 63 (0x3f)
.maxstack 2
.locals init (int32* V_0,
int32*[] V_1,
int32 V_2,
bool V_3)
IL_0000: nop
IL_0001: nop
IL_0002: ldarg.1
IL_0003: stloc.1
IL_0004: ldc.i4.0
IL_0005: stloc.2
IL_0006: br.s IL_0034
IL_0008: ldloc.1
IL_0009: ldloc.2
IL_000a: ldelem.i
IL_000b: stloc.0
IL_000c: nop
IL_000d: ldloc.0
IL_000e: newobj instance void [mscorlib]System.IntPtr::.ctor(void*)
IL_0013: box [mscorlib]System.IntPtr
IL_0018: call void [mscorlib]System.Console::WriteLine(object)
IL_001d: nop
IL_001e: ldloc.0
IL_001f: newobj instance void [mscorlib]System.IntPtr::.ctor(void*)
IL_0024: box [mscorlib]System.IntPtr
IL_0029: call void [mscorlib]System.Console::WriteLine(object)
IL_002e: nop
IL_002f: nop
IL_0030: ldloc.2
IL_0031: ldc.i4.1
IL_0032: add
IL_0033: stloc.2
IL_0034: ldloc.2
IL_0035: ldloc.1
IL_0036: ldlen
IL_0037: conv.i4
IL_0038: clt
IL_003a: stloc.3
IL_003b: ldloc.3
IL_003c: brtrue.s IL_0008
IL_003e: ret
} // end of method Loops::ForEachOverArrayOfPointers
.method public hidebysig instance void
ForOverArray(string[] 'array') cil managed
{
@ -1902,4 +1951,4 @@ @@ -1902,4 +1951,4 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// Warnung: Win32-Ressourcendatei "../../../TestCases/Pretty\Loops.res" wurde erstellt.
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\Loops.res

51
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.opt.il

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. Alle Rechte vorbehalten.
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
.assembly vealwk1x
.assembly hrizu0iy
{
.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
@ -20,15 +20,15 @@ @@ -20,15 +20,15 @@
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module vealwk1x.dll
// MVID: {87616308-3247-419F-A8DD-0A962E9362DF}
.module hrizu0iy.dll
// MVID: {8FC80EBC-E149-454A-A769-13F3C07EB46F}
.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
// Image base: 0x00C00000
// Image base: 0x02CE0000
// =============== CLASS MEMBERS DECLARATION ===================
@ -1240,6 +1240,45 @@ @@ -1240,6 +1240,45 @@
IL_002a: ret
} // end of method Loops::ForEachOverArray
.method public hidebysig instance void
ForEachOverArrayOfPointers(int32*[] 'array') cil managed
{
// Code size 53 (0x35)
.maxstack 2
.locals init (int32* V_0,
int32*[] V_1,
int32 V_2)
IL_0000: ldarg.1
IL_0001: stloc.1
IL_0002: ldc.i4.0
IL_0003: stloc.2
IL_0004: br.s IL_002e
IL_0006: ldloc.1
IL_0007: ldloc.2
IL_0008: ldelem.i
IL_0009: stloc.0
IL_000a: ldloc.0
IL_000b: newobj instance void [mscorlib]System.IntPtr::.ctor(void*)
IL_0010: box [mscorlib]System.IntPtr
IL_0015: call void [mscorlib]System.Console::WriteLine(object)
IL_001a: ldloc.0
IL_001b: newobj instance void [mscorlib]System.IntPtr::.ctor(void*)
IL_0020: box [mscorlib]System.IntPtr
IL_0025: call void [mscorlib]System.Console::WriteLine(object)
IL_002a: ldloc.2
IL_002b: ldc.i4.1
IL_002c: add
IL_002d: stloc.2
IL_002e: ldloc.2
IL_002f: ldloc.1
IL_0030: ldlen
IL_0031: conv.i4
IL_0032: blt.s IL_0006
IL_0034: ret
} // end of method Loops::ForEachOverArrayOfPointers
.method public hidebysig instance void
ForOverArray(string[] 'array') cil managed
{
@ -1475,4 +1514,4 @@ @@ -1475,4 +1514,4 @@
// =============================================================
// *********** DISASSEMBLY COMPLETE ***********************
// Warnung: Win32-Ressourcendatei "../../../TestCases/Pretty\Loops.opt.res" wurde erstellt.
// WARNING: Created Win32 resource file ../../../TestCases/Pretty\Loops.opt.res

42
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.opt.roslyn.il

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. Alle Rechte vorbehalten.
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -25,14 +25,14 @@ @@ -25,14 +25,14 @@
.ver 0:0:0:0
}
.module Loops.dll
// MVID: {6ED0C8DC-47D3-4564-B22B-E2917EC72DC8}
// MVID: {30F4646B-D900-420C-89F2-283C178D2EAC}
.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
// Image base: 0x00E00000
// Image base: 0x00E90000
// =============== CLASS MEMBERS DECLARATION ===================
@ -1202,6 +1202,42 @@ @@ -1202,6 +1202,42 @@
IL_002a: ret
} // end of method Loops::ForEachOverArray
.method public hidebysig instance void
ForEachOverArrayOfPointers(int32*[] 'array') cil managed
{
// Code size 51 (0x33)
.maxstack 2
.locals init (int32*[] V_0,
int32 V_1)
IL_0000: ldarg.1
IL_0001: stloc.0
IL_0002: ldc.i4.0
IL_0003: stloc.1
IL_0004: br.s IL_002c
IL_0006: ldloc.0
IL_0007: ldloc.1
IL_0008: ldelem.i
IL_0009: dup
IL_000a: newobj instance void [mscorlib]System.IntPtr::.ctor(void*)
IL_000f: box [mscorlib]System.IntPtr
IL_0014: call void [mscorlib]System.Console::WriteLine(object)
IL_0019: newobj instance void [mscorlib]System.IntPtr::.ctor(void*)
IL_001e: box [mscorlib]System.IntPtr
IL_0023: call void [mscorlib]System.Console::WriteLine(object)
IL_0028: ldloc.1
IL_0029: ldc.i4.1
IL_002a: add
IL_002b: stloc.1
IL_002c: ldloc.1
IL_002d: ldloc.0
IL_002e: ldlen
IL_002f: conv.i4
IL_0030: blt.s IL_0006
IL_0032: ret
} // end of method Loops::ForEachOverArrayOfPointers
.method public hidebysig instance void
ForOverArray(string[] 'array') cil managed
{

51
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Loops.roslyn.il

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0
// Copyright (c) Microsoft Corporation. Alle Rechte vorbehalten.
// Copyright (c) Microsoft Corporation. All rights reserved.
@ -25,14 +25,14 @@ @@ -25,14 +25,14 @@
.ver 0:0:0:0
}
.module Loops.dll
// MVID: {A2180394-EF43-440C-8C7A-EFCA148DB606}
// MVID: {721D369B-DC6E-425B-AE0E-46C242DEFDF5}
.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
// Image base: 0x00C10000
// Image base: 0x00480000
// =============== CLASS MEMBERS DECLARATION ===================
@ -1443,6 +1443,51 @@ @@ -1443,6 +1443,51 @@
IL_002f: ret
} // end of method Loops::ForEachOverArray
.method public hidebysig instance void
ForEachOverArrayOfPointers(int32*[] 'array') cil managed
{
// Code size 59 (0x3b)
.maxstack 2
.locals init (int32*[] V_0,
int32 V_1,
int32* V_2)
IL_0000: nop
IL_0001: nop
IL_0002: ldarg.1
IL_0003: stloc.0
IL_0004: ldc.i4.0
IL_0005: stloc.1
IL_0006: br.s IL_0034
IL_0008: ldloc.0
IL_0009: ldloc.1
IL_000a: ldelem.i
IL_000b: stloc.2
IL_000c: nop
IL_000d: ldloc.2
IL_000e: newobj instance void [mscorlib]System.IntPtr::.ctor(void*)
IL_0013: box [mscorlib]System.IntPtr
IL_0018: call void [mscorlib]System.Console::WriteLine(object)
IL_001d: nop
IL_001e: ldloc.2
IL_001f: newobj instance void [mscorlib]System.IntPtr::.ctor(void*)
IL_0024: box [mscorlib]System.IntPtr
IL_0029: call void [mscorlib]System.Console::WriteLine(object)
IL_002e: nop
IL_002f: nop
IL_0030: ldloc.1
IL_0031: ldc.i4.1
IL_0032: add
IL_0033: stloc.1
IL_0034: ldloc.1
IL_0035: ldloc.0
IL_0036: ldlen
IL_0037: conv.i4
IL_0038: blt.s IL_0008
IL_003a: ret
} // end of method Loops::ForEachOverArrayOfPointers
.method public hidebysig instance void
ForOverArray(string[] 'array') cil managed
{

Loading…
Cancel
Save