This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: RFC: Multiple Java Source Files - Combine Inputs By Default
Ranjit Mathew writes:
> On Mon, 21 Jun 2004 11:38:05 +0100, Andrew Haley <aph@redhat.com> wrote:
> >
> > Ranjit Mathew writes:
> > >
> > > If I use "-o" with "-c" like:
> > >
> > > gcj -c -o snafu foo.java bar.java baz.java
> > >
> > > my understanding is that GCC will create file "snafu"
> > > that contains *one* of what would have been "foo.o",
> > > "bar.o" and "baz.o".
> >
> > That is not my understanding.
>
> Silly me - I ought to have checked it first. :-(
>
> While "gcc" doesn't let me specify "-o" with "-S" or "-c" if
> multiple input files are present, "gcj" does. And "gcj" creates
> something that is neither of "foo.o" or "bar.o". I'm guessing that
> this file then is an object file containing code from *both*
> "foo.java" and "bar.java".
Exactly: they're compiled together, allowing us to do inlining,
interprocedural optimization, etc.
> Since parse_source_file_2() is what effects resolution, completion,
> etc. in a parsed class, class "Foo"'s view of class "Bar" can
> change quite a bit depending on whether "Bar" is seen via the
> command line ("combine inputs") or discovered via read_class().
In the case where we compile several inputs with a single output, this
is quite deliberate. But the ability not to do this, by simply using
the compiler driver to separately compile a number of source files, is
useful too.
Andrew.