java-tree.h (end_params_node): Declare global.

* java-tree.h (end_params_node):  Declare global.
	* decl.c (end_params_node):  New global.
	(init_decl_processing, start_java_method):  Use end_params_node for
	end of list of parameter types.  Follows correct gcc conventions.
	* expr.c (pop_argument_types, pop_arguments):  Likewise.
	* lang.c (put_decl_node):  Likewise.
	* typeck.c (various places):  Likewise.
	* class.y (various places):  Likewise.
	* parse.y (various places):  Likewise.
	* parse.y (java_complete_tree):  Move CAN_COMPLETE_NORMALLY.
	(build_jump_to_finally):  Add missing CAN_COMPLETE_NORMALLY.
	* class.c:  Add #include flags.h, remove no-longer needed declaration.
	* class.c (layout_class_method):  Remove commented-out code, re-format.
	Don't add vtable entry (or index) for private methods.
	* expr.c (expand_invoke):  A private method is implicitly final.
	* class.c (make_class_data):  If inlining or optimizing,
	skip private methods.
	* class.c (finish_class):  New function.  Calls existing methods,
	but alls emits deferred inline functions.
	* jcf-parse.c (parse_class_file):  Call finish_class.
	* parse.y (java_complete_expand_methods):  Likewise.
	* expr.c (build_java_binop):  Explicit default, to silence -Wall.

From-SVN: r23871
This commit is contained in:
Per Bothner 1998-11-25 09:10:57 -08:00
parent 0bd2e6dbbf
commit de4c7b029c
5 changed files with 22 additions and 25 deletions

View File

@ -249,6 +249,8 @@ extern tree method_type_node;
extern tree method_ptr_type_node; extern tree method_ptr_type_node;
#define nativecode_ptr_type_node ptr_type_node #define nativecode_ptr_type_node ptr_type_node
extern tree end_params_node;
/* References to internal libjava functions we use. */ /* References to internal libjava functions we use. */
extern tree alloc_object_node; extern tree alloc_object_node;
extern tree soft_instanceof_node; extern tree soft_instanceof_node;

View File

@ -692,9 +692,8 @@ parse_class_file ()
if (flag_emit_class_files) if (flag_emit_class_files)
write_classfile (current_class); write_classfile (current_class);
make_class_data (current_class);
register_class (); finish_class (current_class);
rest_of_decl_compilation (TYPE_NAME (current_class), (char*) 0, 1, 0);
debug_end_source_file (save_lineno); debug_end_source_file (save_lineno);
input_filename = save_input_filename; input_filename = save_input_filename;

View File

@ -371,7 +371,7 @@ put_decl_node (node)
if (TREE_CODE (TREE_TYPE (node)) == METHOD_TYPE) if (TREE_CODE (TREE_TYPE (node)) == METHOD_TYPE)
args = TREE_CHAIN (args); args = TREE_CHAIN (args);
put_decl_string ("(", 1); put_decl_string ("(", 1);
for ( ; args != NULL_TREE; args = TREE_CHAIN (args), i++) for ( ; args != end_params_node; args = TREE_CHAIN (args), i++)
{ {
if (i > 0) if (i > 0)
put_decl_string (",", 1); put_decl_string (",", 1);

View File

@ -2925,7 +2925,7 @@ maybe_generate_finit ()
mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class), mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class),
ACC_PRIVATE|ACC_FINAL, void_type_node, ACC_PRIVATE|ACC_FINAL, void_type_node,
finit_identifier_node, NULL_TREE); finit_identifier_node, end_params_node);
start_artificial_method_body (mdecl); start_artificial_method_body (mdecl);
ctxp->non_static_initialized = nreverse (ctxp->non_static_initialized); ctxp->non_static_initialized = nreverse (ctxp->non_static_initialized);
@ -2953,7 +2953,7 @@ maybe_generate_clinit ()
mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class), mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class),
ACC_STATIC, void_type_node, ACC_STATIC, void_type_node,
clinit_identifier_node, NULL_TREE); clinit_identifier_node, end_params_node);
start_artificial_method_body (mdecl); start_artificial_method_body (mdecl);
/* Keep initialization in order to enforce 8.5 */ /* Keep initialization in order to enforce 8.5 */
@ -3179,7 +3179,7 @@ fix_method_argument_names (orig_arg, meth)
TREE_PURPOSE (arg) = this_identifier_node; TREE_PURPOSE (arg) = this_identifier_node;
arg = TREE_CHAIN (arg); arg = TREE_CHAIN (arg);
} }
while (orig_arg) while (orig_arg != end_params_node)
{ {
TREE_PURPOSE (arg) = TREE_PURPOSE (orig_arg); TREE_PURPOSE (arg) = TREE_PURPOSE (orig_arg);
orig_arg = TREE_CHAIN (orig_arg); orig_arg = TREE_CHAIN (orig_arg);
@ -3370,7 +3370,7 @@ method_declarator (id, list)
TREE_CHAIN (arg_node) = arg_types; TREE_CHAIN (arg_node) = arg_types;
arg_types = arg_node; arg_types = arg_node;
} }
TYPE_ARG_TYPES (meth) = nreverse (arg_types); TYPE_ARG_TYPES (meth) = chainon (nreverse (arg_types), end_params_node);
node = build_tree_list (id, meth); node = build_tree_list (id, meth);
return node; return node;
} }
@ -4340,7 +4340,7 @@ java_check_regular_methods (class_decl)
flags = (get_access_flags_from_decl (class_decl) & ACC_PUBLIC ? flags = (get_access_flags_from_decl (class_decl) & ACC_PUBLIC ?
ACC_PUBLIC : 0); ACC_PUBLIC : 0);
decl = create_artificial_method (class, flags, void_type_node, decl = create_artificial_method (class, flags, void_type_node,
init_identifier_node, NULL_TREE); init_identifier_node, end_params_node);
DECL_CONSTRUCTOR_P (decl) = 1; DECL_CONSTRUCTOR_P (decl) = 1;
layout_class_method (TREE_TYPE (class_decl), NULL_TREE, decl, NULL_TREE); layout_class_method (TREE_TYPE (class_decl), NULL_TREE, decl, NULL_TREE);
} }
@ -5031,7 +5031,7 @@ source_start_java_method (fndecl)
/* New scope for the function */ /* New scope for the function */
enter_block (); enter_block ();
for (tem = TYPE_ARG_TYPES (TREE_TYPE (fndecl)), i = 0; for (tem = TYPE_ARG_TYPES (TREE_TYPE (fndecl)), i = 0;
tem != NULL_TREE; tem = TREE_CHAIN (tem), i++) tem != end_params_node; tem = TREE_CHAIN (tem), i++)
{ {
tree type = TREE_VALUE (tem); tree type = TREE_VALUE (tem);
tree name = TREE_PURPOSE (tem); tree name = TREE_PURPOSE (tem);
@ -5341,12 +5341,7 @@ java_complete_expand_methods ()
/* Make the class data, register it and run the rest of decl /* Make the class data, register it and run the rest of decl
compilation on it */ compilation on it */
if (!java_error_count && ! flag_emit_class_files) if (!java_error_count && ! flag_emit_class_files)
{ finish_class (current_class);
make_class_data (current_class);
register_class ();
rest_of_decl_compilation (TYPE_NAME (current_class),
(char*) 0, 1, 0);
}
} }
} }
@ -5514,7 +5509,7 @@ verify_constructor_super ()
for (mdecl = TYPE_METHODS (class); mdecl; mdecl = TREE_CHAIN (mdecl)) for (mdecl = TYPE_METHODS (class); mdecl; mdecl = TREE_CHAIN (mdecl))
{ {
if (DECL_CONSTRUCTOR_P (mdecl) if (DECL_CONSTRUCTOR_P (mdecl)
&& !TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl)))) && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl))) == end_params_node)
return 0; return 0;
} }
} }
@ -6588,7 +6583,7 @@ patch_invoke (patch, method, args, from_super)
t = TYPE_ARG_TYPES (TREE_TYPE (method)); t = TYPE_ARG_TYPES (TREE_TYPE (method));
if (TREE_CODE (patch) == NEW_CLASS_EXPR) if (TREE_CODE (patch) == NEW_CLASS_EXPR)
t = TREE_CHAIN (t); t = TREE_CHAIN (t);
for (ta = args; t && ta; t = TREE_CHAIN (t), ta = TREE_CHAIN (ta)) for (ta = args; t != end_params_node && ta; t = TREE_CHAIN (t), ta = TREE_CHAIN (ta))
if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) && if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) &&
TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t)) TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t))
TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta)); TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta));
@ -6698,7 +6693,7 @@ lookup_method_invoke (lc, cl, class, name, arg_list)
tree cl; tree cl;
tree class, name, arg_list; tree class, name, arg_list;
{ {
tree atl = NULL_TREE; /* Arg Type List */ tree atl = end_params_node; /* Arg Type List */
tree method, signature, list, node; tree method, signature, list, node;
char *candidates; /* Used for error report */ char *candidates; /* Used for error report */
@ -6899,7 +6894,7 @@ argument_types_convertible (m1, m2_or_arglist)
m2_arg_cache = m2_arg; m2_arg_cache = m2_arg;
} }
while (m1_arg && m2_arg) while (m1_arg != end_params_node && m2_arg != end_params_node)
{ {
resolve_and_layout (TREE_VALUE (m1_arg), NULL_TREE); resolve_and_layout (TREE_VALUE (m1_arg), NULL_TREE);
if (!valid_method_invocation_conversion_p (TREE_VALUE (m1_arg), if (!valid_method_invocation_conversion_p (TREE_VALUE (m1_arg),
@ -6908,7 +6903,7 @@ argument_types_convertible (m1, m2_or_arglist)
m1_arg = TREE_CHAIN (m1_arg); m1_arg = TREE_CHAIN (m1_arg);
m2_arg = TREE_CHAIN (m2_arg); m2_arg = TREE_CHAIN (m2_arg);
} }
return (!m1_arg && !m2_arg ? 1 : 0); return m1_arg == end_params_node && m2_arg == end_params_node;
} }
/* Qualification routines */ /* Qualification routines */
@ -7421,7 +7416,6 @@ java_complete_tree (node)
case NEW_CLASS_EXPR: case NEW_CLASS_EXPR:
case CALL_EXPR: case CALL_EXPR:
CAN_COMPLETE_NORMALLY (node) = 1;
/* Complete function's argument(s) first */ /* Complete function's argument(s) first */
if (complete_function_arguments (node)) if (complete_function_arguments (node))
return error_mark_node; return error_mark_node;
@ -7441,6 +7435,7 @@ java_complete_tree (node)
DECL_CONSTRUCTOR_CALLS (current_function_decl) = DECL_CONSTRUCTOR_CALLS (current_function_decl) =
tree_cons (wfl, decl, tree_cons (wfl, decl,
DECL_CONSTRUCTOR_CALLS (current_function_decl)); DECL_CONSTRUCTOR_CALLS (current_function_decl));
CAN_COMPLETE_NORMALLY (node) = 1;
return node; return node;
} }
@ -10015,6 +10010,7 @@ build_jump_to_finally (block, decl, finally_label, type)
stmt = build (MODIFY_EXPR, void_type_node, decl, stmt = build (MODIFY_EXPR, void_type_node, decl,
build_address_of (LABELED_BLOCK_LABEL (new_block))); build_address_of (LABELED_BLOCK_LABEL (new_block)));
TREE_SIDE_EFFECTS (stmt) = 1; TREE_SIDE_EFFECTS (stmt) = 1;
CAN_COMPLETE_NORMALLY (stmt) = 1;
add_stmt_to_block (block, type, stmt); add_stmt_to_block (block, type, stmt);
stmt = build (GOTO_EXPR, void_type_node, finally_label); stmt = build (GOTO_EXPR, void_type_node, finally_label);
TREE_SIDE_EFFECTS (stmt) = 1; TREE_SIDE_EFFECTS (stmt) = 1;

View File

@ -467,8 +467,8 @@ parse_signature_string (sig_string, sig_length)
if (str++, str >= limit) if (str++, str >= limit)
fatal ("bad signature string"); fatal ("bad signature string");
result_type = parse_signature_type (&str, limit); result_type = parse_signature_type (&str, limit);
result_type = build_function_type (result_type, argtype_list = chainon (nreverse (argtype_list), end_params_node);
nreverse (argtype_list)); result_type = build_function_type (result_type, argtype_list);
} }
else else
result_type = parse_signature_type (&str, limit); result_type = parse_signature_type (&str, limit);
@ -513,7 +513,7 @@ build_java_argument_signature (type)
tree args = TYPE_ARG_TYPES (type); tree args = TYPE_ARG_TYPES (type);
if (TREE_CODE (type) == METHOD_TYPE) if (TREE_CODE (type) == METHOD_TYPE)
args = TREE_CHAIN (args); /* Skip "this" argument. */ args = TREE_CHAIN (args); /* Skip "this" argument. */
for (; args != NULL_TREE; args = TREE_CHAIN (args)) for (; args != end_params_node; args = TREE_CHAIN (args))
{ {
tree t = build_java_signature (TREE_VALUE (args)); tree t = build_java_signature (TREE_VALUE (args));
obstack_grow (&temporary_obstack, obstack_grow (&temporary_obstack,