diff options
author | Alexandre Petit-Bianco <apbianco@cygnus.com> | 2001-01-10 19:20:52 +0000 |
---|---|---|
committer | Alexandre Petit-Bianco <apbianco@gcc.gnu.org> | 2001-01-10 11:20:52 -0800 |
commit | 23d4e4cc4acd1dbf796a8e9c9073e7392e5c36b8 (patch) | |
tree | 1dae871d7397de2419ccb90ff86a10f59790e08e /gcc | |
parent | 0adc3d8a92f1a6181f2f170a2019f2bc2a1b3c53 (diff) | |
download | gcc-23d4e4cc4acd1dbf796a8e9c9073e7392e5c36b8.zip gcc-23d4e4cc4acd1dbf796a8e9c9073e7392e5c36b8.tar.gz gcc-23d4e4cc4acd1dbf796a8e9c9073e7392e5c36b8.tar.bz2 |
decl2.c (acceptable_java_type): Allow references too.
2001-01-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
* decl2.c (acceptable_java_type): Allow references too.
* init.c (build_java_class_ref): When using the new ABI, search
`class$' and have it mangled with `mangle_decl.'
* mangle.c (write_java_integer_type_codes): New function.
(write_builtin_type): Detect and mangle Java integer and real
types.
(http://gcc.gnu.org/ml/gcc-patches/2001-01/msg00756.html)
From-SVN: r38875
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 2 | ||||
-rw-r--r-- | gcc/cp/init.c | 18 | ||||
-rw-r--r-- | gcc/cp/mangle.c | 39 |
4 files changed, 64 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c10022c..d431ffe 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -57,6 +57,15 @@ Set IDENTIFIER_CLASS_VALUE when replacing an existing binding. Don't set TREE_VALUE on the class_shadowed list. +2001-01-07 Alexandre Petit-Bianco <apbianco@cygnus.com> + + * decl2.c (acceptable_java_type): Allow references too. + * init.c (build_java_class_ref): When using the new ABI, search + `class$' and have it mangled with `mangle_decl.' + * mangle.c (write_java_integer_type_codes): New function. + (write_builtin_type): Detect and mangle Java integer and real + types. + 2001-01-07 Mark Mitchell <mark@codesourcery.com> * decl2.c (grokfield): Don't accept `asm' specifiers for diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 4da673b..c41126a 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1336,7 +1336,7 @@ acceptable_java_type (type) { if (TREE_CODE (type) == VOID_TYPE || TYPE_FOR_JAVA (type)) return 1; - if (TREE_CODE (type) == POINTER_TYPE) + if (TREE_CODE (type) == POINTER_TYPE || TREE_CODE (type) == REFERENCE_TYPE) { type = TREE_TYPE (type); if (TREE_CODE (type) == RECORD_TYPE) diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 9d20955..e9eddf9 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2206,7 +2206,23 @@ build_java_class_ref (type) fatal("call to Java constructor, while `jclass' undefined"); jclass_node = TREE_TYPE (jclass_node); } - name = build_static_name (type, CL_suffix); + + /* Mangle the class$ field, new and old ABI */ + if (flag_new_abi) + { + tree field; + for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) + if (DECL_NAME (field) == CL_suffix) + { + name = mangle_decl (field); + break; + } + if (!field) + fatal ("Can't find class$"); + } + else + name = build_static_name (type, CL_suffix); + class_decl = IDENTIFIER_GLOBAL_VALUE (name); if (class_decl == NULL_TREE) { diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 001a9e8..b4bb686 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -189,6 +189,10 @@ static inline void start_mangling PARAMS ((void)); static inline const char *finish_mangling PARAMS ((void)); static tree mangle_special_for_type PARAMS ((tree, const char *)); +/* Foreign language functions. */ + +static void write_java_integer_type_codes PARAMS ((tree)); + /* Append a single character to the end of the mangled representation. */ #define write_char(CHAR) \ @@ -1446,6 +1450,8 @@ write_builtin_type (type) integer_type_nodes. */ if (type == wchar_type_node) write_char ('w'); + if (TYPE_FOR_JAVA (type)) + write_java_integer_type_codes (type); else { size_t itk; @@ -1473,9 +1479,11 @@ write_builtin_type (type) break; case REAL_TYPE: - if (type == float_type_node) + if (type == float_type_node + || type == java_float_type_node) write_char ('f'); - else if (type == double_type_node) + else if (type == double_type_node + || type == java_double_type_node) write_char ('d'); else if (type == long_double_type_node) write_char ('e'); @@ -2280,3 +2288,30 @@ mangle_guard_variable (variable) write_name (variable, /*ignore_local_scope=*/0); return get_identifier (finish_mangling ()); } + + + +/* Foreign language type mangling section. */ + +/* How to write the type codes for the integer Java type. */ + +static void +write_java_integer_type_codes (type) + tree type; +{ + if (type == java_int_type_node) + write_char ('i'); + else if (type == java_short_type_node) + write_char ('s'); + else if (type == java_byte_type_node) + write_char ('c'); + else if (type == java_char_type_node) + write_char ('w'); + else if (type == java_long_type_node) + write_char ('x'); + else if (type == java_boolean_type_node) + write_char ('b'); + else + my_friendly_abort (20001207); +} + |