Skip to content

Instantly share code, notes, and snippets.

View AndyAyersMS's full-sized avatar

Andy Ayers AndyAyersMS

  • Microsoft
  • Redmond, WA, USA
View GitHub Profile
I had hoped to forward some documents based on past work to build interprocedural analysis (IPA) in systems like Bartok/Phoenix, but didn’t find anything that was both accurate and concise.
So here’s a sketch of how the system could (and I would argue, should) be built. UTC/NUTC does something fairly similar.
First, some goals
• Support concurrency where possible, since IPA instances can be quite large
• Support partitioning (dividing input set into two or more parts, analyzing each separately)
• Allow pluggable components for particular problem domains
• Keep procedural knowledge suitably compartmentalized, avoid duplication (eg don’t have multiple type systems or multiple IL analyzers)
using System;
using System.Collections.Generic;
using System.IO;
enum State
{
Before,
Method,
Class,
Namespace
@AndyAyersMS
AndyAyersMS / simple repro for 37082
Created August 14, 2020 00:16
simple repro for 37082
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using System.Runtime.InteropServices;
public class Assert
{
[MethodImpl(MethodImplOptions.NoInlining)]
@AndyAyersMS
AndyAyersMS / clr.log
Created June 4, 2020 01:32
CLR Log for runtime issue 13720
TID 6c88: { =========== BEGINGC 2859, (requested generation = 1, collect_classes = 1) ==========
TID 6c88: GC Heap 0000000000000000
TID 6c88: Generation 2 [000001A181411000, 0000000000000000] cur = 0000000000000000
TID 6c88: Segment mem 000001A181411000 alloc = 000001A181571850 used 000001A181573860 committed 000001A181582000
TID 6c88: Generation 1 [000001A181571820, 0000000000000000] cur = 0000000000000000
TID 6c88: Segment mem 000001A181411000 alloc = 000001A181571850 used 000001A181573860 committed 000001A181582000
TID 6c88: Generation 0 [000001A181571838, 0000000000000000] cur = 0000000000000000
TID 6c88: Segment mem 000001A181411000 alloc = 000001A181571850 used 000001A181573860 committed 000001A181582000
TID 6c88: GCScan: Promotion Phase = 1
TID 6c88: { Starting scan of Thread 000001A1FEC426B0 ID = 1
using System;
using System.Diagnostics.Tracing;
using System.Runtime.CompilerServices;
using System.Threading;
class JitEventListener : EventListener
{
const int JitKeyword = 0x00000010;
const int VerboseMethodLoadId = 143;
static bool first = true;
@AndyAyersMS
AndyAyersMS / ex.base.d
Created March 5, 2020 19:03
Jit dumps for simple repro case in dotnet/runtime#33098
c:\repos\runtime4\artifacts\tests\coreclr\Windows_NT.x86.release\Tests\Core_Root\corerun.exe ex.exe
Compiling 0 CastHelpers::StelemRef, IL size = 86, hash=0x93aaa786 FullOpts
Compiling 1 CastHelpers::LdelemaRef, IL size = 42, hash=0xffd2fc9e FullOpts
Compiling 2 SpanHelpers::IndexOf, IL size = 705, hash=0xdb3370c7 FullOpts
Compiling 3 Utf16Utility::GetPointerToFirstInvalidChar, IL size = 972, hash=0x137a51fe FullOpts
Compiling 4 Vector128::CreateScalarUnsafe, IL size = 21, hash=0xcd46d192 FullOpts
Compiling 5 Vector128::AsUInt32, IL size = 7, hash=0x8f8eda53 FullOpts
Compiling 6 Vector128::AsUInt16, IL size = 7, hash=0x7bc35b55 FullOpts
Compiling 7 Vector128::AsByte, IL size = 7, hash=0x9ea1d9de FullOpts
Compiling 8 Sse41::get_IsSupported, IL size = 6, hash=0x6da8cf37 FullOpts
@AndyAyersMS
AndyAyersMS / R2R.txt
Created February 13, 2020 09:11
Codegen Diff Summary for dotnet/runtime#31968
Found 31 files with textual diffs.
Summary of Code Size diffs:
(Lower is better)
Total bytes of diff: -1224 (-0.00% of base)
diff is an improvement.
Total byte diff includes 17 bytes from reconciling methods
Base had 1 unique methods, 80 unique bytes
@AndyAyersMS
AndyAyersMS / 22r.dasm
Last active August 1, 2019 19:03
Jit Dasm and Dumps for coreclr#25876
E:\repos\coreclr22\bin\tests\Windows_NT.x86.Release\Tests\Core_Root\corerun.exe ex.exe
; Assembly listing for method SpanHelpers:SequenceCompareTo(byref,int,byref,int):int
; Emitting BLENDED_CODE for generic X86 CPU
; optimized code
; ebp based frame
; fully interruptible
; Final local variable assignments
;
; V00 arg0 [V00,T06] ( 3, 6 ) byref -> ecx
; V01 arg1 [V01,T07] ( 5, 3.75) int -> edx ld-addr-op
@AndyAyersMS
AndyAyersMS / bench.cs
Last active March 13, 2019 18:53
AwaitUnsafeOnCompletion Tiering Benchmark
using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Engines;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
@AndyAyersMS
AndyAyersMS / corelib-new.csv
Created June 28, 2018 21:17
Assertion Prop Usage Data
We can't make this file beautiful and searchable because it's too large.
Count,Duped,Total,Dropped,Max,Used,TotalUse,Blocks,Stmts,Trees,ILSize,InlSize,EqCount,EqUsed,EqTotalUse,NeCount,NeUsed,NeTotalUse,SuCount,SuUsed,SuTotalUse,NtCount,NtUsed,NtTotalUse
1,0,1,0,64,0,0,1,1,5,7,290,0,0,0,1,0,0,0,0,0,0,0,0
1,0,1,0,64,0,0,1,2,7,14,450,0,0,0,1,0,0,0,0,0,0,0,0
9,1,9,0,64,3,3,8,14,92,35,929,3,0,0,6,3,3,0,0,0,0,0,0
4,1,4,0,64,1,1,3,6,56,29,792,1,0,0,3,1,1,0,0,0,0,0,0
1,0,1,0,64,0,0,5,34,173,77,1886,0,0,0,1,0,0,0,0,0,0,0,0
4,0,4,0,64,0,0,6,12,109,63,2249,2,0,0,2,0,0,0,0,0,0,0,0
0,0,0,0,64,0,0,3,7,34,53,1339,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,64,0,0,1,4,27,24,678,0,0,0,0,0,0,0,0,0,0,0,0
1,0,1,0,64,0,0,10,15,75,93,2251,0,0,0,0,0,0,1,0,0,0,0,0