Fully Interruptible version (compared to the Partially Interruptible one)
public static long TestMethod()
{
long counter = 0;
for (int i = 0; i < 1000 * 1000; i++)
{
for (int j = 0; j < 2000; j++)
{
if (i % 10 == 0)
counter++;
}
}
Console.WriteLine("Loop exited, counter = {0:N0}", counter);
return counter;
}Compiling 32 ConsoleApplication.Program::TestMethod, IL size = 64, hsh=0xe6099ccc
; Assembly listing for method ConsoleApplication.Program:TestMethod():long
; Emitting BLENDED_CODE for X64 CPU with AVX
; optimized code
; rsp based frame
; fully interruptible
; Final local variable assignments
;
; V00 loc0 [V00,T04] ( 5, 19 ) long -> rsi
; V01 loc1 [V01,T02] ( 6, 33 ) int -> rcx
; V02 loc2 [V02,T01] ( 4, 52 ) int -> r8
; V03 tmp0 [V03,T05] ( 3, 6 ) ref -> rax
; V04 tmp1 [V04,T00] ( 3, 96 ) int -> rdx
; V05 tmp2 [V05,T06] ( 2, 4 ) ref -> rcx
; V06 tmp3 [V06,T07] ( 2, 4 ) ref -> rdx
; V07 OutArgs [V07 ] ( 1, 1 ) lclBlk (32) [rsp+0x00]
; V08 cse0 [V08,T03] ( 2, 20 ) int -> rax
;
; Lcl frame size = 32
G_M25395_IG01:
000000 56 push rsi
000001 4883EC20 sub rsp, 32
G_M25395_IG02:
000005 33F6 xor rsi, rsi
000007 33C9 xor ecx, ecx
G_M25395_IG03:
000009 4533C0 xor r8d, r8d
00000C B867666666 mov eax, 0x66666667
000011 F7E9 imul edx:eax, ecx
000013 8BC2 mov eax, edx
000015 C1F802 sar eax, 2
G_M25395_IG04:
000018 8BD0 mov edx, eax
00001A 448BCA mov r9d, edx
00001D 41C1E91F shr r9d, 31
000021 4103D1 add edx, r9d
000024 8D1492 lea edx, [rdx+4*rdx]
000027 D1E2 shl edx, 1
000029 448BC9 mov r9d, ecx
00002C 442BCA sub r9d, edx
00002F 4585C9 test r9d, r9d
000032 7503 jne SHORT G_M25395_IG05
000034 48FFC6 inc rsi
G_M25395_IG05:
000037 41FFC0 inc r8d
00003A 4181F8D0070000 cmp r8d, 0x7D0
000041 7CD5 jl SHORT G_M25395_IG04
G_M25395_IG06:
000043 FFC1 inc ecx
000045 81F940420F00 cmp ecx, 0xF4240
00004B 7CBC jl SHORT G_M25395_IG03
G_M25395_IG07:
00004D 48B920F80BCFFE070000 mov rcx, 0x7FECF0BF820
000057 E8E4C0ED5E call CORINFO_HELP_NEWFAST
00005C 488B0C258030A012 mov rcx, gword ptr [12A03080H] '
Thread loop exited cleanly, counter = {0:N0}'
000064 48897008 mov qword ptr [rax+8], rsi
000068 488BD0 mov rdx, rax
00006B E8F0D0FFFF call System.Console:WriteLine(ref,ref)
000070 488BC6 mov rax, rsi
G_M25395_IG08:
000073 4883C420 add rsp, 32
000077 5E pop rsi
000078 C3 ret
; Total bytes of code 121, prolog size 5 for method ConsoleApplication.Program:TestMethod():long
; ============================================================Set code length to 121.
Set Outgoing stack arg area size to 32.
Register slot id for reg rax = 0.
Register slot id for reg rcx = 1.
Register slot id for reg rdx = 2.
Set state of slot 0 at instr offset 0x5c to Live.
Set state of slot 1 at instr offset 0x64 to Live.
Set state of slot 2 at instr offset 0x6b to Live.
Set state of slot 0 at instr offset 0x70 to Dead.
Set state of slot 1 at instr offset 0x70 to Dead.
Set state of slot 2 at instr offset 0x70 to Dead.
Defining interruptible range: [0x5, 0x73).