• Stars
    star
    219
  • Rank 181,133 (Top 4 %)
  • Language
    C#
  • License
    BSD 2-Clause "Sim...
  • Created almost 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Disassemble to x86/x64 ASM listing the native code generated by the JIT of a managed method.

JitBuddy Build Status NuGet

JitBuddy provides a small helper method to disassemble to a x86/x64 ASM listing the native code generated by the JIT of a managed method.

using System;
using System.Reflection;
using JitBuddy;

namespace JitBuddyExample
{
    public class Program
    {
        public static int Add(int a, int b)
        {
            return a + b;
        }
        
        static void Main()
        {
            var method = typeof(Program).GetMethod("Add", BindingFlags.Public | BindingFlags.Static);
            Console.WriteLine(method.ToAsm());
        }
   }
}

will produce the following output:

00007FFD515B3FB0 lea       eax,[rcx+rdx]
00007FFD515B3FB3 ret

Usage

Starting with .NET Core 3.0 Tiered compilation is enabled and you won't get the best ASM when running this code In order to check the assembly, you should disable tiered compilation (that will fallback to best tiered model) by setting the environment variable set COMPlus_TieredCompilation=0

var method = ...; // Get a MethodInfo via typeof(XXX).GetMethod(...)
var asm = method.ToAsm();

Caveats

  • On Linux, JitBuddy only works (for now) on CoreCLR 3.0, CoreCLR 2.0-2.2 seem to not be properly supported by ClrMd: #303

License

This software is released under the BSD-Clause 2 license.

Credits

JitBuddy is a one file simple wrapper of the following amazing library:

The Logo processor by ibrandify from the Noun Project

Author

Alexandre Mutel aka xoofx.

More Repositories

1

markdig

A fast, powerful, CommonMark compliant, extensible Markdown processor for .NET
C#
4,271
star
2

zio

A cross-platform abstract/virtual filesystem framework with many built-ins filesystems for .NET
C#
707
star
3

dotnet-releaser

Easily build, run tests and coverage, cross-compile, package and publish your .NET library or application to NuGet and GitHub.
C#
615
star
4

UnityNuGet

Provides a service to install NuGet packages into a Unity project via the Unity Package Manager
C#
572
star
5

CppAst.NET

CppAst is a .NET library providing a C/C++ parser for header files powered by Clang/libclang with access to the full AST, comments and macros
C#
352
star
6

SharpYaml

SharpYaml is a .NET library for YAML compatible with CoreCLR
C#
312
star
7

Tomlyn

Tomlyn is a TOML parser, validator and authoring library for .NET Framework and .NET Core
C#
290
star
8

kalk

kalk is a powerful command line calculator app for developers.
C#
243
star
9

Varena

Varena is a .NET library that provides a fast and lightweight arena allocator using virtual memory.
C#
121
star
10

Blake3.NET

Blake3.NET is a fast managed wrapper around the SIMD Rust implementations of the BLAKE3 cryptographic hash function.
C#
116
star
11

LibObjectFile

LibObjectFile is a .NET library to read, manipulate and write linker and executable object files (e.g ELF, DWARF, ar...)
C#
91
star
12

CppAst.CodeGen

An extensible library providing C# PInvoke codegen from C/C++ files for .NET
C#
91
star
13

git-rocket-filter

Rewrite git branches in a powerful way
C#
82
star
14

gcix

A cross-platform implementation of the Immix Garbage Collector
C++
70
star
15

ManagedJit

Prototype of writing a managed JIT in C# with CoreCLR
C++
68
star
16

NWindows

NWindows is a cross-platform window creation and management library for .NET
C#
67
star
17

grpc-curl

grpc-curl is a command line tool for interacting with gRPC servers
C#
66
star
18

Broslyn

A lightweight utility library to create a Roslyn AdhocWorkspace from an existing solution or a csproj
C#
55
star
19

SharpScss

A portable cross-platform pinvoke .NET wrapper around libsass to convert SCSS to CSS
C#
52
star
20

Antlr4Ast

Antlr4Ast is a .NET library that provides a parser and abstract syntax tree (AST) for ANTLR4/g4 files.
C#
43
star
21

Monocypher.NET

.NET wrapper around the cryptographic library Monocypher https://monocypher.org/
C#
40
star
22

SharpDoc

SharpDoc is a documentation tool to generate HTML documentation for .NET projects
C#
39
star
23

SharpNng

SharpNng is a lightweight low-level managed wrapper around the Lightweight Messaging Library NNG
C#
37
star
24

SuperluminalPerf

SuperluminalPerf is a small .NET managed wrapper around the Superluminal PerformanceAPI.
C#
33
star
25

NPlug

Develop VST3 audio native plugins with .NET
C#
30
star
26

GitLib.NET

GitLib.NET is a bare metal P/Invoke wrapper around libgit2 for .NET
C#
28
star
27

jsonite

A lightweight, fast and compliant JSON serializer/deserializer/validator for .NET
C#
20
star
28

SharpRazor

A lightweight templating system using Razor
C#
19
star
29

smash

Smash provides a collection of non-cryptographic hashes for .NET
C#
15
star
30

XelaBuild

Playground for testing msbuild in a "server" mode
C#
15
star
31

SharpDiff

A fork of https://difflib.codeplex.com/
C#
13
star
32

NTar

A single file C# file to untar file entries from a tar stream.
C#
11
star
33

SharpPdbPatcher

A library/console program to replace source paths stored in a .NET PDB file
C#
9
star
34

AnalyzerPack

Repackage your current project as a Diagnostic Analyzer NuGet package
PowerShell
9
star
35

YamlSerializer

Fork of https://yamlserializer.codeplex.com/
C#
8
star
36

xoofx.github.io

Repository of my blog
HTML
7
star
37

NPlug.Samples

Samples for creating VST3 audio native plugins with NPlug and .NET7+/NativeAOT.
C#
7
star
38

BenchNativeApp

A small suite of micro-benchmarks for testing .NET Native and RyuJIT
C#
4
star
39

MarkdigAutoEmail

C#
3
star
40

dotnet-repo-xoofx

My .NET project/solution template.
C#
3
star
41

draytek-watcher

Daemon to reboot the WAN interface of a DrayTek router if it looks down
C#
2
star
42

scoop-kalk

Scoop repository for https://github.com/xoofx/kalk.
1
star
43

RoslynErrorApp

Repro project failing to run with Roslyn + .NET 5 installed
C#
1
star
44

homebrew-grpc-curl

Homebrew repository for https://github.com/xoofx/grpc-curl
Ruby
1
star
45

SharpDX.Toolkit.Game.Direct2D

Provides Direct2D and DirectWrite to Toolkit's Game class
C#
1
star
46

scoop-grpc-curl

Scoop repository for https://github.com/xoofx/grpc-curl.
1
star
47

atlassian.net-sdk

Fork of atlassian.net-sdk from bitbucket to test the JIRA REST API
C#
1
star