Re: Managing the JIT

Aleksey Demakov <>
Fri, 7 Aug 2009 12:14:12 +0700

          From comp.compilers

Related articles
[7 earlier articles]
Re: Managing the JIT (Armel) (2009-07-29)
Re: Managing the JIT (BGB / cr88192) (2009-07-30)
Re: Managing the JIT (Armel) (2009-07-31)
Re: Managing the JIT (Barry Kelly) (2009-08-01)
Re: Managing the JIT (BGB / cr88192) (2009-08-02)
Re: Managing the JIT (BGB / cr88192) (2009-08-02)
Re: Managing the JIT (Aleksey Demakov) (2009-08-07)
Re: Managing the JIT (BGB / cr88192) (2009-08-08)
| List of all articles for this month |

From: Aleksey Demakov <>
Newsgroups: comp.compilers
Date: Fri, 7 Aug 2009 12:14:12 +0700
Organization: Compilers Central
References: 09-07-079 09-07-086 09-07-087
Keywords: incremental
Posted-Date: 07 Aug 2009 09:46:31 EDT

On Sat, Jul 25, 2009 at 9:34 AM, Philip
Herron<> wrote:
> Is it more each time a new function called it is jit'd then you would
> keep this is memory so there is no output, it must be pretty
> complicated in managing all this new code this, and then how do you
> decide what to jit, as in do you just jit function by function, or a
> set of calls at a time. Thats more the languages problem i guess. Then
> if your keeping all the code in memory, how do you exeucute each bit
> of jitted it code is each piece of a code into a new stack frame and
> executed like a thread or is it less complicated? Maybe you can
> directly load the raw binary or something.

Usually a JIT compiles functions on demand.

That is when it sees a call to a function that has not been compiled
yet it generates a "trampoline" for this function. The trampoline is a
small bit of generic code that does these things:

1) invokes the JIT compiler for the function in question;
2) upon compilation jumps to the newly generated binary code in RAM;
3) patches the call site so that all further calls go
directly to the binary code.

This way the function is compiled the first time it needs to be
executed. And if a function is never executed it never compiled and
JIT even never looks at its source/byte code.

Advanced JITs that employ inter-procedural analysis and optimization
might need to look at a function before it is executed, but I guess
they mostly do it also only on demand, when they find that some piece
of code is a "hot-spot" - it is executed many many times. So in re

Besides, if you would like to take a look at something easier to
comprehend than llvm, you might want to take a look at libjit.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.