+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.
+
2001-01-23 Bryce McKinlay <bryce@albatross.co.nz>
* config-lang.in: Disable java by default.
warning ("duplicate ConstanValue atribute for field '%s'",
IDENTIFIER_POINTER (DECL_NAME (field)));
else
- DECL_INITIAL (field) = constant;
+ {
+ DECL_INITIAL (field) = constant;
+ if (FIELD_FINAL (field))
+ DECL_FIELD_FINAL_IUD (field) = 1;
+ }
}
/* Count the number of Unicode chars encoded in a given Ut8 string. */
}
CLASS_BEING_LAIDOUT (this_class) = 1;
- if (super_class)
+ if (super_class && !CLASS_BEING_LAIDOUT (super_class))
{
tree maybe_super_class
= maybe_layout_super_class (super_class, this_class);
TREE_STATIC (meth_var) = 1;
TREE_PUBLIC (meth_var) = 0;
DECL_EXTERNAL (meth_var) = 0;
+ DECL_CONTEXT (meth_var) = method;
make_decl_rtl (meth_var, NULL);
meth_var = pushdecl_top_level (meth_var);
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 *));
{ 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)
#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); \
/* 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"
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;
/* 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
HANDLE_INNERCLASSES_ATTRIBUTE (count);
}
else
+#endif
+#ifdef HANDLE_SYNTHETIC_ATTRIBUTE
+ if (name_length == 9 && memcmp (name_data, "Synthetic", 9) == 0)
+ {
+ HANDLE_SYNTHETIC_ATTRIBUTE ();
+ }
+ else
#endif
{
#ifdef PROCESS_OTHER_ATTRIBUTE
struct jcf_partial *state;
tree decl, name;
{
- static tree anonymous_name = NULL_TREE;
- int icii, ocii, ini, icaf;
+ int icii, icaf;
+ int ocii = 0, ini = 0;
unsigned char *ptr = append_chunk (NULL, 8, state);
- if (!anonymous_name)
+ icii = find_class_constant (&state->cpool, TREE_TYPE (decl));
+
+ /* Sun's implementation seems to generate ocii to 0 for inner
+ classes (which aren't considered members of the class they're
+ in.) The specs are saying that if the class is anonymous,
+ inner_name_index must be zero. */
+ if (!ANONYMOUS_CLASS_P (TREE_TYPE (decl)))
{
- anonymous_name = get_identifier ("");
- ggc_add_tree_root (&anonymous_name, 1);
+ ocii = find_class_constant (&state->cpool,
+ TREE_TYPE (DECL_CONTEXT (decl)));
+ ini = find_utf8_constant (&state->cpool, name);
}
-
- icii = find_class_constant (&state->cpool, TREE_TYPE (decl));
- ocii = find_class_constant (&state->cpool, TREE_TYPE (DECL_CONTEXT (decl)));
-
- /* The specs are saying that if the class is anonymous,
- inner_name_index must be zero. But the implementation makes it
- point to an empty string. */
- ini = find_utf8_constant (&state->cpool,
- (ANONYMOUS_CLASS_P (TREE_TYPE (decl)) ?
- anonymous_name : name));
icaf = get_access_flags (decl);
-
+
PUT2 (icii); PUT2 (ocii); PUT2 (ini); PUT2 (icaf);
}
static void register_package PARAMS ((tree));
static tree resolve_package PARAMS ((tree, tree *));
static tree lookup_package_type PARAMS ((const char *, int));
-static tree lookup_package_type_and_set_next PARAMS ((const char *, int, tree *));
static tree resolve_class PARAMS ((tree, tree, tree, tree));
static void declare_local_variables PARAMS ((int, tree, tree));
static void source_start_java_method PARAMS ((tree));
*next = EXPR_WFL_QUALIFICATION (pkg);
- /* Try the current package. */
- if (ctxp->package && !strncmp (name, IDENTIFIER_POINTER (ctxp->package),
- IDENTIFIER_LENGTH (ctxp->package)))
- {
- type_name =
- lookup_package_type_and_set_next (name,
- IDENTIFIER_LENGTH (ctxp->package),
- next );
- if (type_name)
- return type_name;
- }
-
- /* Search in imported package */
- for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
- {
- tree current_pkg_name = EXPR_WFL_NODE (TREE_PURPOSE (current));
- int len = IDENTIFIER_LENGTH (current_pkg_name);
- if (!strncmp (name, IDENTIFIER_POINTER (current_pkg_name), len))
- {
- tree left, dummy;
-
- breakdown_qualified (&left, &dummy, current_pkg_name);
- len = IDENTIFIER_LENGTH (left);
- type_name = lookup_package_type_and_set_next (name, len, next);
- if (type_name)
- break;
- }
- }
-
/* Try to progressively construct a type name */
if (TREE_CODE (pkg) == EXPR_WITH_FILE_LOCATION)
for (acc = NULL_TREE, current = EXPR_WFL_QUALIFICATION (pkg);
return type_name;
}
-static tree
-lookup_package_type_and_set_next (name, len, next)
- const char *name;
- int len;
- tree *next;
-{
- const char *ptr;
- tree type_name = lookup_package_type (name, len);
-
- if (!type_name)
- return NULL;
-
- ptr = IDENTIFIER_POINTER (type_name);
- while (ptr && (ptr = strchr (ptr, '.')))
- {
- *next = TREE_CHAIN (*next);
- ptr++;
- }
- return type_name;
-}
-
static tree
lookup_package_type (name, from)
const char *name;
search_applicable_methods_list (lc, TYPE_METHODS (class),
name, arglist, &list, &all_list);
+ /* When looking finit$, we turn LC to 1 so that we only search
+ in class. Note that we should have found something at
+ this point. */
+ if (ID_FINIT_P (name))
+ {
+ lc = 1;
+ if (!list)
+ fatal ("finit$ not found in class -- find_applicable_accessible_methods_list");
+ }
+
/* We must search all interfaces of this class */
if (!lc)
{
static const char *check_pending_block PARAMS ((tree));
static void type_stack_dup PARAMS ((int, int));
static int start_pc_cmp PARAMS ((const PTR, const PTR));
+static char *pop_argument_types PARAMS ((tree));
extern int stack_pointer;