diff options
author | Terry Laurenzo <tlaurenzo@gmail.com> | 2005-12-11 01:34:02 +0000 |
---|---|---|
committer | Terry Laurenzo <tlaurenzo@gcc.gnu.org> | 2005-12-11 01:34:02 +0000 |
commit | 92aed1cbf42362b47fa6db66122d33278d7a4ea3 (patch) | |
tree | d3a6af3b149154654e7557325e0a2d26a3b83556 /gcc | |
parent | b6105bf2c397ba0aba21454a17e013974e0fe657 (diff) | |
download | gcc-92aed1cbf42362b47fa6db66122d33278d7a4ea3.zip gcc-92aed1cbf42362b47fa6db66122d33278d7a4ea3.tar.gz gcc-92aed1cbf42362b47fa6db66122d33278d7a4ea3.tar.bz2 |
Fixes java/PR9861
From-SVN: r108374
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/mangle.c | 26 | ||||
-rw-r--r-- | gcc/java/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/java/builtins.c | 26 | ||||
-rw-r--r-- | gcc/java/mangle.c | 8 |
5 files changed, 59 insertions, 15 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 633e4d8..13b075b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2005-12-10 Terry Laurenzo <tlaurenzo@gmail.com> + + PR java/9861 + * mangle.c (write_bare_function_type): Mangle return type for + methods of Java classes + 2005-12-08 Théodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr> * call.c (build_conditional_expr): Print types in error messages. diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index c654d76..3b844b5 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -1858,16 +1858,38 @@ write_function_type (const tree type) is mangled before the parameter types. If non-NULL, DECL is FUNCTION_DECL for the function whose type is being emitted. - <bare-function-type> ::= </signature/ type>+ */ + If DECL is a member of a Java type, then a literal 'J' + is output and the return type is mangled as if INCLUDE_RETURN_TYPE + were nonzero. + + <bare-function-type> ::= [J]</signature/ type>+ */ static void write_bare_function_type (const tree type, const int include_return_type_p, const tree decl) { + int java_method_p; + MANGLE_TRACE_TREE ("bare-function-type", type); + /* Detect Java methods and emit special encoding. */ + if (decl != NULL + && DECL_FUNCTION_MEMBER_P (decl) + && TYPE_FOR_JAVA (DECL_CONTEXT (decl)) + && !DECL_CONSTRUCTOR_P (decl) + && !DECL_DESTRUCTOR_P (decl) + && !DECL_CONV_FN_P (decl)) + { + java_method_p = 1; + write_char ('J'); + } + else + { + java_method_p = 0; + } + /* Mangle the return type, if requested. */ - if (include_return_type_p) + if (include_return_type_p || java_method_p) write_type (TREE_TYPE (type)); /* Now mangle the types of the arguments. */ diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 0dc39ad..43859b7 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,11 @@ +2005-12-10 Terry Laurenzo <tlaurenzo@gmail.com> + + PR java/9861 + * mangle.c (mangle_method_decl): Mangle Java methods by prepending 'J' + to bare_function_type and including the return type + * builtins.c (initialize_builtins) : Change builtin mangled name + constants to conform to new mangling scheme + 2005-12-08 Andrew Haley <aph@redhat.com> PR libgcj/25265 diff --git a/gcc/java/builtins.c b/gcc/java/builtins.c index 2ea9e57..ff6da98 100644 --- a/gcc/java/builtins.c +++ b/gcc/java/builtins.c @@ -194,43 +194,43 @@ initialize_builtins (void) float_ftype_float_float, "fmodf", BUILTIN_CONST); define_builtin (BUILT_IN_ACOS, "__builtin_acos", - double_ftype_double, "_ZN4java4lang4Math4acosEd", + double_ftype_double, "_ZN4java4lang4Math4acosEJdd", BUILTIN_CONST); define_builtin (BUILT_IN_ASIN, "__builtin_asin", - double_ftype_double, "_ZN4java4lang4Math4asinEd", + double_ftype_double, "_ZN4java4lang4Math4asinEJdd", BUILTIN_CONST); define_builtin (BUILT_IN_ATAN, "__builtin_atan", - double_ftype_double, "_ZN4java4lang4Math4atanEd", + double_ftype_double, "_ZN4java4lang4Math4atanEJdd", BUILTIN_CONST); define_builtin (BUILT_IN_ATAN2, "__builtin_atan2", - double_ftype_double_double, "_ZN4java4lang4Math5atan2Edd", + double_ftype_double_double, "_ZN4java4lang4Math5atan2EJddd", BUILTIN_CONST); define_builtin (BUILT_IN_CEIL, "__builtin_ceil", - double_ftype_double, "_ZN4java4lang4Math4ceilEd", + double_ftype_double, "_ZN4java4lang4Math4ceilEJdd", BUILTIN_CONST); define_builtin (BUILT_IN_COS, "__builtin_cos", - double_ftype_double, "_ZN4java4lang4Math3cosEd", + double_ftype_double, "_ZN4java4lang4Math3cosEJdd", BUILTIN_CONST); define_builtin (BUILT_IN_EXP, "__builtin_exp", - double_ftype_double, "_ZN4java4lang4Math3expEd", + double_ftype_double, "_ZN4java4lang4Math3expEJdd", BUILTIN_CONST); define_builtin (BUILT_IN_FLOOR, "__builtin_floor", - double_ftype_double, "_ZN4java4lang4Math5floorEd", + double_ftype_double, "_ZN4java4lang4Math5floorEJdd", BUILTIN_CONST); define_builtin (BUILT_IN_LOG, "__builtin_log", - double_ftype_double, "_ZN4java4lang4Math3logEd", + double_ftype_double, "_ZN4java4lang4Math3logEJdd", BUILTIN_CONST); define_builtin (BUILT_IN_POW, "__builtin_pow", - double_ftype_double_double, "_ZN4java4lang4Math3powEdd", + double_ftype_double_double, "_ZN4java4lang4Math3powEJddd", BUILTIN_CONST); define_builtin (BUILT_IN_SIN, "__builtin_sin", - double_ftype_double, "_ZN4java4lang4Math3sinEd", + double_ftype_double, "_ZN4java4lang4Math3sinEJdd", BUILTIN_CONST); define_builtin (BUILT_IN_SQRT, "__builtin_sqrt", - double_ftype_double, "_ZN4java4lang4Math4sqrtEd", + double_ftype_double, "_ZN4java4lang4Math4sqrtEJdd", BUILTIN_CONST); define_builtin (BUILT_IN_TAN, "__builtin_tan", - double_ftype_double, "_ZN4java4lang4Math3tanEd", + double_ftype_double, "_ZN4java4lang4Math3tanEJdd", BUILTIN_CONST); t = tree_cons (NULL_TREE, boolean_type_node, end_params_node); diff --git a/gcc/java/mangle.c b/gcc/java/mangle.c index e8df917..372c946 100644 --- a/gcc/java/mangle.c +++ b/gcc/java/mangle.c @@ -188,6 +188,14 @@ mangle_method_decl (tree mdecl) if (TREE_CODE (TREE_TYPE (mdecl)) == METHOD_TYPE) arglist = TREE_CHAIN (arglist); + /* Output literal 'J' and mangle the return type IF not a + constructor. */ + if (!ID_INIT_P (method_name)) + { + obstack_1grow (mangle_obstack, 'J'); + mangle_type(TREE_TYPE(TREE_TYPE(mdecl))); + } + /* No arguments is easy. We shortcut it. */ if (arglist == end_params_node) obstack_1grow (mangle_obstack, 'v'); |