RFC: Multiple Java Source Files - Combine Inputs By Default

Andrew Haley aph@redhat.com
Mon Jun 21 14:27:00 GMT 2004


Ranjit Mathew writes:
 > On 2004年6月21日 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.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /