Skip to content

Instantly share code, notes, and snippets.

@atifaziz

atifaziz/OptupleCost.cs

Last active Aug 15, 2020
Embed
What would you like to do?
using System;
public class C {
public void M((bool, object) x) {
if (x is (true, {} obj)) {
Console.WriteLine(obj);
}
}
public void N(bool f, object obj) {
if (f) {
Console.WriteLine(obj);
}
}
}
; Core CLR v4.700.20.26901 on amd64
C..ctor()
L0000: ret
C.M(System.ValueTuple`2<Boolean,System.Object>)
L0000: cmp byte ptr [rdx+8], 0
L0004: je short L001b
L0006: mov rcx, [rdx]
L0009: test rcx, rcx
L000c: je short L001b
L000e: mov rax, System.Console.WriteLine(System.Object)
L0018: jmp rax
L001b: ret
C.N(Boolean, System.Object)
L0000: test dl, dl
L0002: je short L0014
L0004: mov rcx, r8
L0007: mov rax, System.Console.WriteLine(System.Object)
L0011: jmp rax
L0014: ret
{
"version": 1,
"target": "JIT ASM",
"mode": "Release",
"branch": "core-x64"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment