OSDN Git Service

authorbothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 25 Nov 1998 17:10:49 +0000 (17:10 +0000)
committerbothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 25 Nov 1998 17:10:49 +0000 (17:10 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@23870 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/java/decl.c
gcc/java/expr.c

index d6e631e..6224bb6 100644 (file)
@@ -333,6 +333,8 @@ tree length_identifier_node;
 tree this_identifier_node;
 tree super_identifier_node;
 
+tree end_params_node;
+
 /* References to internal libjava functions we use. */
 tree alloc_object_node;
 tree soft_instanceof_node;
@@ -415,6 +417,7 @@ builtin_function (name, type, function_code, library_name)
 void
 init_decl_processing ()
 {
+  register tree endlink;
   tree field;
   tree t;
 
@@ -672,8 +675,10 @@ init_decl_processing ()
   CLASS_LOADED_P (method_type_node) = 1;
   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,
-                build_tree_list (NULL_TREE, int_type_node));
+                tree_cons (NULL_TREE, int_type_node, endlink));
   alloc_object_node = builtin_function ("_Jv_AllocObject",
                                        build_function_type (ptr_type_node, t),
                                        NOT_BUILT_IN, NULL_PTR);
@@ -681,21 +686,18 @@ init_decl_processing ()
                                          build_function_type (void_type_node,
                                                               t),
                                          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",
                                 build_function_type (ptr_type_node, t),
                                 NOT_BUILT_IN, NULL_PTR);
+  t = build_function_type (int_type_node, endlink);
   soft_monitorenter_node 
-      = builtin_function ("_Jv_MonitorEnter",
-                         build_function_type (int_type_node, t),
-                         NOT_BUILT_IN, NULL_PTR);
+      = builtin_function ("_Jv_MonitorEnter", t, NOT_BUILT_IN, NULL_PTR);
   soft_monitorexit_node 
-      = builtin_function ("_Jv_MonitorExit",
-                         build_function_type (int_type_node, t),
-                         NOT_BUILT_IN, NULL_PTR);
+      = builtin_function ("_Jv_MonitorExit", t, NOT_BUILT_IN, NULL_PTR);
   
   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
       = builtin_function ("_Jv_NewArray",
                          build_function_type(ptr_type_node, t),
@@ -703,22 +705,21 @@ init_decl_processing ()
 
   t = tree_cons (NULL_TREE, int_type_node,
                 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_anewarray_node
       = builtin_function ("_Jv_NewObjectArray",
                          build_function_type (ptr_type_node, t),
                          NOT_BUILT_IN, NULL_PTR );
 
   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
       = builtin_function ("_Jv_NewMultiArray",
                          build_function_type (ptr_type_node, t),
                          NOT_BUILT_IN, NULL_PTR );
 
   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
       = builtin_function ("_Jv_ThrowBadArrayIndex", t, 
                          NOT_BUILT_IN, NULL_PTR);
@@ -726,50 +727,49 @@ init_decl_processing ()
   TREE_SIDE_EFFECTS (soft_badarrayindex_node) = 1;
 
   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
     = builtin_function ("_Jv_CheckCast",
                        build_function_type (ptr_type_node, t),
                        NOT_BUILT_IN, NULL_PTR);
   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
     = builtin_function ("_Jv_IsInstanceOf",
                        build_function_type (promoted_boolean_type_node, t),
                        NOT_BUILT_IN, NULL_PTR);
   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
     = builtin_function ("_Jv_CheckArrayStore",
                        build_function_type (void_type_node, t),
                        NOT_BUILT_IN, NULL_PTR);
   t = 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 
     = builtin_function ("_Jv_LookupInterfaceMethod",
                        build_function_type (ptr_type_node, t),
                        NOT_BUILT_IN, NULL_PTR);
   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
     = builtin_function ("__builtin_fmod",
                        build_function_type (double_type_node, t),
                        BUILT_IN_FMOD, "fmod");
 
-  t = build_tree_list (NULL_TREE, void_type_node);
   soft_exceptioninfo_call_node
     = build (CALL_EXPR, 
             ptr_type_node,
             build_address_of 
               (builtin_function ("_Jv_exception_info", 
-                                 build_function_type (ptr_type_node, t),
+                                 build_function_type (ptr_type_node, endlink),
                                  NOT_BUILT_IN, NULL_PTR)),
             NULL_TREE, NULL_TREE);
   TREE_SIDE_EFFECTS (soft_exceptioninfo_call_node) = 1;
 #if 0
   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
     = builtin_function ("__builtin_fmodf",
                        build_function_type (float_type_node, t),
@@ -1535,7 +1535,7 @@ start_java_method (fndecl)
 
   ptr = &DECL_ARGUMENTS (fndecl);
   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_type = TREE_VALUE (tem);
index b19b655..e97569d 100644 (file)
@@ -1028,23 +1028,7 @@ build_java_binop (op, type, arg1, arg2)
          return call;
        }
       break;
-
-#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
-
+    default:  ;
     }
   return fold (build (op, type, arg1, arg2));
 }
@@ -1278,7 +1262,7 @@ void
 pop_argument_types (arg_types)
      tree arg_types;
 {
-  if (arg_types == NULL_TREE)
+  if (arg_types == end_params_node)
     return;
   if (TREE_CODE (arg_types) == TREE_LIST)
     {
@@ -1293,7 +1277,7 @@ tree
 pop_arguments (arg_types)
      tree arg_types;
 {
-  if (arg_types == NULL_TREE)
+  if (arg_types == end_params_node)
     return NULL_TREE;
   if (TREE_CODE (arg_types) == TREE_LIST)
     {
@@ -1542,7 +1526,8 @@ expand_invoke (opcode, method_ref_index, nargs)
   func = NULL_TREE;
   if (opcode == OPCODE_invokestatic || opcode == OPCODE_invokespecial
       || (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,
                                   method_signature, arg_list);
   else