Patchwork use build_function_type_list in the Java FE

login
register
mail settings
Submitter Nathan Froyd
Date Oct. 11, 2010, 1:37 a.m.
Message ID <20101011013731.GC24720@nightcrawler>
Download mbox | patch
Permalink /patch/67377/
State New
Headers show

Comments

Nathan Froyd - Oct. 11, 2010, 1:37 a.m.
As $SUBJECT suggests.  There's not much more to explain.

Bootstrapped on x86_64-unknown-linux-gnu.  OK to commit?

-Nathan

	* decl.c (java_init_decl_processing): Use build_function_type_list
	instead of build_function_type.
	* jcf-parse.c (java_emit_static_constructor): Likewise.
	* builtins.c (initialize_builtins): Likewise.
Andrew Haley - Oct. 11, 2010, 9:27 a.m.
On 10/11/2010 02:37 AM, Nathan Froyd wrote:
> As $SUBJECT suggests.  There's not much more to explain.
> 
> Bootstrapped on x86_64-unknown-linux-gnu.  OK to commit?
> 
> -Nathan
> 
> 	* decl.c (java_init_decl_processing): Use build_function_type_list
> 	instead of build_function_type.
> 	* jcf-parse.c (java_emit_static_constructor): Likewise.
> 	* builtins.c (initialize_builtins): Likewise.

Sure, that's fine.  I presume the bootstrap included the libgcj testsuite.

Andrew.
Nathan Froyd - Oct. 11, 2010, 4:25 p.m.
On Mon, Oct 11, 2010 at 10:27:23AM +0100, Andrew Haley wrote:
> On 10/11/2010 02:37 AM, Nathan Froyd wrote:
> > 	* decl.c (java_init_decl_processing): Use build_function_type_list
> > 	instead of build_function_type.
> > 	* jcf-parse.c (java_emit_static_constructor): Likewise.
> > 	* builtins.c (initialize_builtins): Likewise.
> 
> Sure, that's fine.  I presume the bootstrap included the libgcj testsuite.

Whyever would you think that somebody would bootstrap without java... ;)

Yes, it did.  Thanks for the review; I've committed the patch.

-Nathan

Patch

diff --git a/gcc/java/builtins.c b/gcc/java/builtins.c
index 527c4e6..550be3d 100644
--- a/gcc/java/builtins.c
+++ b/gcc/java/builtins.c
@@ -498,7 +498,6 @@  initialize_builtins (void)
   tree double_ftype_double, double_ftype_double_double;
   tree float_ftype_float_float;
   tree boolean_ftype_boolean_boolean;
-  tree t;
   int i;
 
   for (i = 0; java_builtins[i].builtin_code != END_BUILTINS; ++i)
@@ -512,14 +511,15 @@  initialize_builtins (void)
 
   void_list_node = end_params_node;
 
-  t = tree_cons (NULL_TREE, float_type_node, end_params_node);
-  t = tree_cons (NULL_TREE, float_type_node, t);
-  float_ftype_float_float = build_function_type (float_type_node, t);
+  float_ftype_float_float
+    = build_function_type_list (float_type_node,
+                                float_type_node, float_type_node, NULL_TREE);
 
-  t = tree_cons (NULL_TREE, double_type_node, end_params_node);
-  double_ftype_double = build_function_type (double_type_node, t);
-  t = tree_cons (NULL_TREE, double_type_node, t);
-  double_ftype_double_double = build_function_type (double_type_node, t);
+  double_ftype_double
+    = build_function_type_list (double_type_node, double_type_node, NULL_TREE);
+  double_ftype_double_double
+    = build_function_type_list (double_type_node,
+                                double_type_node, double_type_node, NULL_TREE);
 
   define_builtin (BUILT_IN_FMOD, "__builtin_fmod",
 		  double_ftype_double_double, "fmod", BUILTIN_CONST);
@@ -566,9 +566,10 @@  initialize_builtins (void)
 		  double_ftype_double, "_ZN4java4lang4Math3tanEJdd",
 		  BUILTIN_CONST);
   
-  t = tree_cons (NULL_TREE, boolean_type_node, end_params_node);
-  t = tree_cons (NULL_TREE, boolean_type_node, t);
-  boolean_ftype_boolean_boolean = build_function_type (boolean_type_node, t);
+  boolean_ftype_boolean_boolean
+    = build_function_type_list (boolean_type_node,
+                                boolean_type_node, boolean_type_node,
+                                NULL_TREE);
   define_builtin (BUILT_IN_EXPECT, "__builtin_expect", 
 		  boolean_ftype_boolean_boolean,
 		  "__builtin_expect",
@@ -588,7 +589,7 @@  initialize_builtins (void)
 					    int_type_node, NULL_TREE), 
 		  "__sync_bool_compare_and_swap_8", 0);
   define_builtin (BUILT_IN_SYNCHRONIZE, "__sync_synchronize",
-		  build_function_type (void_type_node, void_list_node),
+		  build_function_type_list (void_type_node, NULL_TREE),
 		  "__sync_synchronize", BUILTIN_NOTHROW);
   
   define_builtin (BUILT_IN_RETURN_ADDRESS, "__builtin_return_address",
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index 36a2c29..a7557a3 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -555,7 +555,6 @@  parse_version (void)
 void
 java_init_decl_processing (void)
 {
-  tree endlink;
   tree field = NULL_TREE;
   tree t;
 
@@ -987,40 +986,35 @@  java_init_decl_processing (void)
   build_decl (BUILTINS_LOCATION,
 	      TYPE_DECL, get_identifier ("Method"), method_type_node);
 
-  endlink = end_params_node = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
+  end_params_node = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
 
-  t = tree_cons (NULL_TREE, class_ptr_type, endlink);
-  alloc_object_node = add_builtin_function ("_Jv_AllocObject",
-					    build_function_type (ptr_type_node, t),
+  t = build_function_type_list (ptr_type_node, class_ptr_type, NULL_TREE);
+  alloc_object_node = add_builtin_function ("_Jv_AllocObject", t,
 					    0, NOT_BUILT_IN, NULL, NULL_TREE);
   DECL_IS_MALLOC (alloc_object_node) = 1;
   alloc_no_finalizer_node =
-    add_builtin_function ("_Jv_AllocObjectNoFinalizer",
-			  build_function_type (ptr_type_node, t),
+    add_builtin_function ("_Jv_AllocObjectNoFinalizer", t,
 			  0, NOT_BUILT_IN, NULL, NULL_TREE);
   DECL_IS_MALLOC (alloc_no_finalizer_node) = 1;
 
-  t = tree_cons (NULL_TREE, ptr_type_node, endlink);
-  soft_initclass_node = add_builtin_function ("_Jv_InitClass",
-					      build_function_type (void_type_node,
-								   t),
+  t = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
+  soft_initclass_node = add_builtin_function ("_Jv_InitClass", t,
 					      0, NOT_BUILT_IN, NULL, NULL_TREE);
-  t = tree_cons (NULL_TREE, class_ptr_type,
-		 tree_cons (NULL_TREE, int_type_node, endlink));
+  t = build_function_type_list (ptr_type_node,
+                                class_ptr_type, int_type_node, NULL_TREE);
   soft_resolvepoolentry_node
-    = add_builtin_function ("_Jv_ResolvePoolEntry",
-			    build_function_type (ptr_type_node, t),
+    = add_builtin_function ("_Jv_ResolvePoolEntry", t,
 			    0,NOT_BUILT_IN, NULL, NULL_TREE);
   DECL_PURE_P (soft_resolvepoolentry_node) = 1;
-  throw_node = add_builtin_function ("_Jv_Throw",
-				     build_function_type (void_type_node, t),
+  t = build_function_type_list (void_type_node,
+                                class_ptr_type, int_type_node, NULL_TREE);
+  throw_node = add_builtin_function ("_Jv_Throw", t,
 				     0, NOT_BUILT_IN, NULL, NULL_TREE);
   /* Mark throw_nodes as `noreturn' functions with side effects.  */
   TREE_THIS_VOLATILE (throw_node) = 1;
   TREE_SIDE_EFFECTS (throw_node) = 1;
 
-  t = build_function_type (void_type_node, tree_cons (NULL_TREE, ptr_type_node,
-						      endlink));
+  t = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
   soft_monitorenter_node
     = add_builtin_function ("_Jv_MonitorEnter", t, 0, NOT_BUILT_IN,
 			    NULL, NULL_TREE);
@@ -1028,36 +1022,30 @@  java_init_decl_processing (void)
     = add_builtin_function ("_Jv_MonitorExit", t, 0, NOT_BUILT_IN,
 			    NULL, NULL_TREE);
 
-  t = tree_cons (NULL_TREE, ptr_type_node,
-		 tree_cons (NULL_TREE, int_type_node, endlink));
+  t = build_function_type_list (ptr_type_node,
+                                ptr_type_node, int_type_node, NULL_TREE);
   soft_newarray_node
-      = add_builtin_function ("_Jv_NewPrimArray",
-			      build_function_type (ptr_type_node, t),
+      = add_builtin_function ("_Jv_NewPrimArray", t,
 			      0, NOT_BUILT_IN, NULL, NULL_TREE);
   DECL_IS_MALLOC (soft_newarray_node) = 1;
 
-  t = tree_cons (NULL_TREE, int_type_node,
-		 tree_cons (NULL_TREE, class_ptr_type,
-			    tree_cons (NULL_TREE, object_ptr_type_node,
-				       endlink)));
+  t = build_function_type_list (ptr_type_node,
+                                int_type_node, class_ptr_type,
+                                object_ptr_type_node, NULL_TREE);
   soft_anewarray_node
-      = add_builtin_function ("_Jv_NewObjectArray",
-			      build_function_type (ptr_type_node, t),
+      = add_builtin_function ("_Jv_NewObjectArray", t,
 			      0, NOT_BUILT_IN, NULL, NULL_TREE);
   DECL_IS_MALLOC (soft_anewarray_node) = 1;
 
-  /* There is no endlink here because _Jv_NewMultiArray is a varargs
-     function.  */
-  t = tree_cons (NULL_TREE, ptr_type_node,
-		 tree_cons (NULL_TREE, int_type_node, NULL_TREE));
+  t = build_varargs_function_type_list (ptr_type_node,
+                                        ptr_type_node, int_type_node,
+                                        NULL_TREE);
   soft_multianewarray_node
-      = add_builtin_function ("_Jv_NewMultiArray",
-			      build_function_type (ptr_type_node, t),
+      = add_builtin_function ("_Jv_NewMultiArray", t,
 			      0, NOT_BUILT_IN, NULL, NULL_TREE);
   DECL_IS_MALLOC (soft_multianewarray_node) = 1;
 
-  t = build_function_type (void_type_node, 
-			   tree_cons (NULL_TREE, int_type_node, endlink));
+  t = build_function_type_list (void_type_node, int_type_node, NULL_TREE);
   soft_badarrayindex_node
       = add_builtin_function ("_Jv_ThrowBadArrayIndex", t,
 			      0, NOT_BUILT_IN, NULL, NULL_TREE);
@@ -1066,9 +1054,9 @@  java_init_decl_processing (void)
   TREE_THIS_VOLATILE (soft_badarrayindex_node) = 1;
   TREE_SIDE_EFFECTS (soft_badarrayindex_node) = 1;
 
+  t = build_function_type_list (void_type_node, NULL_TREE);
   soft_nullpointer_node
-    = add_builtin_function ("_Jv_ThrowNullPointerException",
-			    build_function_type (void_type_node, endlink),
+    = add_builtin_function ("_Jv_ThrowNullPointerException", t,
 			    0, NOT_BUILT_IN, NULL, NULL_TREE);
   /* Mark soft_nullpointer_node as a `noreturn' function with side
      effects.  */
@@ -1076,8 +1064,7 @@  java_init_decl_processing (void)
   TREE_SIDE_EFFECTS (soft_nullpointer_node) = 1;
 
   soft_abstractmethod_node
-    = add_builtin_function ("_Jv_ThrowAbstractMethodError",
-			    build_function_type (void_type_node, endlink),
+    = add_builtin_function ("_Jv_ThrowAbstractMethodError", t,
 			    0, NOT_BUILT_IN, NULL, NULL_TREE);
   /* Mark soft_abstractmethod_node as a `noreturn' function with side
      effects.  */
@@ -1085,95 +1072,85 @@  java_init_decl_processing (void)
   TREE_SIDE_EFFECTS (soft_abstractmethod_node) = 1;
 
   soft_nosuchfield_node
-    = add_builtin_function ("_Jv_ThrowNoSuchFieldError",
-			    build_function_type (void_type_node, endlink),
+    = add_builtin_function ("_Jv_ThrowNoSuchFieldError", t,
 			    0, NOT_BUILT_IN, NULL, NULL_TREE);
   /* Mark soft_nosuchfield_node as a `noreturn' function with side
      effects.  */
   TREE_THIS_VOLATILE (soft_nosuchfield_node) = 1;
   TREE_SIDE_EFFECTS (soft_nosuchfield_node) = 1;
 
-  t = tree_cons (NULL_TREE, class_ptr_type,
-		 tree_cons (NULL_TREE, object_ptr_type_node, endlink));
+  t = build_function_type_list (ptr_type_node,
+                                class_ptr_type, object_ptr_type_node,
+                                NULL_TREE);
   soft_checkcast_node
-    = add_builtin_function ("_Jv_CheckCast",
-			    build_function_type (ptr_type_node, t),
+    = add_builtin_function ("_Jv_CheckCast", t,
 			    0, NOT_BUILT_IN, NULL, NULL_TREE);
-  t = tree_cons (NULL_TREE, object_ptr_type_node,
-		 tree_cons (NULL_TREE, class_ptr_type, endlink));
+  t = build_function_type_list (boolean_type_node,
+                                object_ptr_type_node, class_ptr_type,
+                                NULL_TREE);
   soft_instanceof_node
-    = add_builtin_function ("_Jv_IsInstanceOf",
-			    build_function_type (boolean_type_node, t),
+    = add_builtin_function ("_Jv_IsInstanceOf", t,
 			    0, NOT_BUILT_IN, NULL, NULL_TREE);
   DECL_PURE_P (soft_instanceof_node) = 1;
-  t = tree_cons (NULL_TREE, object_ptr_type_node,
-		 tree_cons (NULL_TREE, object_ptr_type_node, endlink));
+  t = build_function_type_list (void_type_node,
+                                object_ptr_type_node, object_ptr_type_node,
+                                NULL_TREE);
   soft_checkarraystore_node
-    = add_builtin_function ("_Jv_CheckArrayStore",
-			    build_function_type (void_type_node, t),
+    = add_builtin_function ("_Jv_CheckArrayStore", t,
 			    0, NOT_BUILT_IN, NULL, NULL_TREE);
-  t = tree_cons (NULL_TREE, ptr_type_node,
-		 tree_cons (NULL_TREE, ptr_type_node,
-			    tree_cons (NULL_TREE, int_type_node, endlink)));
+  t = build_function_type_list (ptr_type_node,
+                                ptr_type_node, ptr_type_node, int_type_node,
+                                NULL_TREE);
   soft_lookupinterfacemethod_node
-    = add_builtin_function ("_Jv_LookupInterfaceMethodIdx",
-			    build_function_type (ptr_type_node, t),
+    = add_builtin_function ("_Jv_LookupInterfaceMethodIdx", t,
 			    0, NOT_BUILT_IN, NULL, NULL_TREE);
   DECL_PURE_P (soft_lookupinterfacemethod_node) = 1;
-  t = tree_cons (NULL_TREE, ptr_type_node,
-		 tree_cons (NULL_TREE, ptr_type_node,
-			    tree_cons (NULL_TREE, ptr_type_node, endlink)));
+
+  t = build_function_type_list (ptr_type_node,
+                                ptr_type_node, ptr_type_node, ptr_type_node,
+                                NULL_TREE);
   soft_lookupinterfacemethodbyname_node
-    = add_builtin_function ("_Jv_LookupInterfaceMethod",
-			    build_function_type (ptr_type_node, t),
+    = add_builtin_function ("_Jv_LookupInterfaceMethod", t,
 			    0, NOT_BUILT_IN, NULL, NULL_TREE);
-  t = tree_cons (NULL_TREE, object_ptr_type_node,
-		 tree_cons (NULL_TREE, ptr_type_node,
-			    tree_cons (NULL_TREE, ptr_type_node, 
-			               tree_cons (NULL_TREE, int_type_node, 
-				                  endlink))));
+  t = build_function_type_list (ptr_type_node,
+                                object_ptr_type_node, ptr_type_node,
+                                ptr_type_node, int_type_node, NULL_TREE);
   soft_lookupjnimethod_node
-    = add_builtin_function ("_Jv_LookupJNIMethod",
-			    build_function_type (ptr_type_node, t),
+    = add_builtin_function ("_Jv_LookupJNIMethod", t,
 			    0, NOT_BUILT_IN, NULL, NULL_TREE);
-  t = tree_cons (NULL_TREE, ptr_type_node, endlink);
+  t = build_function_type_list (ptr_type_node, ptr_type_node, NULL_TREE);
   soft_getjnienvnewframe_node
-    = add_builtin_function ("_Jv_GetJNIEnvNewFrame",
-			    build_function_type (ptr_type_node, t),
+    = add_builtin_function ("_Jv_GetJNIEnvNewFrame", t,
 			    0, NOT_BUILT_IN, NULL, NULL_TREE);
+  t = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
   soft_jnipopsystemframe_node
-    = add_builtin_function ("_Jv_JNI_PopSystemFrame",
-			    build_function_type (void_type_node, t),
+    = add_builtin_function ("_Jv_JNI_PopSystemFrame", t,
 			    0, NOT_BUILT_IN, NULL, NULL_TREE);
 
-  t = tree_cons (NULL_TREE, object_ptr_type_node, endlink);
+  t = build_function_type_list (object_ptr_type_node,
+                                object_ptr_type_node, NULL_TREE);
   soft_unwrapjni_node
-    = add_builtin_function ("_Jv_UnwrapJNIweakReference",
-			    build_function_type (object_ptr_type_node, t),
+    = add_builtin_function ("_Jv_UnwrapJNIweakReference", t,
 			    0, NOT_BUILT_IN, NULL, NULL_TREE);
 
-  t = tree_cons (NULL_TREE, int_type_node,
-		 tree_cons (NULL_TREE, int_type_node, endlink));
+  t = build_function_type_list (int_type_node,
+                                int_type_node, int_type_node, NULL_TREE);
   soft_idiv_node
-    = add_builtin_function ("_Jv_divI",
-			    build_function_type (int_type_node, t),
+    = add_builtin_function ("_Jv_divI", t,
 			    0, NOT_BUILT_IN, NULL, NULL_TREE);
 
   soft_irem_node
-    = add_builtin_function ("_Jv_remI",
-			    build_function_type (int_type_node, t),
+    = add_builtin_function ("_Jv_remI", t,
 			    0, NOT_BUILT_IN, NULL, NULL_TREE);
 
-  t = tree_cons (NULL_TREE, long_type_node,
-		 tree_cons (NULL_TREE, long_type_node, endlink));
+  t = build_function_type_list (long_type_node,
+                                long_type_node, long_type_node, NULL_TREE);
   soft_ldiv_node
-    = add_builtin_function ("_Jv_divJ",
-			    build_function_type (long_type_node, t),
+    = add_builtin_function ("_Jv_divJ", t,
 			    0, NOT_BUILT_IN, NULL, NULL_TREE);
 
   soft_lrem_node
-    = add_builtin_function ("_Jv_remJ",
-			    build_function_type (long_type_node, t),
+    = add_builtin_function ("_Jv_remJ", t,
 			    0, NOT_BUILT_IN, NULL, NULL_TREE);
 
   initialize_builtins ();
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index 908ed63..6547b39 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -1704,7 +1704,7 @@  java_emit_static_constructor (void)
 
       tree decl 
 	= build_decl (input_location, FUNCTION_DECL, name,
-		      build_function_type (void_type_node, void_list_node));
+                      build_function_type_list (void_type_node, NULL_TREE));
 
       tree resdecl = build_decl (input_location,
 				 RESULT_DECL, NULL_TREE, void_type_node);