public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Patch to fix PR9861
@ 2005-09-22 21:13 TJ Laurenzo
  2005-09-22 21:28 ` Ian Lance Taylor
  0 siblings, 1 reply; 47+ messages in thread
From: TJ Laurenzo @ 2005-09-22 21:13 UTC (permalink / raw)
  To: gcc-patches, java-patches

[-- Attachment #1: Type: text/plain, Size: 527 bytes --]

The attached patch corrects PR9861 by including the return type in
mangled names in the C++ and Java compilers for Java class methods. 
This changes the ABI for Java types but does not make any changes to
C++ programs that do not access Java types.

This patch has been tested against CVS HEAD from 9/22/2005 on
i686-pc-linux-gnu (with Jacks added to the source tree) and introduces
no new testsuite failures.

This issue has been discussed on the java mailing list:
http://gcc.gnu.org/ml/java/2005-08/msg00061.html

[-- Attachment #2: pr9861.diff --]
[-- Type: application/octet-stream, Size: 6120 bytes --]

Index: gcc/cp/mangle.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cp/mangle.c,v
retrieving revision 1.128
diff -c -3 -p -r1.128 mangle.c
*** gcc/cp/mangle.c	13 Sep 2005 15:15:31 -0000	1.128
--- gcc/cp/mangle.c	22 Sep 2005 21:05:30 -0000
*************** write_encoding (const tree decl)
*** 742,747 ****
--- 742,748 ----
      {
        tree fn_type;
        tree d;
+       int mangle_ret_type;
  
        if (decl_is_template_id (decl, NULL))
  	{
*************** write_encoding (const tree decl)
*** 760,770 ****
  	  d = decl;
  	}
  
        write_bare_function_type (fn_type,
! 				(!DECL_CONSTRUCTOR_P (decl)
! 				 && !DECL_DESTRUCTOR_P (decl)
! 				 && !DECL_CONV_FN_P (decl)
! 				 && decl_is_template_id (decl, NULL)),
  				d);
      }
  }
--- 761,780 ----
  	  d = decl;
  	}
  
+       mangle_ret_type =
+  	!DECL_CONSTRUCTOR_P (decl)
+  	 && !DECL_DESTRUCTOR_P (decl)
+  	 && !DECL_CONV_FN_P (decl)
+  	 && (
+  		decl_is_template_id (decl, NULL) ||
+  		(	/* Detect java methods and include the return type */
+  			DECL_FUNCTION_MEMBER_P (decl)
+  			&& TYPE_FOR_JAVA ( DECL_CONTEXT(decl) ) 
+  		)
+  	    );
+ 
        write_bare_function_type (fn_type,
!                                 mangle_ret_type,
  				d);
      }
  }
Index: gcc/java/mangle.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/java/mangle.c,v
retrieving revision 1.34
diff -c -3 -p -r1.34 mangle.c
*** gcc/java/mangle.c	25 Jun 2005 00:33:04 -0000	1.34
--- gcc/java/mangle.c	22 Sep 2005 21:05:30 -0000
*************** mangle_method_decl (tree mdecl)
*** 188,193 ****
--- 188,197 ----
    if (TREE_CODE (TREE_TYPE (mdecl)) == METHOD_TYPE)
      arglist = TREE_CHAIN (arglist);
    
+   /* Mangle the return type IF not a constructor */
+   if (!ID_INIT_P(method_name)) 
+     mangle_type(TREE_TYPE(TREE_TYPE(mdecl)));
+   
    /* No arguments is easy. We shortcut it. */
    if (arglist == end_params_node)
      obstack_1grow (mangle_obstack, 'v');
Index: gcc/java/builtins.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/java/builtins.c,v
retrieving revision 1.34
diff -c -3 -p -r1.34 builtins.c
*** gcc/java/builtins.c	18 Sep 2005 19:10:10 -0000	1.34
--- gcc/java/builtins.c	22 Sep 2005 21:05:30 -0000
*************** initialize_builtins (void)
*** 194,236 ****
  		  float_ftype_float_float, "fmodf", BUILTIN_CONST);
  
    define_builtin (BUILT_IN_ACOS, "__builtin_acos",
! 		  double_ftype_double, "_ZN4java4lang4Math4acosEd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_ASIN, "__builtin_asin",
! 		  double_ftype_double, "_ZN4java4lang4Math4asinEd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_ATAN, "__builtin_atan",
! 		  double_ftype_double, "_ZN4java4lang4Math4atanEd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_ATAN2, "__builtin_atan2",
! 		  double_ftype_double_double, "_ZN4java4lang4Math5atan2Edd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_CEIL, "__builtin_ceil",
! 		  double_ftype_double, "_ZN4java4lang4Math4ceilEd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_COS, "__builtin_cos",
! 		  double_ftype_double, "_ZN4java4lang4Math3cosEd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_EXP, "__builtin_exp",
! 		  double_ftype_double, "_ZN4java4lang4Math3expEd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_FLOOR, "__builtin_floor",
! 		  double_ftype_double, "_ZN4java4lang4Math5floorEd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_LOG, "__builtin_log",
! 		  double_ftype_double, "_ZN4java4lang4Math3logEd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_POW, "__builtin_pow",
! 		  double_ftype_double_double, "_ZN4java4lang4Math3powEdd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_SIN, "__builtin_sin",
! 		  double_ftype_double, "_ZN4java4lang4Math3sinEd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_SQRT, "__builtin_sqrt",
! 		  double_ftype_double, "_ZN4java4lang4Math4sqrtEd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_TAN, "__builtin_tan",
! 		  double_ftype_double, "_ZN4java4lang4Math3tanEd",
  		  BUILTIN_CONST);
    
    t = tree_cons (NULL_TREE, boolean_type_node, end_params_node);
--- 194,236 ----
  		  float_ftype_float_float, "fmodf", BUILTIN_CONST);
  
    define_builtin (BUILT_IN_ACOS, "__builtin_acos",
! 		  double_ftype_double, "_ZN4java4lang4Math4acosEdd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_ASIN, "__builtin_asin",
! 		  double_ftype_double, "_ZN4java4lang4Math4asinEdd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_ATAN, "__builtin_atan",
! 		  double_ftype_double, "_ZN4java4lang4Math4atanEdd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_ATAN2, "__builtin_atan2",
! 		  double_ftype_double_double, "_ZN4java4lang4Math5atan2Eddd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_CEIL, "__builtin_ceil",
! 		  double_ftype_double, "_ZN4java4lang4Math4ceilEdd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_COS, "__builtin_cos",
! 		  double_ftype_double, "_ZN4java4lang4Math3cosEdd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_EXP, "__builtin_exp",
! 		  double_ftype_double, "_ZN4java4lang4Math3expEdd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_FLOOR, "__builtin_floor",
! 		  double_ftype_double, "_ZN4java4lang4Math5floorEdd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_LOG, "__builtin_log",
! 		  double_ftype_double, "_ZN4java4lang4Math3logEdd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_POW, "__builtin_pow",
! 		  double_ftype_double_double, "_ZN4java4lang4Math3powEddd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_SIN, "__builtin_sin",
! 		  double_ftype_double, "_ZN4java4lang4Math3sinEdd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_SQRT, "__builtin_sqrt",
! 		  double_ftype_double, "_ZN4java4lang4Math4sqrtEdd",
  		  BUILTIN_CONST);
    define_builtin (BUILT_IN_TAN, "__builtin_tan",
! 		  double_ftype_double, "_ZN4java4lang4Math3tanEdd",
  		  BUILTIN_CONST);
    
    t = tree_cons (NULL_TREE, boolean_type_node, end_params_node);

[-- Attachment #3: ChangeLog-Java.txt --]
[-- Type: text/plain, Size: 225 bytes --]

2005-09-22   Terry Laurenzo   <tlaurenzo@gmail.com>

	* mangle.c (mangle_method_decl): Mangle return type of normal methods
	* builtins.c (initialize_builtins): Change builtin mangled name 
	constants to include return types

[-- Attachment #4: ChangeLog-cp.txt --]
[-- Type: text/plain, Size: 131 bytes --]

2005-09-22   Terry Laurenzo   <tlaurenzo@gmail.com>

	* mangle.c (write_encoding): Mangle return type for methods of Java
	classes

^ permalink raw reply	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2005-09-27 18:54 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-22 21:13 Patch to fix PR9861 TJ Laurenzo
2005-09-22 21:28 ` Ian Lance Taylor
2005-09-22 21:33   ` Ian Lance Taylor
2005-09-22 21:48     ` David Daney
2005-09-22 22:06     ` TJ Laurenzo
2005-09-22 22:12       ` Ian Lance Taylor
2005-09-23 18:57         ` TJ Laurenzo
2005-09-26 15:04           ` Andrew Haley
2005-09-26 15:30             ` TJ Laurenzo
2005-09-26 15:42               ` Andrew Haley
2005-09-26 15:59                 ` TJ Laurenzo
2005-09-26 16:32                   ` TJ Laurenzo
2005-09-26 17:17                   ` Andrew Haley
2005-09-26 17:28                     ` Ian Lance Taylor
2005-09-26 17:43                       ` Andrew Haley
2005-09-26 17:33                     ` TJ Laurenzo
2005-09-26 17:46                       ` Andrew Haley
2005-09-26 18:02                         ` Andrew Haley
2005-09-26 18:08                           ` Daniel Jacobowitz
2005-09-26 18:09                           ` TJ Laurenzo
2005-09-26 18:12                             ` Andrew Haley
2005-09-26 18:25                               ` TJ Laurenzo
2005-09-26 18:33                                 ` Andrew Haley
2005-09-26 18:38                                   ` Andrew Haley
2005-09-26 18:41                                     ` Ian Lance Taylor
2005-09-26 18:55                                       ` Andrew Haley
2005-09-26 19:35                                         ` Bryce McKinlay
2005-09-26 23:33                                           ` TJ Laurenzo
2005-09-27 10:21                                             ` Andrew Haley
2005-09-27 13:44                                               ` Andrew Haley
2005-09-27 13:57                                                 ` TJ Laurenzo
2005-09-27 18:04                                                   ` Tom Tromey
2005-09-27 18:32                                                     ` TJ Laurenzo
2005-09-27 18:54                                                       ` Andrew Haley
2005-09-27 18:33                                                     ` Andrew Haley
2005-09-27 14:39                                                 ` Ian Lance Taylor
2005-09-27 16:31                                                   ` Andrew Haley
2005-09-26 18:03                         ` TJ Laurenzo
2005-09-26 18:05                           ` Andrew Haley
2005-09-26 18:21                             ` Ian Lance Taylor
2005-09-26 18:24                               ` Andrew Haley
2005-09-26 17:50                       ` David Daney
2005-09-23  1:39     ` Ranjit Mathew
2005-09-23  3:50       ` TJ Laurenzo
2005-09-22 22:01   ` TJ Laurenzo
2005-09-22 22:08     ` Ian Lance Taylor
2005-09-22 22:11       ` TJ Laurenzo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).