This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix for PR java/9577: Name Mangling Error


Can someone review and commit this please if it
looks OK?

Many thanks in advance.

Ranjit.

Ranjit Mathew wrote:

> Hi,
> 
>     Here is a proposed patch for PR java/9577 (reported by 
> yours truly). To summarise, we were not compressing the
> "java" in a "java.lang.String" in the mangled method
> name, that appears as a method parameter after a
> "java.io.File[]", while the reverse worked. The C++
> mangler however, correctly mangled the method name
> in both the cases leading to a linker error with
> CNI code in the former case.
> 
> The problem was that find_compression_record_match( )
> incorrectly assumes that all IDENTIFIER_NODEs are
> partial package names in the compression table - a
> "6JArray" that is emitted for an array parameter
> breaks this assumption and causes the reported bug.
> 
> Tested with a clean libgcj build on i686-pc-linux-gnu
> with a GCC 3.4 snapshot (20030806) and this patch
> did not cause any unexpected failures in the libgcj
> testsuite (without Mauve and Jacks).
> 
> The patch also fixes a couple of typos in comments
> elsewhere in this file (mangle.c).
> 
> Ranjit.
> 
> 
> Index: ChangeLog
> from  Ranjit Mathew  <rmathew@hotmail.com>
> 
> 	Fixes PR java/9577
> 	* mangle.c (find_compression_record_match): Skip
> 	over a "6JArray" (the array template mangled string)
> 	IDENTIFIER_NODE.
> 	(mangle_array_type): Correct minor typo.
> 	(atms): Move definition to the beginning.
> 
> Index: mangle.c
> ===================================================================
> --- mangle.c	2003-08-09 13:44:52.000000000 +0530
> +++ mangle.c	2003-08-10 15:28:17.000000000 +0530
> @@ -68,4 +68,7 @@ struct obstack *mangle_obstack;
>    obstack_grow (mangle_obstack, (S), sizeof (S)-1)
>  
> +/* atms: array template mangled string. */
> +static GTY(()) tree atms;
> +
>  /* This is the mangling interface: a decl, a class field (.class) and
>     the vtable. */
> @@ -234,5 +237,5 @@ mangle_type (tree type)
>     would generate three entries: two package names and a type. If
>     java.lang.String is presented next, the java.lang will be matched
> -   against the first two entries (and kept for compression as S_0), and
> +   against the first two entries (and kept for compression as S0_), and
>     type String would be added to the table. See mangle_record_type.
>     COMPRESSION_NEXT is the index to the location of the next insertion
> @@ -302,10 +305,14 @@ find_compression_record_match (tree type
>  	    break;
>  	  }
> +        else if (atms && TREE_VEC_ELT (compression_table, j) == atms)
> +          {
> +            /* Skip over a "6JArray". */
> +          }
>  	else
>  	  {
>  	    /* We don't want to match an element that appears in the middle
>  	    of a package name, so skip forward to the next complete type name.
> -	    IDENTIFIER_NODEs are partial package names while RECORD_TYPEs
> -	    represent complete type names. */
> +	    IDENTIFIER_NODEs (except for a "6JArray") are partial package
> +            names while RECORD_TYPEs represent complete type names. */
>  	    while (j < compression_next 
>  		   && TREE_CODE (TREE_VEC_ELT (compression_table, j)) == 
> @@ -414,9 +421,7 @@ mangle_pointer_type (tree type)
>  /* Mangle an array type. Search for an easy solution first, then go
>     through the process of finding out whether the bare array type or even
> -   the template indicator where already used an compress appropriately.
> +   the template indicator were already used and compressed appropriately.
>     It handles pointers. */
>  
> -/* atms: array template mangled string. */
> -static GTY(()) tree atms;
>  static void
>  mangle_array_type (tree p_type)
> @@ -437,5 +442,5 @@ mangle_array_type (tree p_type)
>      }
>  
> -  /* Maybe we have what we're looking in the compression table. */
> +  /* Maybe we have what we're looking for in the compression table. */
>    if ((match = find_compression_array_match (p_type)) >= 0)
>      {
> 
> 


-- 
Ranjit Mathew          Email: rmathew AT hotmail DOT com

Bangalore, INDIA.      Web: http://ranjitmathew.tripod.com/



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]