Created
May 17, 2022 19:13
-
-
Save nodakai/a5eab805c539c45048b4072fa7b096c5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
let f(os: Option<string>) = | |
match os with Some(s) -> s.AsSpan() | |
| None -> raise(Exception()) | |
ReadOnlySpan.Empty | |
let g(os: Option<string>) = | |
let s = match os with Some(s) -> s | |
| None -> raise(Exception()) | |
s.AsSpan() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.assembly _ | |
{ | |
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, int32, int32) = ( | |
01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 | |
) | |
.hash algorithm 0x00008004 // SHA1 | |
.ver 0:0:0:0 | |
} | |
.class private auto ansi '<Module>' | |
extends [System.Runtime]System.Object | |
{ | |
} // end of class <Module> | |
.class public auto ansi abstract sealed _ | |
extends [System.Runtime]System.Object | |
{ | |
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( | |
01 00 07 00 00 00 00 00 | |
) | |
// Methods | |
.method public static | |
valuetype [System.Runtime]System.ReadOnlySpan`1<char> f ( | |
class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1<string> os | |
) cil managed | |
{ | |
// Method begins at RVA 0x2050 | |
// Code size 43 (0x2b) | |
.maxstack 4 | |
.locals init ( | |
[0] class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1<string> | |
) | |
IL_0000: ldarg.0 | |
IL_0001: brtrue.s IL_0005 | |
IL_0003: br.s IL_0013 | |
IL_0005: ldarg.0 | |
IL_0006: stloc.0 | |
IL_0007: ldloc.0 | |
IL_0008: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1<string>::get_Value() | |
IL_000d: call valuetype [System.Runtime]System.ReadOnlySpan`1<char> [System.Memory]System.MemoryExtensions::AsSpan(string) | |
IL_0012: ret | |
IL_0013: ldc.i4.0 | |
IL_0014: brfalse.s IL_001e | |
IL_0016: ldnull | |
IL_0017: unbox.any [FSharp.Core]Microsoft.FSharp.Core.Unit | |
IL_001c: br.s IL_0024 | |
IL_001e: newobj instance void [System.Runtime]System.Exception::.ctor() | |
IL_0023: throw | |
IL_0024: pop | |
IL_0025: call valuetype [System.Runtime]System.ReadOnlySpan`1<!0> valuetype [System.Runtime]System.ReadOnlySpan`1<char>::get_Empty() | |
IL_002a: ret | |
} // end of method _::f | |
.method public static | |
valuetype [System.Runtime]System.ReadOnlySpan`1<char> g ( | |
class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1<string> os | |
) cil managed | |
{ | |
// Method begins at RVA 0x2088 | |
// Code size 25 (0x19) | |
.maxstack 8 | |
IL_0000: ldarg.0 | |
IL_0001: brtrue.s IL_0005 | |
IL_0003: br.s IL_000d | |
IL_0005: ldarg.0 | |
IL_0006: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1<string>::get_Value() | |
IL_000b: br.s IL_0013 | |
IL_000d: newobj instance void [System.Runtime]System.Exception::.ctor() | |
IL_0012: throw | |
IL_0013: call valuetype [System.Runtime]System.ReadOnlySpan`1<char> [System.Memory]System.MemoryExtensions::AsSpan(string) | |
IL_0018: ret | |
} // end of method _::g | |
} // end of class _ | |
.class private auto ansi abstract sealed '<StartupCode$_>.$_' | |
extends [System.Runtime]System.Object | |
{ | |
} // end of class <StartupCode$_>.$_ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": 1, | |
"target": "IL", | |
"mode": "Release", | |
"branch": "core-x64" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment