Patch: RFA: fix declarations in gcc/java/decl.c

Tom Tromey tromey@redhat.com
Fri Apr 1 01:33:00 GMT 2005


I happened to notice that _Jv_MonitorEnter was declared incorrectly
in decl.c -- the declaration there did not match what is in libgcj.
Looking further I discovered a number of discrepancies.

This patch cleans them up.  We're still a bit careless about using
ptr_type_node when something like class_type_node would be more
accurate.  I could do that, but it would be a bigger patch...

I'm a little surprised things work as well as they seem to, given some
of these bugs.

Tested on trunk with x86 FC2.  Ok?  And ok for 4.0 after I apply and
build/test there?

Tom


Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* decl.c (java_init_decl_processing): Fix types of
	_Jv_MonitorEnter, _Jv_MonitorExit, _Jv_AllocObject,
	_Jv_AllocObjectNoFinalizer, _Jv_Throw, _Jv_NewPrimArray,
	_Jv_JNI_PopSystemFrame, _Jv_divI, _Jv_remI, _Jv_divJ, _Jv_remJ.

Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/decl.c,v
retrieving revision 1.214
diff -u -r1.214 decl.c
--- decl.c 23 Mar 2005 20:26:58 -0000 1.214
+++ decl.c 1 Apr 2005 01:30:20 -0000
@@ -999,8 +999,7 @@
 
   endlink = end_params_node = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
 
-  t = tree_cons (NULL_TREE, class_ptr_type,
-		 tree_cons (NULL_TREE, int_type_node, endlink));
+  t = tree_cons (NULL_TREE, class_ptr_type, endlink);
   alloc_object_node = builtin_function ("_Jv_AllocObject",
 					build_function_type (ptr_type_node, t),
 					0, NOT_BUILT_IN, NULL, NULL_TREE);
@@ -1018,31 +1017,33 @@
 					  0, NOT_BUILT_IN, NULL, NULL_TREE);
 
   throw_node = builtin_function ("_Jv_Throw",
-				 build_function_type (ptr_type_node, t),
+				 build_function_type (void_type_node, 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 (int_type_node, endlink);
+  t = build_function_type (void_type_node, tree_cons (NULL_TREE, ptr_type_node,
+						      endlink));
   soft_monitorenter_node 
     = builtin_function ("_Jv_MonitorEnter", t, 0, NOT_BUILT_IN,
 			NULL, NULL_TREE);
   soft_monitorexit_node 
     = builtin_function ("_Jv_MonitorExit", t, 0, NOT_BUILT_IN,
 			NULL, NULL_TREE);
-  
-  t = tree_cons (NULL_TREE, int_type_node, 
+
+  t = tree_cons (NULL_TREE, ptr_type_node, 
 		 tree_cons (NULL_TREE, int_type_node, endlink));
   soft_newarray_node
       = builtin_function ("_Jv_NewPrimArray",
-			  build_function_type(ptr_type_node, t),
+			  build_function_type (ptr_type_node, 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)));
+			    tree_cons (NULL_TREE, object_ptr_type_node,
+				       endlink)));
   soft_anewarray_node
       = builtin_function ("_Jv_NewObjectArray",
 			  build_function_type (ptr_type_node, t),
@@ -1128,9 +1129,11 @@
 			0, NOT_BUILT_IN, NULL, NULL_TREE);
   soft_jnipopsystemframe_node
     = builtin_function ("_Jv_JNI_PopSystemFrame",
-			build_function_type (ptr_type_node, t),
+			build_function_type (void_type_node, t),
 			0, NOT_BUILT_IN, NULL, NULL_TREE);
 
+  t = tree_cons (NULL_TREE, int_type_node,
+		 tree_cons (NULL_TREE, int_type_node, endlink));
   soft_idiv_node
     = builtin_function ("_Jv_divI",
 			build_function_type (int_type_node, t),
@@ -1141,6 +1144,8 @@
 			build_function_type (int_type_node, t),
 			0, NOT_BUILT_IN, NULL, NULL_TREE);
 
+  t = tree_cons (NULL_TREE, long_type_node,
+		 tree_cons (NULL_TREE, long_type_node, endlink));
   soft_ldiv_node
     = builtin_function ("_Jv_divJ",
 			build_function_type (long_type_node, t),



More information about the Java-patches mailing list