aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/jcf-parse.c
diff options
context:
space:
mode:
authorAlexandre Petit-Bianco <apbianco@cygnus.com>2001-01-24 08:08:36 +0000
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>2001-01-24 00:08:36 -0800
commit493d561d623fe14141c5dba6ddd98a8271c67e69 (patch)
treeb3ca35263ce6de5b0c268b75d5186f60cd6b2f19 /gcc/java/jcf-parse.c
parent0851111417ad065a9513312dede39bcfa2491516 (diff)
downloadgcc-493d561d623fe14141c5dba6ddd98a8271c67e69.zip
gcc-493d561d623fe14141c5dba6ddd98a8271c67e69.tar.gz
gcc-493d561d623fe14141c5dba6ddd98a8271c67e69.tar.bz2
class.c (layout_class): Don't lay the superclass out if it's already being laid out.
2001-01-23 Alexandre Petit-Bianco <apbianco@cygnus.com> * class.c (layout_class): Don't lay the superclass out if it's already being laid out. * jcf-parse.c (handle_innerclass_attribute): New function. (HANDLE_INNERCLASSES_ATTRIBUTE): Invoke handle_innerclasses_attribute. (jcf_parse): Don't load an innerclasses if it's already being laid out. * jcf-write.c (append_innerclass_attribute_entry): Static `anonymous_name' and its initialization deleted. `ocii' and `ini' to be zero for anonymous classes. 2001-01-23 Alexandre Petit-Bianco <apbianco@cygnus.com> * class.c (set_constant_value): Set DECL_FIELD_FINAL_IUD if necessary. * jcf-parse.c (set_source_filename): Use MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC if necessary. 2001-01-23 Alexandre Petit-Bianco <apbianco@cygnus.com> * expr.c (build_jni_stub): Set DECL_CONTEXT on `meth_var' so it gets a unique asm name. 2001-01-23 Alexandre Petit-Bianco <apbianco@cygnus.com> * jcf-parse.c (HANDLE_END_METHODS): Nullify current_method. (HANDLE_START_FIELD): Invoke MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC if necessary. (HANDLE_SYNTHETIC_ATTRIBUTE): New macro. * jcf-reader.c (get_attribute): Handle `Synthetic' attribute. * parse.y (lookup_package_type_and_set_next): Deleted. (resolve_package): Removed unnecessary code. (find_applicable_accessible_methods_list): `finit$' can't be inherited. * verify.c (pop_argument_types): Added missing prototype. (http://gcc.gnu.org/ml/gcc-patches/2001-01/msg01812.html) From-SVN: r39230
Diffstat (limited to 'gcc/java/jcf-parse.c')
-rw-r--r--gcc/java/jcf-parse.c87
1 files changed, 63 insertions, 24 deletions
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index a4178c0..10baf59 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -85,6 +85,7 @@ static tree parse_roots[3] = { NULL_TREE, NULL_TREE, NULL_TREE };
static struct JCF main_jcf[1];
/* Declarations of some functions used here. */
+static void handle_innerclass_attribute PARAMS ((int count, JCF *));
static tree give_name_to_class PARAMS ((JCF *jcf, int index));
static void parse_zip_file_entries PARAMS ((void));
static void process_zip_dir PARAMS ((FILE *));
@@ -158,7 +159,10 @@ set_source_filename (jcf, index)
{ int sig_index = SIGNATURE; \
current_field = add_field (current_class, get_name_constant (jcf, NAME), \
parse_signature (jcf, sig_index), ACCESS_FLAGS); \
- set_java_signature (TREE_TYPE (current_field), JPOOL_UTF (jcf, sig_index)); }
+ set_java_signature (TREE_TYPE (current_field), JPOOL_UTF (jcf, sig_index)); \
+ if ((ACCESS_FLAGS) & ACC_FINAL) \
+ MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (current_field); \
+}
#define HANDLE_END_FIELDS() \
(current_field = NULL_TREE)
@@ -182,7 +186,8 @@ set_source_filename (jcf, index)
#define HANDLE_END_METHODS() \
{ tree handle_type = CLASS_TO_HANDLE_TYPE (current_class); \
- if (handle_type != current_class) layout_type (handle_type); }
+ if (handle_type != current_class) layout_type (handle_type); \
+ current_method = NULL_TREE; }
#define HANDLE_CODE_ATTRIBUTE(MAX_STACK, MAX_LOCALS, CODE_LENGTH) \
{ DECL_MAX_STACK (current_method) = (MAX_STACK); \
@@ -214,27 +219,16 @@ set_source_filename (jcf, index)
/* Link seen inner classes to their outer context and register the
inner class to its outer context. They will be later loaded. */
-#define HANDLE_INNERCLASSES_ATTRIBUTE(COUNT) \
-{ \
- int c = (count); \
- while (c--) \
- { \
- tree class = get_class_constant (jcf, JCF_readu2 (jcf)); \
- tree decl = TYPE_NAME (class); \
- if (DECL_P (decl) && !CLASS_COMPLETE_P (decl)) \
- { \
- tree outer = TYPE_NAME (get_class_constant (jcf, \
- JCF_readu2 (jcf))); \
- tree alias = get_name_constant (jcf, JCF_readu2 (jcf)); \
- JCF_SKIP (jcf, 2); \
- DECL_CONTEXT (decl) = outer; \
- DECL_INNER_CLASS_LIST (outer) = \
- tree_cons (decl, alias, DECL_INNER_CLASS_LIST (outer)); \
- CLASS_COMPLETE_P (decl) = 1; \
- } \
- else \
- JCF_SKIP (jcf, 6); \
- } \
+#define HANDLE_INNERCLASSES_ATTRIBUTE(COUNT) \
+ handle_innerclass_attribute (COUNT, jcf)
+
+#define HANDLE_SYNTHETIC_ATTRIBUTE() \
+{ \
+ /* Irrelevant decls should have been nullified by the END macros. */ \
+ if (current_method) \
+ DECL_ARTIFICIAL (current_method) = 1; \
+ else \
+ DECL_ARTIFICIAL (current_field) = 1; \
}
#include "jcf-reader.c"
@@ -440,6 +434,46 @@ get_name_constant (jcf, index)
return name;
}
+/* Handle reading innerclass attributes. If a non zero entry (denoting
+ a non anonymous entry) is found, We augment the inner class list of
+ the outer context with the newly resolved innerclass. */
+
+static void
+handle_innerclass_attribute (count, jcf)
+ int count;
+ JCF *jcf;
+{
+ int c = (count);
+ while (c--)
+ {
+ /* Read inner_class_info_index. This may be 0 */
+ int icii = JCF_readu2 (jcf);
+ /* Read outer_class_info_index. If the innerclasses attribute
+ entry isn't a member (like an inner class) the value is 0. */
+ int ocii = JCF_readu2 (jcf);
+ /* Read inner_name_index. If the class we're dealing with is
+ an annonymous class, it must be 0. */
+ int ini = JCF_readu2 (jcf);
+ /* If icii is 0, don't try to read the class. */
+ if (icii >= 0)
+ {
+ tree class = get_class_constant (jcf, icii);
+ tree decl = TYPE_NAME (class);
+ /* Skip reading further if ocii is null */
+ if (DECL_P (decl) && !CLASS_COMPLETE_P (decl) && ocii)
+ {
+ tree outer = TYPE_NAME (get_class_constant (jcf, ocii));
+ tree alias = (ini ? get_name_constant (jcf, ini) : NULL_TREE);
+ DECL_CONTEXT (decl) = outer;
+ DECL_INNER_CLASS_LIST (outer) =
+ tree_cons (decl, alias, DECL_INNER_CLASS_LIST (outer));
+ CLASS_COMPLETE_P (decl) = 1;
+ }
+ }
+ JCF_SKIP (jcf, 2);
+ }
+}
+
static tree
give_name_to_class (jcf, i)
JCF *jcf;
@@ -677,7 +711,12 @@ jcf_parse (jcf)
/* And if we came across inner classes, load them now. */
for (current = DECL_INNER_CLASS_LIST (TYPE_NAME (current_class)); current;
current = TREE_CHAIN (current))
- load_class (DECL_NAME (TREE_PURPOSE (current)), 1);
+ {
+ tree name = DECL_NAME (TREE_PURPOSE (current));
+ tree decl = IDENTIFIER_GLOBAL_VALUE (name);
+ if (decl && !CLASS_BEING_LAIDOUT (TREE_TYPE (decl)))
+ load_class (name, 1);
+ }
}
void