This is the mail archive of the
mailing list for the GCC project.
Re: [patch] compiling multiple Java source files at once
Alexandre Petit-Bianco <email@example.com> writes:
> Per Bothner writes:
> > The gcj patches also support multiple .class files on the command
> > line, but jc1 may be unable to find the right classes.
> OK, here's something I came accross:
> $ cat X.java
> $ gcj -C X.java
> $ gcj *.class --main=X
> X.java: In class `Y':
> X.java: In method `()':
> X.java:0: verification error at PC=4
> X.java:0: falling through end of method
> I had a look and it seems that byte_ops contains nothing but
> nops. Would that be a problem with jcf?
I'm not sure what "jcf" is. Do you mean jcf-dump?
I would not expect that kind of problem. It could be a bug
in gc. However, it could be due to the following.
The problems I would expect with compiling multiple class files
is that resolving a class that is later on the command line
may fail to find the class (if the classpath to not find those
classes), or the compiler might get confused trying to compile
a class that was loaded earlier. That could be the exlanation
of what you saw.
The solution is for yyparse to compile JCF_CLASS files in two
passes, like I made it do for JCF_SOURCE files. The first
pass only needs to the class file only enough to read the
name of the class being compiled (which means it just read
the constant pool and the class identification). Anything
that requires class to be resolved and loaded must be
deferred to the second pass. This includes at the very
least all method bodies.
I don't know when/if I'll get to fixing this. A short-term solution
is change jvspec.c (back) so only one .class file is compiled
at a time.