Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO-NOT-MERGE: libgccjit experiment (work-in-progress) #109

Open
wants to merge 4 commits into
base: v0_master
Choose a base branch
from

Conversation

davidmalcolm
Copy link

@davidmalcolm davidmalcolm commented Aug 27, 2020

Inspired by Vladimir's talk at LPC, this is a proof-of-concept of populating a libgccjit context from a MIR module, and then compiling it with libgccjit.

This could allow for libgccjit to be used as a tier 2 JIT compiler in conjunction with MIR for tier 1.

Additionally, Vladimir's talk identified a weakness of libgccjit: the difficult of creating the environment through the API. With this approach, C could be compiled to MIR, and then injected into libgccjit.

Right now it's a very rough proof-of-concept that only implements a few instructions and modes. I'm posting it now in order to get early feedback. In particular it doesn't yet support forward references. But it does support compiling trivial binary mir files via libgccjit.

Given that you don't want external deps, I'm not sure where this should ultimately live. Also, I used C++ to simplify the implementation, but could recode it in C if that's a deal-breaker.

Inspired by Vladimir's talk at LPC, this is a proof-of-concept of
populating a libgccjit context from a MIR module, and then
compiling it with libgccjit.

This could allow for libgccjit to be used as a tier 2 JIT compiler
in conjunction with MIR for tier 1.

Additionally, Vladimir's talk identified a weakness of libgccjit:
the difficult of creating the environment through the API.  With
this approach, C could be compiled to MIR, and then injected into
libgccjit.

Right now it's a very rough proof-of-concept that only implements
a few instructions and modes.  In particular it doesn't yet support
forward references.  But it does support compiling trivial binary
mir files via libgccjit.

Given that you don't want external deps, I'm not sure where this
should ultimately live.  Also, I used C++ to simplify the
implementation, but could recode it in C if that's a deal-breaker.
@davidmalcolm
Copy link
Author

I should also say that this is the first time I've looked in detail at mir, so I've no doubt misunderstood some things.

@vnmakarov
Copy link
Owner

Thank you, David! I really appreciate your work. I'll will definitely experiment with this code and I hope in some way MIR->libgccjit will be used in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants