[LLVMdev] Scheme + LLVM JIT

Alexander Friedman alex at inga.mit.edu
Wed May 4 20:59:06 PDT 2005


Hi List,

I am in the preliminary stages of adding a JIT compiler to a sizable
Scheme system (PLT Scheme). The original plan was to use GNU
Lightning, but 1) it seems to be dead, and 2) LLVM has already done a
huge amount of stuff that I would have had to write (poorly) from
scratch.

At the moment, LLVM seems to be the ideal choice for implementing the
Scheme JIT, but there are problems that need to be addressed first. I
hope you guys can help me with these - I'll list them in descending
order of importance.


Tail Call Elimination:

 I've read over the "Random llvm notes", and see that you guys have
 though about this already.
 
 However, the note dates from last year, so I am wondering if there is
 an implementation in the works. If no one is working on this or is
 planning to work on this in the near future, I would be willing to
 give it a shot if I was given some direction as to where to start.

 Explicitly managed stack frames would also be nice, but are not a
 necessity unlike the mixed calling conventions and tail call
 elimination. For all of you who are wondering about call/cc, we
 currently implement it via stack copying (and will continue to), so I
 am not worried about llvm not having a representation for
 continuations.

JIT + Optimization interactions:

 I have looked over the JIT documentation (which is a bit sparse) and
 the examples. So far I am completely unclear as to what the JIT
 compiler actually does with the code that is passed to it.

 To be more precise, does the JIT perform all of the standard llvm
 optimizations on the code, or does it depend on it's client to do so
 himself? Are there some examples of that?

 If it does indeed optimize the input, does it attempt to do global
 optimizations on the functions (intraprocedural register allocation,
 inlining, whatever)?

 Does it re-do these optimizations when functions are added/ removed/
 changed? Are there parameters to tune the compiler's aggressiveness?

C-Interface:

 Does there happen to be a C interface to the jit ? Our scheme impl
 has a good FFI, but it doesn't do C++. If not, this is no big deal,
 and i'll just write something myself.

Size of Distro/ Compilation Speed

 While the sources of llvm are not that big, the project builds very
 slowly into something very large. Someone already asked about what is
 the minimum needed for just a JIT compiler, and I think I have a
 vague idea of what needs to tweaked. However, I want to minimize the
 changes I make to my llvm tree. I know that no one can make g++ run
 any faster, but part of the speed problem and resulting size of the
 compilation is that the configure script seems to ignore my
 directives. For examle, it always builds all architectures, and it
 always statically links each binary.


Well, that's all I can think of for now. Any help will be greatly
appreciated :)

--

-Alex




More information about the llvm-dev mailing list