A benefit of using LLVM for JIT compilation

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

A benefit of using LLVM for JIT compilation

Dibyendu Majumdar
Obviously the biggest benefit is that there is an army of engineers
working on LLVM, from Google, Apple, IBM, and even Microsoft
now-a-days. This means that one is relying on the collective power of
so many engineers.

The other benefit seems to me the resulting simplicity of the JIT
implementation in Ravi. I don't know how Lua code size is measured but
here is a simplistic estimate of the number of lines of code that is
in Ravi for implementing the JIT compiler:

wc -l include/ravi_llvm*.h src/ravi_llvm*.c*
     166 include/ravi_llvm.h
    1086 include/ravi_llvmcodegen.h
     344 src/ravi_llvmarith1.cpp
     832 src/ravi_llvmarith2.cpp
     172 src/ravi_llvmcall.cpp
    1865 src/ravi_llvmcodegen.cpp
     324 src/ravi_llvmcomp.cpp
     453 src/ravi_llvmforloop.cpp
     763 src/ravi_llvmforprep.cpp
     593 src/ravi_llvmjit.cpp
     421 src/ravi_llvmload.cpp
    1504 src/ravi_llvmluaapi.cpp
      52 src/ravi_llvmrest.cpp
      96 src/ravi_llvmreturn.cpp
     728 src/ravi_llvmtable.cpp
     140 src/ravi_llvmtforcall.cpp
    1250 src/ravi_llvmtypes.cpp
   10789 total

Reply | Threaded
Open this post in threaded view
|

Re: A benefit of using LLVM for JIT compilation

Dibyendu Majumdar
On 10 November 2015 at 23:46, Dibyendu Majumdar <[hidden email]> wrote:

> Obviously the biggest benefit is that there is an army of engineers
> working on LLVM, from Google, Apple, IBM, and even Microsoft
> now-a-days. This means that one is relying on the collective power of
> so many engineers.
>
> The other benefit seems to me the resulting simplicity of the JIT
> implementation in Ravi. I don't know how Lua code size is measured but
> here is a simplistic estimate of the number of lines of code that is
> in Ravi for implementing the JIT compiler:
>
> wc -l include/ravi_llvm*.h src/ravi_llvm*.c*
>      166 include/ravi_llvm.h
>     1086 include/ravi_llvmcodegen.h
>      344 src/ravi_llvmarith1.cpp
>      832 src/ravi_llvmarith2.cpp
>      172 src/ravi_llvmcall.cpp
>     1865 src/ravi_llvmcodegen.cpp
>      324 src/ravi_llvmcomp.cpp
>      453 src/ravi_llvmforloop.cpp
>      763 src/ravi_llvmforprep.cpp
>      593 src/ravi_llvmjit.cpp
>      421 src/ravi_llvmload.cpp
>     1504 src/ravi_llvmluaapi.cpp
>       52 src/ravi_llvmrest.cpp
>       96 src/ravi_llvmreturn.cpp
>      728 src/ravi_llvmtable.cpp
>      140 src/ravi_llvmtforcall.cpp
>     1250 src/ravi_llvmtypes.cpp
>    10789 total

I should have excluded following:

>     1504 src/ravi_llvmluaapi.cpp

As above is the LLVM binding implementation - not part of the JIT.