This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC-Bridge: A Gimple Compiler targeting the JVM


On 02/01/2016 03:34 PM, Bertram, Alexander wrote:
> I wanted to share a project we've been working on for sometime within
> the context of Renjin,
> a new interpreter for the R language running on the JVM.
> 
> We basically needed a way to compile C and Fortran code to JVM
> classes, and for the last year or two we've been working on tool chain
> that's composed of a GCC plugin which dumps Gimple trees out to a JSON
> file, and a Java program which reads the JSON and compiles it to Java
> classfiles.
> 
> I've written a bit more about it today here:
> http://www.renjin.org/blog/2016-01-31-introducing-gcc-bridge.html
> 
> And you can find the whole project here:
> https://github.com/bedatadriven/renjin/tree/master/tools/gcc-bridge
> 
> The compiler is part of the Renjin project, but can also be used in a
> standalone way to compile arbitrary C/Fortran code to Java classfiles,
> though the focus has been on pure scientific code, so we haven't
> bothered with some rather obvious things like fopen().
> 
> Anyway, using the GCC plugin interface has been terrific, and the
> gimple trees have been great to work with!

Interesting project. It's great to see that the plugin interface is
actually used by real-world projects.

P.S. I noticed this comment in your source code:

// GCC won't let us malloc and I don't want to mess
// around with GCC's internal memory management stuff,
// so we'll just use a fixed-size stack

You actually don't need to use any complex memory management stuff. GCC
provides a wrapper for malloc called 'xmalloc'. It works like normal
malloc, but aborts in case of allocation failure.

-- 
Regards,
    Mikhail Maltsev


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]