Is gcc reentrant.

Alexandre Petit-Bianco apbianco@cygnus.com
Thu Feb 18 22:17:00 GMT 1999


Manosiz Bhattacharyya writes:
> I wanted to reenter jc1 on all the classes that it figured out in
> the last runs.

jc1 naturally re-enters its source and class file analysis code as it
tries to resolve types. jc1 is also able to process several input
files within a single invocation, provided that the variable
input_filename contains a list of `&' separated file names (see
jcf-parse.c:yyparse.) This single string is transformed into a list of
identifier tree nodes held in current_file_list. I guess the hack
would be to tweak that list whenever a new type gets resolved so that
jc1 sees it sometimes later as an other file to be processed; with
appropriate exclusion to avoid parsing the same input file twice and
with the difference that the file doesn't need to be parsed again, but
that the classes that it defines need to be expanded (eventually using
java_expand_classes.)

I believe this should work, since given the following source code
configuration:

f1.java:
class f1 {
   ...
   f2 foo;
}

f2.java:
class f2 {
   ...
}

and the multiple source files found in `input_filename' (with the form
`f1.java&f2.java'), at the end of the analysis of `f1.java', jc1 will
try to resolve the `f2' type. This results in `f2.java' to be analyzed
(and the filename `f2.java' identifier marked using
HAS_BEEN_ALREADY_PARSED.)  Next, when jc1 comes to analyze `f2.java',
source code parsing will be skipped and jc1 will directly proceed with
f2's unresolved type resolution (if any) and code generation (see
jcf-parse.c:jcf_parse_source)

-- Alex


More information about the Java mailing list