Skip to content

Instantly share code, notes, and snippets.

@smoogipoo
Created December 22, 2022 07:05
Show Gist options
  • Save smoogipoo/612287ba15e37c0ef1950520fe8b2b96 to your computer and use it in GitHub Desktop.
Save smoogipoo/612287ba15e37c0ef1950520fe8b2b96 to your computer and use it in GitHub Desktop.
using System;
public class C {
public void M(object obj) {
if (obj == null)
throw new ArgumentNullException("obj");
}
public void N(object obj) {
if (obj == null)
throw new ArgumentNullException(nameof(obj));
}
public void O(object obj) {
ArgumentNullException.ThrowIfNull(obj);
}
}
@smoogipoo
Copy link
Author

; Core CLR 7.0.22.51805 on x86

C..ctor()
    L0000: ret

C.M(System.Object)
    L0000: push esi
    L0001: test edx, edx
    L0003: je short L0007
    L0005: pop esi
    L0006: ret
    L0007: mov ecx, 0xa5903c8
    L000c: call 0x068a300c
    L0011: mov esi, eax
    L0013: mov ecx, 1
    L0018: mov edx, 0x1efbc030
    L001d: call 0x72052690
    L0022: mov edx, eax
    L0024: mov ecx, esi
    L0026: call dword ptr [0xa5a1348]
    L002c: mov ecx, esi
    L002e: call 0x71ff4cf0
    L0033: int3

C.N(System.Object)
    L0000: push esi
    L0001: test edx, edx
    L0003: je short L0007
    L0005: pop esi
    L0006: ret
    L0007: mov ecx, 0xa5903c8
    L000c: call 0x068a300c
    L0011: mov esi, eax
    L0013: mov ecx, 1
    L0018: mov edx, 0x1efbc030
    L001d: call 0x72052690
    L0022: mov edx, eax
    L0024: mov ecx, esi
    L0026: call dword ptr [0xa5a1348]
    L002c: mov ecx, esi
    L002e: call 0x71ff4cf0
    L0033: int3

C.O(System.Object)
    L0000: test edx, edx
    L0002: je short L0005
    L0004: ret
    L0005: mov ecx, 1
    L000a: mov edx, 0x1efbc030
    L000f: call 0x72052690
    L0014: mov ecx, eax
    L0016: call dword ptr [0xa5a13f0]
    L001c: int3

Microsoft.CodeAnalysis.EmbeddedAttribute..ctor()
    L0000: ret

System.Runtime.CompilerServices.NullableAttribute..ctor(Byte)
    L0000: push esi
    L0001: push ebx
    L0002: mov esi, ecx
    L0004: mov ebx, edx
    L0006: mov ecx, 0xa56ca3c
    L000b: mov edx, 1
    L0010: call 0x068a319c
    L0015: mov [eax+8], bl
    L0018: lea edx, [esi+4]
    L001b: call 0x06870008
    L0020: pop ebx
    L0021: pop esi
    L0022: ret

System.Runtime.CompilerServices.NullableAttribute..ctor(Byte[])
    L0000: mov eax, edx
    L0002: lea edx, [ecx+4]
    L0005: call 0x06870008
    L000a: ret

System.Runtime.CompilerServices.NullableContextAttribute..ctor(Byte)
    L0000: mov [ecx+4], dl
    L0003: ret

System.Runtime.CompilerServices.RefSafetyRulesAttribute..ctor(Int32)
    L0000: mov [ecx+4], edx
    L0003: ret

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment