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: PR java/25535: gcj broken on 64-bit big-endian systems


>>>>> "Andrew" == Andrew Haley <aph@redhat.com> writes:

Andrew> BC-compiled code doesn't work on a big-endian 64-bit box
Andrew> because of a silly mistake initializing entries in the
Andrew> constant pool.  In all cases the initializer must appear as
Andrew> the first 32-bit integer of a machine word stored in memory.

Andrew> -	  jword temp = outgoing_cpool->data[i].w;
Andrew> +	  unsigned HOST_WIDE_INT temp = outgoing_cpool->data[i].w;
Andrew> +
Andrew> +	  /* Make sure that on a 64-bit big-endian machine this 32-bit
Andrew> +	     jint appears in the first word.  */
Andrew> +	  if (BYTES_BIG_ENDIAN && BITS_PER_WORD > 32)
Andrew> +	    temp <<= BITS_PER_WORD - 32;
 
This is related to PR 18148 -- internally gcj has the wrong type for
itable and some other fields of Class.  It seems like it would be more
robust (though more painful) to have the proper declarations inside
gcj and to generate a real union constructor here.

For 4.1 I think the current patch would be appropriate.  What do you
think?

Tom


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