[multiple changes]

2001-08-16  Alexandre Petit-Bianco  <apbianco@redhat.com>

	* jcf-parse.c (load_class): New locals saved and class_loaded. If
	loading a class_or_name fails, try considering an innerclass name
	and load the enclosing context.
	* parse.y (resolve_inner_class): New function.
	(find_as_inner_class): Added leading comment.
	(register_incomplete_type): Keep the current context as enclosing
	context for JDEP_FIELD dependencies.
	(do_resolve_class): Locals new_class_decl and super initialized to
	NULL. Call resolve_inner_class, explore the enclosing context
	superclass if necessary.
	Fixes PR java/4007

2001-08-12  Alexandre Petit-Bianco  <apbianco@redhat.com>

	* decl.c (init_decl_processing): exception_type_node,
	class_not_found_type_node, and no_class_def_found_type_node
	initialized. predef_filenames augmented accordingly.
	instinit_identifier_node initialized.
	* java-tree.def (INSTANCE_INITIALIZERS_EXPR): Entry removed.
	* java-tree.h (enum java_tree_index): New entries
	JTI_EXCEPTION_TYPE_NODE, JTI_CLASS_NOT_FOUND_TYPE_NODE,
	JTI_NO_CLASS_DEF_FOUND_TYPE_NODE, JTI_INSTINIT_IDENTIFIER_NODE.
	(exception_type_node): New macro.
	(class_not_found_type_node): Likewise.
	(no_class_def_found_type_node): Likewise.
	(instinit_identifier_node): Likewise.
	(PREDEF_FILENAMES_SIZE): Adjusted.
	(TYPE_HAS_FINAL_VARIABLE): Fixed typo.
	(struct lang_type): Fixed typo in bitfield name.
	(DECL_INSTINIT_P): New macro.
	(ID_INSTINIT_P): Likewise.
	* jcf-write.c (generate_classfile): instinit$ bears the Synthetic
	attribute.
	* parse.y (encapsulate_with_try_catch): New function.
	(generate_instinit): Likewise.
	(build_instinit_invocation): Likewise.
	(ctors_unchecked_throws_clause_p): Likewise.
	(add_instance_initializer): Deleted.
	(build_instance_initializer): Likewise.
	(in_instance_initializer): Likewise.
	(check_method_redefinition): instinit$ not to be verified.
	(java_complete_expand_methods): Generate instinit$, simplified code.
	(build_dot_class_method): Eliminated unnecessary locals. Use
	encapsulate_with_try_catch, removed unnecessary code.
	(fix_constructors): New local iii. Use build_instinit_invocation.
	(patch_method_invocation): Added comment.
	(maybe_use_access_method): Don't consider instinit$.
	(find_applicable_accessible_methods_list): Shorten the search for
	instinit$ too.
	(java_complete_lhs): case INSTANCE_INITIALIZERS_EXPR removed.
	(patch_return): Use DECL_INSTINIT_P instead of in_instance_initializer.
	(patch_throw_statement): Likewise. Fixed typo.

2001-08-09  Alexandre Petit-Bianco  <apbianco@redhat.com>

	* expr.c (java_lang_expand_expr): Call `expand_end_bindings' and
	`poplevel' in the right order.

(http://gcc.gnu.org/ml/gcc-patches/2001-08/msg01061.html )

From-SVN: r44982
parent 0779eeb2
2001-08-16 Alexandre Petit-Bianco <apbianco@redhat.com>
* jcf-parse.c (load_class): New locals saved and class_loaded. If
loading a class_or_name fails, try considering an innerclass name
and load the enclosing context.
* parse.y (resolve_inner_class): New function.
(find_as_inner_class): Added leading comment.
(register_incomplete_type): Keep the current context as enclosing
context for JDEP_FIELD dependencies.
(do_resolve_class): Locals new_class_decl and super initialized to
NULL. Call resolve_inner_class, explore the enclosing context
superclass if necessary.
Fixes PR java/4007
2001-08-16 Tom Tromey <tromey@redhat.com>
* jcf-dump.c (main): Updated for change to jcf_path_seal.
......@@ -13,6 +27,47 @@
* Make-lang.in (java/decl.o): Update dependencies.
* decl.c: Include libfuncs.h, don't include toplev.h.
2001-08-12 Alexandre Petit-Bianco <apbianco@redhat.com>
* decl.c (init_decl_processing): exception_type_node,
class_not_found_type_node, and no_class_def_found_type_node
initialized. predef_filenames augmented accordingly.
instinit_identifier_node initialized.
* java-tree.def (INSTANCE_INITIALIZERS_EXPR): Entry removed.
* java-tree.h (enum java_tree_index): New entries
JTI_EXCEPTION_TYPE_NODE, JTI_CLASS_NOT_FOUND_TYPE_NODE,
JTI_NO_CLASS_DEF_FOUND_TYPE_NODE, JTI_INSTINIT_IDENTIFIER_NODE.
(exception_type_node): New macro.
(class_not_found_type_node): Likewise.
(no_class_def_found_type_node): Likewise.
(instinit_identifier_node): Likewise.
(PREDEF_FILENAMES_SIZE): Adjusted.
(TYPE_HAS_FINAL_VARIABLE): Fixed typo.
(struct lang_type): Fixed typo in bitfield name.
(DECL_INSTINIT_P): New macro.
(ID_INSTINIT_P): Likewise.
* jcf-write.c (generate_classfile): instinit$ bears the Synthetic
attribute.
* parse.y (encapsulate_with_try_catch): New function.
(generate_instinit): Likewise.
(build_instinit_invocation): Likewise.
(ctors_unchecked_throws_clause_p): Likewise.
(add_instance_initializer): Deleted.
(build_instance_initializer): Likewise.
(in_instance_initializer): Likewise.
(check_method_redefinition): instinit$ not to be verified.
(java_complete_expand_methods): Generate instinit$, simplified code.
(build_dot_class_method): Eliminated unnecessary locals. Use
encapsulate_with_try_catch, removed unnecessary code.
(fix_constructors): New local iii. Use build_instinit_invocation.
(patch_method_invocation): Added comment.
(maybe_use_access_method): Don't consider instinit$.
(find_applicable_accessible_methods_list): Shorten the search for
instinit$ too.
(java_complete_lhs): case INSTANCE_INITIALIZERS_EXPR removed.
(patch_return): Use DECL_INSTINIT_P instead of in_instance_initializer.
(patch_throw_statement): Likewise. Fixed typo.
2001-08-12 David Edelsohn <edelsohn@gnu.org>
Revert:
......@@ -31,6 +86,11 @@
* lex.h: Don't include setjmp.h. Don't define
SET_FLOAT_HANDLER or prototype set_float_handler.
2001-08-09 Alexandre Petit-Bianco <apbianco@redhat.com>
* expr.c (java_lang_expand_expr): Call `expand_end_bindings' and
`poplevel' in the right order.
2001-08-09 Richard Henderson <rth@redhat.com>
* Make-lang.in (class.o): Depend on TARGET_H.
......@@ -390,7 +450,7 @@
2001-05-07 Alexandre Petit-Bianco <apbianco@redhat.com>
* parse.y (fix_constructors): Removed unecessary assignment to
* parse.y (fix_constructors): Removed unnecessary assignment to
local. Moved assignment to `this$<n>', fixed comments and
indentation.
(build_wfl_wrap): Fixed indentation.
......@@ -2912,7 +2972,7 @@ Sun Aug 6 00:47:24 2000 Ovidiu Predescu <ovidiu@cup.hp.com>
2000-06-25 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (do_resolve_class): Minor optimiztion in the package
list search. Removed unecessary test and return statement.
list search. Removed unnecessary test and return statement.
(valid_ref_assignconv_cast_p): Order of arguments to
enclosing_context_p fixed.
......@@ -3296,7 +3356,7 @@ Mon Apr 24 14:59:36 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
2000-04-24 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (source_start_java_method): Deleted unecessary code.
* parse.y (source_start_java_method): Deleted unnecessary code.
(patch_method_invocation): Fixed comment.
2000-04-24 Robert Lipe <robertlipe@usa.net>
......@@ -3860,7 +3920,7 @@ Fri Feb 25 18:00:37 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (resolve_expression_name): Use `orig' as a second
argument to resolve_field_access.
(resolve_field_access): Removed unecessary code when dealing with
(resolve_field_access): Removed unnecessary code when dealing with
static fields.
Wed Feb 23 17:41:50 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
......@@ -11650,7 +11710,7 @@ Thu Sep 11 19:45:18 1997 Alexandre Petit-Bianco <apbianco@cygnus.com>
layout.
* typeck.c: (parse_signature_string): Temporary use permanent_obstack.
(build_java_signature): Temporary use permanent_obstack.
* verify.c: (verify_jvm_instruction): removed unecessary verification
* verify.c: (verify_jvm_instruction): removed unnecessary verification
on ACC_SUPER flag.
* java-tree.h (METHOD_NATIVE, METHOD_TRANSIENT): Defined.
(FIELD_VOLATILE, FIELD_TRANSIENT): Defined.
......
......@@ -541,10 +541,16 @@ init_decl_processing ()
string_ptr_type_node = promote_type (string_type_node);
class_type_node = lookup_class (get_identifier ("java.lang.Class"));
throwable_type_node = lookup_class (get_identifier ("java.lang.Throwable"));
exception_type_node = lookup_class (get_identifier ("java.lang.Exception"));
runtime_exception_type_node =
lookup_class (get_identifier ("java.lang.RuntimeException"));
error_exception_type_node =
lookup_class (get_identifier ("java.lang.Error"));
class_not_found_type_node =
lookup_class (get_identifier ("java.lang.ClassNotFoundException"));
no_class_def_found_type_node =
lookup_class (get_identifier ("java.lang.NoClassDefFoundError"));
rawdata_ptr_type_node
= promote_type (lookup_class (get_identifier ("gnu.gcj.RawData")));
......@@ -557,6 +563,9 @@ init_decl_processing ()
predef_filenames [4] = get_identifier ("java/lang/String.java");
predef_filenames [5] = get_identifier ("java/lang/Throwable.java");
predef_filenames [6] = get_identifier ("gnu/gcj/RawData.java");
predef_filenames [7] = get_identifier ("java/lang/Exception");
predef_filenames [8] = get_identifier ("java/lang/ClassNotFoundException");
predef_filenames [9] = get_identifier ("java/lang/NoClassDefFoundError");
methodtable_type = make_node (RECORD_TYPE);
layout_type (methodtable_type);
......@@ -572,6 +581,7 @@ init_decl_processing ()
/* The new `finit$' special method identifier. This one is now
generated in place of `$finit$'. */
finit_identifier_node = get_identifier ("finit$");
instinit_identifier_node = get_identifier ("instinit$");
void_signature_node = get_identifier ("()V");
length_identifier_node = get_identifier ("length");
this_identifier_node = get_identifier ("this");
......
......@@ -2505,8 +2505,8 @@ java_lang_expand_expr (exp, target, tmode, modifier)
}
expand_expr (body, const0_rtx, VOIDmode, 0);
emit_queue ();
poplevel (1, 1, 0);
expand_end_bindings (getdecls (), 1, 0);
poplevel (1, 1, 0);
return const0_rtx;
}
return const0_rtx;
......
......@@ -88,12 +88,6 @@ DEFTREECODE (NEW_ARRAY_INIT, "new_array_init", '1', 1)
reference from. */
DEFTREECODE (CLASS_LITERAL, "class_literal", '1', 1)
/* Instance initializer.
Operand 0 contains the intance initializer statement. This tree node
is used for context detection, so that special rules can be
enforced. */
DEFTREECODE (INSTANCE_INITIALIZERS_EXPR, "instance_initializers_expr", '1', 1)
/* The Java object within the exception object from the runtime. */
DEFTREECODE (JAVA_EXC_OBJ_EXPR, "java_exc_obj_expr", 'e', 0)
......
......@@ -251,9 +251,12 @@ enum java_tree_index
JTI_STRING_TYPE_NODE,
JTI_STRING_PTR_TYPE_NODE,
JTI_THROWABLE_TYPE_NODE,
JTI_EXCEPTION_TYPE_NODE,
JTI_RUNTIME_EXCEPTION_TYPE_NODE,
JTI_ERROR_EXCEPTION_TYPE_NODE,
JTI_RAWDATA_PTR_TYPE_NODE,
JTI_CLASS_NOT_FOUND_TYPE_NODE,
JTI_NO_CLASS_DEF_FOUND_TYPE_NODE,
JTI_BYTE_ARRAY_TYPE_NODE,
JTI_SHORT_ARRAY_TYPE_NODE,
......@@ -278,6 +281,7 @@ enum java_tree_index
JTI_INIT_IDENTIFIER_NODE,
JTI_CLINIT_IDENTIFIER_NODE,
JTI_FINIT_IDENTIFIER_NODE,
JTI_INSTINIT_IDENTIFIER_NODE,
JTI_FINIT_LEG_IDENTIFIER_NODE,
JTI_VOID_SIGNATURE_NODE,
JTI_LENGTH_IDENTIFIER_NODE,
......@@ -408,12 +412,18 @@ extern tree java_global_trees[JTI_MAX];
java_global_trees[JTI_STRING_PTR_TYPE_NODE]
#define throwable_type_node \
java_global_trees[JTI_THROWABLE_TYPE_NODE]
#define exception_type_node \
java_global_trees[JTI_EXCEPTION_TYPE_NODE]
#define runtime_exception_type_node \
java_global_trees[JTI_RUNTIME_EXCEPTION_TYPE_NODE]
#define error_exception_type_node \
java_global_trees[JTI_ERROR_EXCEPTION_TYPE_NODE]
#define rawdata_ptr_type_node \
java_global_trees[JTI_RAWDATA_PTR_TYPE_NODE]
#define class_not_found_type_node \
java_global_trees[JTI_CLASS_NOT_FOUND_TYPE_NODE]
#define no_class_def_found_type_node \
java_global_trees[JTI_NO_CLASS_DEF_FOUND_TYPE_NODE]
#define byte_array_type_node \
java_global_trees[JTI_BYTE_ARRAY_TYPE_NODE]
......@@ -463,6 +473,8 @@ extern tree java_global_trees[JTI_MAX];
java_global_trees[JTI_FINIT_IDENTIFIER_NODE] /* "finit$" */
#define finit_leg_identifier_node \
java_global_trees[JTI_FINIT_LEG_IDENTIFIER_NODE] /* "$finit$" */
#define instinit_identifier_node \
java_global_trees[JTI_INSTINIT_IDENTIFIER_NODE] /* "instinit$" */
#define void_signature_node \
java_global_trees[JTI_VOID_SIGNATURE_NODE] /* "()V" */
#define length_identifier_node \
......@@ -598,7 +610,7 @@ extern tree java_global_trees[JTI_MAX];
#define nativecode_ptr_array_type_node \
java_global_trees[JTI_NATIVECODE_PTR_ARRAY_TYPE_NODE]
#define PREDEF_FILENAMES_SIZE 7
#define PREDEF_FILENAMES_SIZE 10
extern tree predef_filenames[PREDEF_FILENAMES_SIZE];
#define nativecode_ptr_type_node ptr_type_node
......@@ -937,7 +949,7 @@ struct lang_decl_var
#define TYPE_PACKAGE_LIST(T) (TYPE_LANG_SPECIFIC(T)->package_list)
#define TYPE_PRIVATE_INNER_CLASS(T) (TYPE_LANG_SPECIFIC(T)->pic)
#define TYPE_PROTECTED_INNER_CLASS(T) (TYPE_LANG_SPECIFIC(T)->poic)
#define TYPE_HAS_FINAL_VARIABLE(T) (TYPE_LANG_SPECIFIC(T)->afv)
#define TYPE_HAS_FINAL_VARIABLE(T) (TYPE_LANG_SPECIFIC(T)->hfv)
struct lang_type
{
......@@ -955,7 +967,7 @@ struct lang_type
tree package_list; /* List of package names, progressive */
unsigned pic:1; /* Private Inner Class. */
unsigned poic:1; /* Protected Inner Class. */
unsigned afv:1; /* Has final variables */
unsigned hfv:1; /* Has final variables */
};
#ifdef JAVA_USE_HANDLES
......@@ -1197,6 +1209,7 @@ struct rtx_def * java_lang_expand_expr PARAMS ((tree, rtx, enum machine_mode,
#define DECL_INIT_P(DECL) (ID_INIT_P (DECL_NAME (DECL)))
#define DECL_FINIT_P(DECL) (ID_FINIT_P (DECL_NAME (DECL)))
#define DECL_CLINIT_P(DECL) (ID_CLINIT_P (DECL_NAME (DECL)))
#define DECL_INSTINIT_P(DECL) (ID_INSTINIT_P (DECL_NAME (DECL)))
/* Predicates on method identifiers. Kept close to other macros using
them */
......@@ -1209,6 +1222,7 @@ struct rtx_def * java_lang_expand_expr PARAMS ((tree, rtx, enum machine_mode,
|| (ID) == finit_leg_identifier_node)
#define ID_CLINIT_P(ID) ((ID) == clinit_identifier_node)
#define ID_CLASSDOLLAR_P(ID) ((ID) == classdollar_identifier_node)
#define ID_INSTINIT_P(ID) ((ID) == instinit_identifier_node)
/* Access flags etc for a variable/field (a FIELD_DECL): */
......
......@@ -650,7 +650,8 @@ load_class (class_or_name, verbose)
tree class_or_name;
int verbose;
{
tree name;
tree name, saved;
int class_loaded;
/* class_or_name can be the name of the class we want to load */
if (TREE_CODE (class_or_name) == IDENTIFIER_NODE)
......@@ -663,8 +664,31 @@ load_class (class_or_name, verbose)
else
name = DECL_NAME (TYPE_NAME (class_or_name));
if (read_class (name) == 0 && verbose)
error ("Cannot find file for class %s.", IDENTIFIER_POINTER (name));
saved = name;
while (1)
{
char *dollar;
if ((class_loaded = read_class (name)))
break;
/* We failed loading name. Now consider that we might be looking
for a inner class but it's only available in source for in
its enclosing context. */
if ((dollar = strrchr (IDENTIFIER_POINTER (name), '$')))
{
int c = *dollar;
*dollar = '\0';
name = get_identifier (IDENTIFIER_POINTER (name));
*dollar = c;
}
/* Otherwise, we failed, we bail. */
else
break;
}
if (!class_loaded && verbose)
error ("Cannot find file for class %s.", IDENTIFIER_POINTER (saved));
}
/* Parse the .class file JCF. */
......
......@@ -2935,7 +2935,8 @@ generate_classfile (clas, state)
i = (body != NULL_TREE) + (DECL_FUNCTION_THROWS (part) != NULL_TREE);
/* Make room for the Synthetic attribute (of zero length.) */
if (DECL_FINIT_P (part)
if (DECL_FINIT_P (part)
|| DECL_INSTINIT_P (part)
|| OUTER_FIELD_ACCESS_IDENTIFIER_P (DECL_NAME (part))
|| TYPE_DOT_CLASS (clas) == part)
{
......
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