Asmjit - JIT asm compiler (for C++)

Sandeep Kakarlapudi sandeep.iitkgpspammenot at gmail.com
Tue Feb 3 01:49:52 PST 2009


Bill Baxter Wrote:
> Interesting.  Seems like this idea is popping up all over the place
> these days.  I think the MESA OpenGL guys were doing something like
> this to support shaders, too.  I also could have sworn I read
> something about Jitting things in some Qt graphics framework.  But I
> can't find anything about either at the moment.  And for some reason
> something about Apple+LLVM+JIT also is tumbling around in my mind.
> 
> --bb

Code JIT-ing is very common when dealing which shaders because shaders essentially are hot inner loops. Even when executing shaders on GPUs the shaders are often JIT optimized - if the optimized code is 1 instruction less it still is huge savings. 

Here's are some slides on using LLVM for OpenGL : http://llvm.org/devmtg/2007-05/10-Lattner-OpenGL.pdf
What they seem to be doing is achieving compilation by specializing the glsl interpreter for each shader using the LLVM optimizer. ( See: http://en.wikipedia.org/wiki/Partial_evaluation ) This leads to more maintainable code and still produces optimal machine code. 

While runtime assemblers do have some benefit I think ultimately run-time specialization kind of approaches will have wider adoption because of ease of maintenance. The programmer does not have to master the ISA of the CPU. So having it as part of the standard library would certainly accelerate the adoption! 

Sandeep



More information about the Digitalmars-d mailing list