>>>>> "Oliver" == Oliver Kellogg <oliver.kell...@t-online.de> writes:

Tom> There are some differences in invocation.  I designed the incremental
Tom> compiler so that no changes to user Makefiles would be needed; I don't
Tom> know whether that is a consideration with Ada.

Oliver> The idea is that gnatmake determines the total set of files to be
Oliver> recompiled and then makes a single call to gcc with all those files.
Oliver> The gain with that scheme is that the compiler proper can assume
Oliver> the compilation of those files to be "atomic" in the sense that the
Oliver> trees are guaranteed to be consistent within one compile job.
Oliver> (Does the compile server also work this way?)

Yes, more or less.  The idea behind the incremental compiler is to
share declarations across compile jobs.  The details of this sharing
are left to the front ends.

There is no concept of atomicity here; the front end has to ensure
that whatever it is doing makes sense.  I don't know Ada so I can't
really comment on what this would look like in gnat.

I suppose that gnatmake could start and stop the server, thus
effectively providing the same guarantee as in your scenario.  That
is, it would "gcc --server" at the start, invoke gcc once for each
input, and then and "gcc --kill-server" at the end.

Tom> I am curious how you handle locations on shared bits of the AST.
Tom> I needed some disturbing hacks to make this work well for C.

Oliver> I'm not sure what you mean; could you explain?

In the server, the global line map is reset for each compile job (and
it sounds like this is true for your patch as well).  So, suppose a
compilation reuses a declaration that was parsed during an earlier
job.  The location_t values in this declaration will no longer be
valid; if the compiler emits a diagnostic using this declaration, then
the location will be incorrect.

In the C compiler I worked around this by resetting locations on
shared decls.  The details of this are tied to how the C compiler
implements sharing.

I was curious to know how you handled this situation.  If you re-lower
AST bits to trees for each job, or something like that, then it
probably is not as big a problem for you.

Tom

Reply via email to