Skip to content

Hook JIT compiler at runtime and replace in .Net Core

License

Notifications You must be signed in to change notification settings

20chan/CoreCLRCustomJIT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CoreCLRCustomJIT

WIP

This project hook JIT compiler at runtime and replace it, so you could hook compiling method and modify its compiled result - machine code.

Example

void Main() {
    var jit = new JIT();
    jit.HookMethod(this.GetType().GetMethod(nameof(One)), code => {
        // Makes return data of method `One` 1 to 2
        Marshal.WriteByte(code, 37, 2);
    });

    if (jit.Hook()) {
        Console.WriteLine(One()); // 2
    }
}

int One() {
    return 1;
}

References

xoofx's awesome post

About

Hook JIT compiler at runtime and replace in .Net Core

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages