Commit 0bd2e6db by Per Bothner

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: r23870
parent 75d01ad7
...@@ -333,6 +333,8 @@ tree length_identifier_node; ...@@ -333,6 +333,8 @@ tree length_identifier_node;
tree this_identifier_node; tree this_identifier_node;
tree super_identifier_node; tree super_identifier_node;
tree end_params_node;
/* References to internal libjava functions we use. */ /* References to internal libjava functions we use. */
tree alloc_object_node; tree alloc_object_node;
tree soft_instanceof_node; tree soft_instanceof_node;
...@@ -415,6 +417,7 @@ builtin_function (name, type, function_code, library_name) ...@@ -415,6 +417,7 @@ builtin_function (name, type, function_code, library_name)
void void
init_decl_processing () init_decl_processing ()
{ {
register tree endlink;
tree field; tree field;
tree t; tree t;
...@@ -672,8 +675,10 @@ init_decl_processing () ...@@ -672,8 +675,10 @@ init_decl_processing ()
CLASS_LOADED_P (method_type_node) = 1; CLASS_LOADED_P (method_type_node) = 1;
build_decl (TYPE_DECL, get_identifier ("Method"), method_type_node); build_decl (TYPE_DECL, get_identifier ("Method"), method_type_node);
endlink = end_params_node = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
t = tree_cons (NULL_TREE, class_ptr_type, t = tree_cons (NULL_TREE, class_ptr_type,
build_tree_list (NULL_TREE, int_type_node)); tree_cons (NULL_TREE, int_type_node, endlink));
alloc_object_node = builtin_function ("_Jv_AllocObject", alloc_object_node = builtin_function ("_Jv_AllocObject",
build_function_type (ptr_type_node, t), build_function_type (ptr_type_node, t),
NOT_BUILT_IN, NULL_PTR); NOT_BUILT_IN, NULL_PTR);
...@@ -681,21 +686,18 @@ init_decl_processing () ...@@ -681,21 +686,18 @@ init_decl_processing ()
build_function_type (void_type_node, build_function_type (void_type_node,
t), t),
NOT_BUILT_IN, NULL_PTR); NOT_BUILT_IN, NULL_PTR);
t = build_tree_list (NULL_TREE, void_type_node); t = tree_cons (NULL_TREE, ptr_type_node, endlink);
throw_node = builtin_function ("_Jv_Throw", throw_node = builtin_function ("_Jv_Throw",
build_function_type (ptr_type_node, t), build_function_type (ptr_type_node, t),
NOT_BUILT_IN, NULL_PTR); NOT_BUILT_IN, NULL_PTR);
t = build_function_type (int_type_node, endlink);
soft_monitorenter_node soft_monitorenter_node
= builtin_function ("_Jv_MonitorEnter", = builtin_function ("_Jv_MonitorEnter", t, NOT_BUILT_IN, NULL_PTR);
build_function_type (int_type_node, t),
NOT_BUILT_IN, NULL_PTR);
soft_monitorexit_node soft_monitorexit_node
= builtin_function ("_Jv_MonitorExit", = builtin_function ("_Jv_MonitorExit", t, NOT_BUILT_IN, NULL_PTR);
build_function_type (int_type_node, t),
NOT_BUILT_IN, NULL_PTR);
t = tree_cons (NULL_TREE, int_type_node, t = tree_cons (NULL_TREE, int_type_node,
build_tree_list (NULL_TREE, int_type_node)); tree_cons (NULL_TREE, int_type_node, endlink));
soft_newarray_node soft_newarray_node
= builtin_function ("_Jv_NewArray", = builtin_function ("_Jv_NewArray",
build_function_type(ptr_type_node, t), build_function_type(ptr_type_node, t),
...@@ -703,22 +705,21 @@ init_decl_processing () ...@@ -703,22 +705,21 @@ init_decl_processing ()
t = tree_cons (NULL_TREE, int_type_node, t = tree_cons (NULL_TREE, int_type_node,
tree_cons (NULL_TREE, class_ptr_type, tree_cons (NULL_TREE, class_ptr_type,
build_tree_list (NULL_TREE, tree_cons (NULL_TREE, object_ptr_type_node, endlink)));
object_ptr_type_node)));
soft_anewarray_node soft_anewarray_node
= builtin_function ("_Jv_NewObjectArray", = builtin_function ("_Jv_NewObjectArray",
build_function_type (ptr_type_node, t), build_function_type (ptr_type_node, t),
NOT_BUILT_IN, NULL_PTR ); NOT_BUILT_IN, NULL_PTR );
t = tree_cons (NULL_TREE, ptr_type_node, t = tree_cons (NULL_TREE, ptr_type_node,
build_tree_list (NULL_TREE, int_type_node)); tree_cons (NULL_TREE, int_type_node, endlink));
soft_multianewarray_node soft_multianewarray_node
= builtin_function ("_Jv_NewMultiArray", = builtin_function ("_Jv_NewMultiArray",
build_function_type (ptr_type_node, t), build_function_type (ptr_type_node, t),
NOT_BUILT_IN, NULL_PTR ); NOT_BUILT_IN, NULL_PTR );
t = build_function_type (void_type_node, t = build_function_type (void_type_node,
build_tree_list (NULL_TREE, int_type_node)); tree_cons (NULL_TREE, int_type_node, endlink));
soft_badarrayindex_node soft_badarrayindex_node
= builtin_function ("_Jv_ThrowBadArrayIndex", t, = builtin_function ("_Jv_ThrowBadArrayIndex", t,
NOT_BUILT_IN, NULL_PTR); NOT_BUILT_IN, NULL_PTR);
...@@ -726,50 +727,49 @@ init_decl_processing () ...@@ -726,50 +727,49 @@ init_decl_processing ()
TREE_SIDE_EFFECTS (soft_badarrayindex_node) = 1; TREE_SIDE_EFFECTS (soft_badarrayindex_node) = 1;
t = tree_cons (NULL_TREE, class_ptr_type, t = tree_cons (NULL_TREE, class_ptr_type,
build_tree_list (NULL_TREE, object_ptr_type_node)); tree_cons (NULL_TREE, object_ptr_type_node, endlink));
soft_checkcast_node soft_checkcast_node
= builtin_function ("_Jv_CheckCast", = builtin_function ("_Jv_CheckCast",
build_function_type (ptr_type_node, t), build_function_type (ptr_type_node, t),
NOT_BUILT_IN, NULL_PTR); NOT_BUILT_IN, NULL_PTR);
t = tree_cons (NULL_TREE, object_ptr_type_node, t = tree_cons (NULL_TREE, object_ptr_type_node,
build_tree_list (NULL_TREE, class_ptr_type)); tree_cons (NULL_TREE, class_ptr_type, endlink));
soft_instanceof_node soft_instanceof_node
= builtin_function ("_Jv_IsInstanceOf", = builtin_function ("_Jv_IsInstanceOf",
build_function_type (promoted_boolean_type_node, t), build_function_type (promoted_boolean_type_node, t),
NOT_BUILT_IN, NULL_PTR); NOT_BUILT_IN, NULL_PTR);
t = tree_cons (NULL_TREE, object_ptr_type_node, t = tree_cons (NULL_TREE, object_ptr_type_node,
build_tree_list (NULL_TREE, object_ptr_type_node)); tree_cons (NULL_TREE, object_ptr_type_node, endlink));
soft_checkarraystore_node soft_checkarraystore_node
= builtin_function ("_Jv_CheckArrayStore", = builtin_function ("_Jv_CheckArrayStore",
build_function_type (void_type_node, t), build_function_type (void_type_node, t),
NOT_BUILT_IN, NULL_PTR); NOT_BUILT_IN, NULL_PTR);
t = tree_cons (NULL_TREE, ptr_type_node, t = tree_cons (NULL_TREE, ptr_type_node,
tree_cons (NULL_TREE, ptr_type_node, tree_cons (NULL_TREE, ptr_type_node,
build_tree_list (NULL_TREE, ptr_type_node))); tree_cons (NULL_TREE, ptr_type_node, endlink)));
soft_lookupinterfacemethod_node soft_lookupinterfacemethod_node
= builtin_function ("_Jv_LookupInterfaceMethod", = builtin_function ("_Jv_LookupInterfaceMethod",
build_function_type (ptr_type_node, t), build_function_type (ptr_type_node, t),
NOT_BUILT_IN, NULL_PTR); NOT_BUILT_IN, NULL_PTR);
t = tree_cons (NULL_TREE, double_type_node, t = tree_cons (NULL_TREE, double_type_node,
build_tree_list (NULL_TREE, double_type_node)); tree_cons (NULL_TREE, double_type_node, endlink));
soft_fmod_node soft_fmod_node
= builtin_function ("__builtin_fmod", = builtin_function ("__builtin_fmod",
build_function_type (double_type_node, t), build_function_type (double_type_node, t),
BUILT_IN_FMOD, "fmod"); BUILT_IN_FMOD, "fmod");
t = build_tree_list (NULL_TREE, void_type_node);
soft_exceptioninfo_call_node soft_exceptioninfo_call_node
= build (CALL_EXPR, = build (CALL_EXPR,
ptr_type_node, ptr_type_node,
build_address_of build_address_of
(builtin_function ("_Jv_exception_info", (builtin_function ("_Jv_exception_info",
build_function_type (ptr_type_node, t), build_function_type (ptr_type_node, endlink),
NOT_BUILT_IN, NULL_PTR)), NOT_BUILT_IN, NULL_PTR)),
NULL_TREE, NULL_TREE); NULL_TREE, NULL_TREE);
TREE_SIDE_EFFECTS (soft_exceptioninfo_call_node) = 1; TREE_SIDE_EFFECTS (soft_exceptioninfo_call_node) = 1;
#if 0 #if 0
t = tree_cons (NULL_TREE, float_type_node, t = tree_cons (NULL_TREE, float_type_node,
build_tree_list (NULL_TREE, float_type_node)); tree_cons (NULL_TREE, float_type_node, endlink));
soft_fmodf_node soft_fmodf_node
= builtin_function ("__builtin_fmodf", = builtin_function ("__builtin_fmodf",
build_function_type (float_type_node, t), build_function_type (float_type_node, t),
...@@ -1535,7 +1535,7 @@ start_java_method (fndecl) ...@@ -1535,7 +1535,7 @@ start_java_method (fndecl)
ptr = &DECL_ARGUMENTS (fndecl); ptr = &DECL_ARGUMENTS (fndecl);
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 parm_name = NULL_TREE, parm_decl; tree parm_name = NULL_TREE, parm_decl;
tree parm_type = TREE_VALUE (tem); tree parm_type = TREE_VALUE (tem);
......
...@@ -1028,23 +1028,7 @@ build_java_binop (op, type, arg1, arg2) ...@@ -1028,23 +1028,7 @@ build_java_binop (op, type, arg1, arg2)
return call; return call;
} }
break; break;
default: ;
#if 0 /* not required */
case PLUS_EXPR:
case MULT_EXPR:
case MINUS_EXPR:
case TRUNC_DIV_EXPR:
case RDIV_EXPR:
/* case REM_EXPR: */
case BIT_AND_EXPR:
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
break;
default:
error ("unknown opcode");
return error_mark_node;
#endif
} }
return fold (build (op, type, arg1, arg2)); return fold (build (op, type, arg1, arg2));
} }
...@@ -1278,7 +1262,7 @@ void ...@@ -1278,7 +1262,7 @@ void
pop_argument_types (arg_types) pop_argument_types (arg_types)
tree arg_types; tree arg_types;
{ {
if (arg_types == NULL_TREE) if (arg_types == end_params_node)
return; return;
if (TREE_CODE (arg_types) == TREE_LIST) if (TREE_CODE (arg_types) == TREE_LIST)
{ {
...@@ -1293,7 +1277,7 @@ tree ...@@ -1293,7 +1277,7 @@ tree
pop_arguments (arg_types) pop_arguments (arg_types)
tree arg_types; tree arg_types;
{ {
if (arg_types == NULL_TREE) if (arg_types == end_params_node)
return NULL_TREE; return NULL_TREE;
if (TREE_CODE (arg_types) == TREE_LIST) if (TREE_CODE (arg_types) == TREE_LIST)
{ {
...@@ -1542,7 +1526,8 @@ expand_invoke (opcode, method_ref_index, nargs) ...@@ -1542,7 +1526,8 @@ expand_invoke (opcode, method_ref_index, nargs)
func = NULL_TREE; func = NULL_TREE;
if (opcode == OPCODE_invokestatic || opcode == OPCODE_invokespecial if (opcode == OPCODE_invokestatic || opcode == OPCODE_invokespecial
|| (opcode == OPCODE_invokevirtual || (opcode == OPCODE_invokevirtual
&& (METHOD_FINAL (method) || CLASS_FINAL (TYPE_NAME (self_type))))) && (METHOD_PRIVATE (method)
|| METHOD_FINAL (method) || CLASS_FINAL (TYPE_NAME (self_type)))))
func = build_known_method_ref (method, method_type, self_type, func = build_known_method_ref (method, method_type, self_type,
method_signature, arg_list); method_signature, arg_list);
else else
......
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