Commit f0c75752 by Richard Henderson

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
parent d74697b8
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.
......
......@@ -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;
}
}
......
......@@ -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,7 +808,12 @@ parse_class_file ()
compiling from class files. */
always_initialize_class_p = 1;
for ( method = TYPE_METHODS (CLASS_TO_HANDLE_TYPE (current_class));
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;
......
......@@ -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;
......@@ -9009,6 +9008,24 @@ java_expand_classes ()
return;
/* Now things are stable, go for generation of the class data. */
/* 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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment