Incremental compilation

Marc Nieper-Wißkirchen marc@nieper-wisskirchen.de
Tue Jan 1 00:00:00 GMT 2019


Am So., 30. Dez. 2018 um 16:53 Uhr schrieb Basile Starynkevitch
<basile@starynkevitch.net>:
>
>
> On 12/30/18 4:04 PM, Marc Nieper-Wißkirchen wrote:
> > Am So., 30. Dez. 2018 um 13:28 Uhr schrieb Basile Starynkevitch
> > <basile@starynkevitch.net>:
> >
> >
> > You could, once all macros have been compiled, regenerate a single
> > "shared object" for all your library, but that is an optimization. The
> > main reason to do so would be to avoid wasting virtual address space by
> > having many thousands of shared objects. I am not sure it is worthwhile.
> > The reason why I would like to have a single shared object is for the
> > convenience of the user. The compiler should produce a single shared
> > object from a Scheme library definition which can then later be
> > visited/invoked in lieu of loading the Scheme source code of the
> > library.
>
> Then you could compile twice the code.
>
> Alternatively, you could compile each function once into a .pic.o
> position-independent code object file. When doing the incremental compilation, you also need to convert each of these into its own .so file
> (and you would fork a ld or gcc process for that; it should run quickly).
>
> BTW, since libgccjit is really a wrapper above GCC, you could generate once the position-indenpendent code object files
> (so usinggcc_jit_context_add_command_line_option to ask for -fPIC then using
> gcc_jit_context_compile_to_file) of each function. Then you would fork a
> gcc or ld process to link all these *.pic.o into a single .so; this
> would be reasonably quick. Take advantage that libgccjit is just a
> front-end to GCC. It fakes to be a JIT compiler, but it is not really
> one. Its main advantage is to avoid requiring you to emit C code in
> files. Cheers.

Another advantage of libgccjit (vs invoking GCC directly) is that it
abstracts away issues like locating the GCC binary on the target
system, handling of temporary files, etc.

Maybe it makes sense if libgccjit exposes that part as an API to the
user as well.

-- Marc



More information about the Jit mailing list