* class.c (add_field): Mark static fields external.
(build_class_ref): Remove redundant set.
* parse.y (java_expand_classes): Mark static fields of classes
to be compiled as local.
* jcf-parse.c (parse_class_file): Likewise.
From-SVN: r49458
+2002-02-02 Richard Henderson <rth@redhat.com>
+
+ * class.c (add_field): Mark static fields external.
+ (build_class_ref): Remove redundant set.
+ * parse.y (java_expand_classes): Mark static fields of classes
+ to be compiled as local.
+ * jcf-parse.c (parse_class_file): Likewise.
+
2002-02-02 Nic Ferrier <nferrier@tapsellferrier.co.uk>
* gcj.texi (About CNI): New node.
(Invoking jv-convert): New node.
2001-01-10 Jeff Sturm <jsturm@one-point.com>
- Martin Kahlert <martin.kahlert@infineon.com>
+ Martin Kahlert <martin.kahlert@infineon.com>
* jcf-parse.c (get_constant): Don't swap lo/hi for big
endian targets when HOST_BITS_PER_WIDE_INT >= 64.
2002-01-03 Graham Stott <grahams@redhat.com>
- * class.c (compile_resource_file): Update copyright date.
- Constify filename parameter.
- (java-tree.h): Update copyright date.
- (compile_resource_file): Constify filename parameter.
+ * class.c (compile_resource_file): Update copyright date.
+ Constify filename parameter.
+ (java-tree.h): Update copyright date.
+ (compile_resource_file): Constify filename parameter.
2002-01-03 Graham Stott <grahams@redhat.com>
- * gcc/jcf-parse.c: Update copyright date.
- (yyparse): Constify resource_filename.
+ * gcc/jcf-parse.c: Update copyright date.
+ (yyparse): Constify resource_filename.
2002-01-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
/* Always make field externally visible. This is required so
that native methods can always access the field. */
TREE_PUBLIC (field) = 1;
+ /* Considered external until we know what classes are being
+ compiled into this object file. */
+ DECL_EXTERNAL (field) = 1;
}
+
return field;
}
DECL_EXTERNAL (decl) = 1;
make_decl_rtl (decl, NULL);
pushdecl_top_level (decl);
- if (is_compiled == 1)
- DECL_EXTERNAL (decl) = 1;
}
}
static void
parse_class_file ()
{
- tree method;
+ tree method, field;
const char *save_input_filename = input_filename;
int save_lineno = lineno;
compiling from class files. */
always_initialize_class_p = 1;
- for ( method = TYPE_METHODS (CLASS_TO_HANDLE_TYPE (current_class));
- method != NULL_TREE; method = TREE_CHAIN (method))
+ for (field = TYPE_FIELDS (CLASS_TO_HANDLE_TYPE (current_class));
+ field != NULL_TREE; field = TREE_CHAIN (field))
+ if (FIELD_STATIC (field))
+ DECL_EXTERNAL (field) = 0;
+
+ for (method = TYPE_METHODS (CLASS_TO_HANDLE_TYPE (current_class));
+ method != NULL_TREE; method = TREE_CHAIN (method))
{
JCF *jcf = current_jcf;
java_layout_classes ();
java_parse_abort_on_error ();
- cur_ctxp = ctxp_for_generation;
- for (; cur_ctxp; cur_ctxp = cur_ctxp->next)
+ for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
{
ctxp = cur_ctxp;
input_filename = ctxp->filename;
/* Find anonymous classes and expand their constructor, now they
have been fixed. */
- for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
+ for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
{
tree current;
ctxp = cur_ctxp;
return;
/* Now things are stable, go for generation of the class data. */
- for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
+
+ /* We pessimistically marked all fields external until we knew
+ what set of classes we were planning to compile. Now mark
+ those that will be generated locally as not external. */
+ for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
+ {
+ tree current;
+ for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
+ {
+ tree class = TREE_TYPE (current);
+ tree field;
+ for (field = TYPE_FIELDS (class); field ; field = TREE_CHAIN (field))
+ if (FIELD_STATIC (field))
+ DECL_EXTERNAL (field) = 0;
+ }
+ }
+
+ /* Compile the classes. */
+ for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
{
tree current;
ctxp = cur_ctxp;