aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorRichard Henderson <rth@gcc.gnu.org>2002-02-02 22:23:37 -0800
committerRichard Henderson <rth@gcc.gnu.org>2002-02-02 22:23:37 -0800
commitf0c75752a10218b95f31583594dac574626b3062 (patch)
treed3081a1b3cb01da65223cdcd03a5fd55ecdecda2 /gcc/java
parentd74697b84d79ac7f863e9a65b445ac2e72b59090 (diff)
downloadgcc-f0c75752a10218b95f31583594dac574626b3062.zip
gcc-f0c75752a10218b95f31583594dac574626b3062.tar.gz
gcc-f0c75752a10218b95f31583594dac574626b3062.tar.bz2
class.c (add_field): Mark static fields external.
* 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
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog22
-rw-r--r--gcc/java/class.c6
-rw-r--r--gcc/java/jcf-parse.c11
-rw-r--r--gcc/java/parse.y25
4 files changed, 48 insertions, 16 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 4482d28..3bd83c7 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,11 @@
+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.
@@ -89,22 +97,22 @@
(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>
diff --git a/gcc/java/class.c b/gcc/java/class.c
index bd45306..2e70081 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -773,7 +773,11 @@ add_field (class, name, field_type, flags)
/* 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;
}
@@ -1095,8 +1099,6 @@ build_class_ref (type)
DECL_EXTERNAL (decl) = 1;
make_decl_rtl (decl, NULL);
pushdecl_top_level (decl);
- if (is_compiled == 1)
- DECL_EXTERNAL (decl) = 1;
}
}
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index 3e3bd23..e85b578 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -793,7 +793,7 @@ init_outgoing_cpool ()
static void
parse_class_file ()
{
- tree method;
+ tree method, field;
const char *save_input_filename = input_filename;
int save_lineno = lineno;
@@ -808,8 +808,13 @@ parse_class_file ()
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;
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index 8b33fad..328a18e 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -8963,8 +8963,7 @@ java_expand_classes ()
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;
@@ -8976,7 +8975,7 @@ java_expand_classes ()
/* 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;
@@ -9009,7 +9008,25 @@ java_expand_classes ()
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;