This is the mail archive of the
mailing list for the GCC project.
Re: GCC-Bridge: A Gimple Compiler targeting the JVM
- From: Mikhail Maltsev <maltsevm at gmail dot com>
- To: "Bertram, Alexander" <alex at bedatadriven dot com>, gcc at gcc dot gnu dot org
- Date: Mon, 1 Feb 2016 18:53:13 +0300
- Subject: Re: GCC-Bridge: A Gimple Compiler targeting the JVM
- Authentication-results: sourceware.org; auth=none
- References: <CAOdV3zBHNvWMBPwkybvPzc9_yMndeP2bnxsXNGCbocwTHbPSWQ at mail dot gmail dot com>
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
> I've written a bit more about it today here:
> And you can find the whole project here:
> 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.