guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A Working (but Minimal) JIT


From: Noah Lavine
Subject: Re: A Working (but Minimal) JIT
Date: Sun, 28 Nov 2010 15:56:54 -0500

Hi,

> I am concerned about complexity.

I agree that complexity is a problem. I just sent an email about
Jitgen, which is something I cooked up to reduce code duplication.
However, I can't tell if it's going to end up reducing code complexity
or increasing it. What do you think?

> So what I would really like to see would be:
>
>  * Ideally, a 4-word objcode representation that includes native
>    code.

>  * A well-defined convention for that native code. That's to say that
>    the native code could come from JIT compilation, or from AOT
>    compilation.

Let me answer these together, because I think they affect each other.

I've been poking around in the code, and noticed that procs.c has a
reference to "applicable structs". As I understand it, these are
structures that can also act as procedures. Procedures with setters
are implemented this way. Is it possible to use these as containers
for JITed code, and leave the objcode format alone? (This will depend
on me learning how they work, since I don't see documentation for them
right now.)

I've been thinking about this because even if I could put JIT code in
the objcode struct now, that wouldn't make much sense for AOT compiled
code that wouldn't necessarily have or want objcode. It might be
better to pick an interface to compiled code now that would work with
AOT compiled code in the future, as you say.

>  * A uniform way to invoke native code from the VM, and VM code from
>    native code -- *preserving tail calls*. This seems to require either
>    trampolines within the VM or platform-specific tail-call assembly.

This one could be hard. I can make JITed code call the VM as a tail
call, because libjit will generate tail calls if you ask it to, but I
don't see how to get from C code to JIT code without pushing onto the
stack without either some assembly code or a trampoline. I think a
trampoline would be easier, but I will ask on the libjit mailing list
how people have solved this before.

>  * A uniform interface to create JIT code as needed, in the call
>    instructions. i.e.
>        if (SCM_UNLIKELY (SCM_NEEDS_JIT (proc)))
>          scm_jit_x (proc);
>    or something.

That seems easy enough.

Noah



reply via email to

[Prev in Thread] Current Thread [Next in Thread]