Skip to content

Instantly share code, notes, and snippets.

@dgrunwald
Created October 13, 2017 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgrunwald/fa35f8ea2bf48a2c20c2a9a8a5d88921 to your computer and use it in GitHub Desktop.
Save dgrunwald/fa35f8ea2bf48a2c20c2a9a8a5d88921 to your computer and use it in GitHub Desktop.
.assembly extern System.Runtime
{
.publickeytoken = (
b0 3f 5f 7f 11 d5 0a 3a
)
.ver 4:2:0:0
}
.assembly extern System.Console
{
.publickeytoken = (
b0 3f 5f 7f 11 d5 0a 3a
)
.ver 4:1:0:0
}
.assembly core
{
.custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = (
01 00 08 00 00 00 00 00
)
.custom instance void [System.Runtime]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = (
01 00 01 00 54 02 16 57 72 61 70 4e 6f 6e 45 78
63 65 70 74 69 6f 6e 54 68 72 6f 77 73 01
)
.custom instance void [System.Runtime]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggableAttribute/DebuggingModes) = (
01 00 02 00 00 00 00 00
)
.custom instance void [System.Runtime]System.Runtime.Versioning.TargetFrameworkAttribute::.ctor(string) = (
01 00 18 2e 4e 45 54 43 6f 72 65 41 70 70 2c 56
65 72 73 69 6f 6e 3d 76 32 2e 30 01 00 54 0e 14
46 72 61 6d 65 77 6f 72 6b 44 69 73 70 6c 61 79
4e 61 6d 65 00
)
.custom instance void [System.Runtime]System.Reflection.AssemblyCompanyAttribute::.ctor(string) = (
01 00 04 63 6f 72 65 00 00
)
.custom instance void [System.Runtime]System.Reflection.AssemblyConfigurationAttribute::.ctor(string) = (
01 00 07 72 65 6c 65 61 73 65 00 00
)
.custom instance void [System.Runtime]System.Reflection.AssemblyFileVersionAttribute::.ctor(string) = (
01 00 07 31 2e 30 2e 30 2e 30 00 00
)
.custom instance void [System.Runtime]System.Reflection.AssemblyInformationalVersionAttribute::.ctor(string) = (
01 00 05 31 2e 30 2e 30 00 00
)
.custom instance void [System.Runtime]System.Reflection.AssemblyProductAttribute::.ctor(string) = (
01 00 04 63 6f 72 65 00 00
)
.custom instance void [System.Runtime]System.Reflection.AssemblyTitleAttribute::.ctor(string) = (
01 00 04 63 6f 72 65 00 00
)
.hash algorithm 0x00008004 // SHA1
.ver 1:0:0:0
}
.module core.dll
// MVID: {7B92C265-58A9-44EE-8B3D-B3B058CDA4C1}
.corflags 0x00000001 // ILOnly
.class private auto ansi '<Module>'
{
} // end of class <Module>
.class private auto ansi beforefieldinit core.Program
extends [System.Runtime]System.Object
{
// Methods
.method private hidebysig static
void Main (
string[] args
) cil managed
{
// Method begins at RVA 0x2048
// Code size 11 (0xb)
.maxstack 8
.entrypoint
IL_0000: ldc.i4 0x7fffffff
call native int core.Program::Int32OrNative(int32)
box native int
IL_0005: call void [System.Console]System.Console::WriteLine(object)
IL_000a: ret
} // end of method Program::Main
.method public hidebysig specialname rtspecialname
instance void .ctor () cil managed
{
// Method begins at RVA 0x2054
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [System.Runtime]System.Object::.ctor()
IL_0006: ret
} // end of method Program::.ctor
.method public static native int Int32OrNative(int32 val)
{
.locals init (bool v)
ldc.i4.0
// Toggle these two comments to change the behavior:
//stloc.0
//ldloc.0
brtrue use_native_int
use_i4:
ldarg.0
br after_if
// IL evaluation stack here is [int32] if coming from use_i4,
// or [native int] if coming from use_native_int.
after_if:
ldc.i4.1
add // is this a 32-bit addition or native int addition?
ret
use_native_int:
// unreachable code block pushing 'native int',
// but the runtime only knows it's unreachable if we
// don't have the stloc/ldloc pair above
ldarg.0
conv.u
br after_if
}
} // end of class core.Program
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment