From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 42634 invoked by alias); 9 Sep 2016 12:45:01 -0000 Mailing-List: contact java-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@gcc.gnu.org Received: (qmail 42596 invoked by uid 89); 9 Sep 2016 12:45:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=cif, death X-Spam-User: qpsmtpd, 2 recipients X-HELO: mailapp01.imgtec.com Received: from mailapp01.imgtec.com (HELO mailapp01.imgtec.com) (195.59.15.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Sep 2016 12:44:50 +0000 Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Forcepoint Email with ESMTPS id 2C038B2839B87; Fri, 9 Sep 2016 13:44:34 +0100 (IST) Received: from HHMAIL01.hh.imgtec.org ([fe80::710b:f219:72bc:e0b3]) by hhmail02.hh.imgtec.org ([fe80::5400:d33e:81a4:f775%25]) with mapi id 14.03.0294.000; Fri, 9 Sep 2016 13:44:36 +0100 From: Matthew Fortune To: "'gcc-patches@gcc.gnu.org' (gcc-patches@gcc.gnu.org)" , "java-patches@gcc.gnu.org" CC: Tom Tromey Subject: [PATCH] PR java/71917 Date: Fri, 09 Sep 2016 12:45:00 -0000 Message-ID: <6D39441BF12EF246A7ABCE6654B023537E4F12B3@HHMAIL01.hh.imgtec.org> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-SW-Source: 2016-q3/txt/msg00030.txt.bz2 Hi, Although libjava is currently on death row, here is a patch to (correctly) fix mips64el in the java interpreter. This restores sparc64 BE java support based on the report[1] that reverting my original patch fixes the bug (I have not rerun this on spark64 BE as we are back to the original code for that platform now). I'd like to get this committed before libjava is deleted if possible so it is in a working state for future reference. Tested with x86_64-pc-linux-gnu and mips64el-linux-gnu [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D71917#c11 Thanks, Matthew libffi/ PR java/71917 * src/java_raw_api.c (ffi_java_raw_to_rvalue): Add casts for little endian 64-bit ABIs to widen 32-bit types to 64-bit. libjava/ PR java/71917 * interpret-run.cc: Do not use ffi_arg for FFI integer return types as this code uses the 'native' FFI interface. --- libffi/src/java_raw_api.c | 10 +++++++++- libjava/interpret-run.cc | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libffi/src/java_raw_api.c b/libffi/src/java_raw_api.c index 127123d..578bd7c 100644 --- a/libffi/src/java_raw_api.c +++ b/libffi/src/java_raw_api.c @@ -277,20 +277,28 @@ ffi_java_rvalue_to_raw (ffi_cif *cif, void *rvalue) static void ffi_java_raw_to_rvalue (ffi_cif *cif, void *rvalue) { -#if WORDS_BIGENDIAN && FFI_SIZEOF_ARG =3D=3D 8 +#if FFI_SIZEOF_ARG =3D=3D 8 switch (cif->rtype->type) { case FFI_TYPE_UINT8: case FFI_TYPE_UINT16: case FFI_TYPE_UINT32: +# if WORDS_BIGENDIAN *(UINT64 *)rvalue >>=3D 32; +# else + *(ffi_arg *)rvalue =3D *(UINT32 *)rvalue; +# endif break; =20 case FFI_TYPE_SINT8: case FFI_TYPE_SINT16: case FFI_TYPE_SINT32: case FFI_TYPE_INT: +# if WORDS_BIGENDIAN *(SINT64 *)rvalue >>=3D 32; +# else + *(ffi_arg *)rvalue =3D *(SINT32 *)rvalue; +# endif break; =20 case FFI_TYPE_COMPLEX: diff --git a/libjava/interpret-run.cc b/libjava/interpret-run.cc index 6be354e..a4c2d4d 100644 --- a/libjava/interpret-run.cc +++ b/libjava/interpret-run.cc @@ -1838,7 +1838,7 @@ details. */ return; =20 insn_ireturn: - *(ffi_arg *) retp =3D POPI (); + *(jint *) retp =3D POPI (); return; =20 insn_return: --=20 2.4.1