RFC: Multiple Java Source Files - Combine Inputs By Default

Per Bothner per@bothner.com
Mon Jun 21 14:45:00 GMT 2004


Ranjit Mathew writes:
> 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".

To quote Andrew Haley:

> Exactly: they're compiled together, allowing us to do inlining,
> interprocedural optimization, etc.

Ranjit Mathew writes:
> What happens is that java_parse_file() in jcf-parse.c
> first iterates through all source files calling parse_source_file_1()
> on them. It then calls parse_source_file_2() on each file
> and finally parse_source_file_3() on each file (separate loops).

> On the other hand, read_class() in jcf-parse calls
> parse_source_file_1/2/3() when it reads a source file.

I don't know if this is correct.  I believe read_class
would be called in pass 2 (i.e. during parse_source_file_2).
If so, it probably shouldn't be doing parse_source_file_3.
However, it's been so long and I don't even remember why
parse_source_file_3 is a separate pass.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/



More information about the Java mailing list