Last week, I've written a small trace compiler (at least a kind of) for phpreboot.
For those who did not attend to last JVM Summit, here is the basics:
http://wiki.jvmlangsummit.com/Trace-based_JIT

In my case, phpr is an interpreter written in Java.
it basically parses an instruction or a block, create the corresponding AST
and interpret it by walking on the AST.
It also comes with a compiler that transform function and lambda
directly into bytecode.
I use JSR292 method handles to jump back and forth between the interpreter
and the compiled code.

During last week, I've written a trace compiler which compile a while loop
during its execution. I've added a counter that count each iteration
and when the counter overflow, it compiles the test of the loop
and its body into a bytecode blob and execute it.
Furthermore, during the first runs, I record the runtime type of the variables
so when I generate the loop body, I use these information to specialize
the generated bytecode (mainly in order to remove all boxing).
And it works very well !

I wonder if someone had already tried to do the same with its own JVM Language ?

For the curious, the source are here:
http://code.google.com/p/phpreboot/source/browse/trunk/phpreboot/src/com/googlecode/phpreboot/compiler <http://code.google.com/p/phpreboot/source/browse/trunk/phpreboot/src/com/googlecode/phpreboot/compiler/Compiler.java>

Rémi


--
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en.

Reply via email to