From: Matthew Fortune <Matthew.Fortune@imgtec.com>
To: "'gcc-patches@gcc.gnu.org' (gcc-patches@gcc.gnu.org)"
<gcc-patches@gcc.gnu.org>,
"java-patches@gcc.gnu.org" <java-patches@gcc.gnu.org>
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH] PR java/71917
Date: Fri, 09 Sep 2016 12:45:00 -0000 [thread overview]
Message-ID: <6D39441BF12EF246A7ABCE6654B023537E4F12B3@HHMAIL01.hh.imgtec.org> (raw)
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=71917#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 == 8
+#if FFI_SIZEOF_ARG == 8
switch (cif->rtype->type)
{
case FFI_TYPE_UINT8:
case FFI_TYPE_UINT16:
case FFI_TYPE_UINT32:
+# if WORDS_BIGENDIAN
*(UINT64 *)rvalue >>= 32;
+# else
+ *(ffi_arg *)rvalue = *(UINT32 *)rvalue;
+# endif
break;
case FFI_TYPE_SINT8:
case FFI_TYPE_SINT16:
case FFI_TYPE_SINT32:
case FFI_TYPE_INT:
+# if WORDS_BIGENDIAN
*(SINT64 *)rvalue >>= 32;
+# else
+ *(ffi_arg *)rvalue = *(SINT32 *)rvalue;
+# endif
break;
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;
insn_ireturn:
- *(ffi_arg *) retp = POPI ();
+ *(jint *) retp = POPI ();
return;
insn_return:
--
2.4.1
next reply other threads:[~2016-09-09 12:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-09 12:45 Matthew Fortune [this message]
2016-09-09 13:31 ` Andrew Haley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6D39441BF12EF246A7ABCE6654B023537E4F12B3@HHMAIL01.hh.imgtec.org \
--to=matthew.fortune@imgtec.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=java-patches@gcc.gnu.org \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).