Skip to content

Instantly share code, notes, and snippets.

@mattwarren
Last active August 29, 2015 14:06
Show Gist options
  • Save mattwarren/02ca1567cecbd6ea68a0 to your computer and use it in GitHub Desktop.
Save mattwarren/02ca1567cecbd6ea68a0 to your computer and use it in GitHub Desktop.
; 70: var watch = new Stopwatch();
000000b4 lea rcx,[5D3BB7F0h]
000000bb call 000000005F642050
000000c0 mov r12,rax
000000c3 mov rcx,r12
000000c6 call 000000005D254C50
000000cb movzx eax,byte ptr [r12+18h] ; The call to watch.Start() has been in-lined
000000d1 test eax,eax
000000d3 jne 00000000000000E5
000000d5 call 000000005D264320
000000da mov qword ptr [r12+10h],rax
000000df mov byte ptr [r12+18h],1
; 72: for (int i = 0; i < iterations; i++)
000000e5 mov r13d,dword ptr [rbp+60h]
000000e9 test r13d,r13d
000000ec jle 0000000000000102
000000ee xor edi,edi
000000f0 mov rbx,qword ptr [rbp+58h]
; 73: {
; 74: action();
000000f4 mov rcx,qword ptr [rbx+8]
000000f8 call qword ptr [rbx+18h] ; call action();
; 72: for (int i = 0; i < iterations; i++)
000000fb inc edi
000000fd cmp edi,r13d
00000100 jl 00000000000000F4
; 75: }
; 76: watch.Stop();
00000102 mov rcx,r12
00000105 call 000000005D2FC930
; 77: Console.WriteLine(description + " (Profile)");
; Contents of action() from JITterOptimisations\Program.cs
; 37: Profile("SimpleTest", numIterations, () => Math.Sqrt(124));
00000000 ret
; NOTE that Math.Sqrt has been optimised away completely!!
; So action() is called, but it's an empty method that does NOTHING
; The code we passed in, inside action() is never exectued!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment