* decl.c (java_mark_decl_local, java_mark_class_local): New.
* java-tree.h (java_mark_class_local): Declare.
* jcf-parse.c (parse_class_file): Use it.
* parse.y (java_expand_classes): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66768
138bc75d-0d04-0410-961f-
82ee72b054a4
+2003-05-13 Richard Henderson <rth@redhat.com>
+
+ * class.c (layout_class_method): Set DECL_EXTERNAL.
+ * decl.c (java_mark_decl_local, java_mark_class_local): New.
+ * java-tree.h (java_mark_class_local): Declare.
+ * jcf-parse.c (parse_class_file): Use it.
+ * parse.y (java_expand_classes): Likewise.
+
2003-05-04 Nathan Sidwell <nathan@codesourcery.com>
* Make-lang.in (java/parse.o, java/parse-scan.o): Depend on input.h.
tree method_name = DECL_NAME (method_decl);
TREE_PUBLIC (method_decl) = 1;
+ /* Considered external until we know what classes are being
+ compiled into this object file. */
+ DECL_EXTERNAL (method_decl) = 1;
/* This is a good occasion to mangle the method's name */
SET_DECL_ASSEMBLER_NAME (method_decl,
}
}
+/* We pessimistically marked all methods and fields external until we
+ knew what set of classes we were planning to compile. Now mark those
+ associated with CLASS to be generated locally as not external. */
+
+static void
+java_mark_decl_local (tree decl)
+{
+ DECL_EXTERNAL (decl) = 0;
+
+ /* If we've already constructed DECL_RTL, give encode_section_info
+ a second chance, now that we've changed the flags. */
+ if (DECL_RTL_SET_P (decl))
+ make_decl_rtl (decl, NULL);
+}
+
+void
+java_mark_class_local (tree class)
+{
+ tree t;
+
+ for (t = TYPE_FIELDS (class); t ; t = TREE_CHAIN (t))
+ if (FIELD_STATIC (t))
+ java_mark_decl_local (t);
+
+ for (t = TYPE_METHODS (class); t ; t = TREE_CHAIN (t))
+ if (!METHOD_ABSTRACT (t) && (!METHOD_NATIVE (t) || flag_jni))
+ java_mark_decl_local (t);
+}
+
#include "gt-java-decl.h"
extern void java_optimize_inline (tree);
extern tree decl_constant_value (tree);
+extern void java_mark_class_local (tree);
+
#if defined(RTX_CODE) && defined (HAVE_MACHINE_MODES)
struct rtx_def * java_expand_expr (tree, rtx, enum machine_mode, int);
#endif
static void
parse_class_file (void)
{
- tree method, field;
+ tree method;
const char *save_input_filename = input_filename;
int save_lineno = input_line;
compiling from class files. */
always_initialize_class_p = 1;
- for (field = TYPE_FIELDS (current_class);
- field != NULL_TREE; field = TREE_CHAIN (field))
- if (FIELD_STATIC (field))
- DECL_EXTERNAL (field) = 0;
+ java_mark_class_local (current_class);
for (method = TYPE_METHODS (current_class);
method != NULL_TREE; method = TREE_CHAIN (method))
/* 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
+ /* We pessimistically marked all methods and 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;
ctxp = cur_ctxp;
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;
- }
+ java_mark_class_local (TREE_TYPE (current));
}
/* Compile the classes. */