From: "Ulrich Weigand" <Ulrich.Weigand@de.ibm.com>
To: java@gcc.gnu.org
Cc: gcc@gcc.gnu.org
Subject: libffi return value convention bug
Date: Tue, 01 Oct 2002 10:08:00 -0000 [thread overview]
Message-ID: <OF35E1769F.904B2DC9-ONC1256C45.005BA937@de.ibm.com> (raw)
Hello,
after actually switching on the Java interpreter on s390(x), it appears
that my libffi implementation is still broken :-/
Unfortunately, one particular problem looks like it is not completely
my fault: the question is, how are 32-bit return values to be handled
on 64-bit (big endian) platforms?
In java/lang/reflect/natMethod.cc, it is expected that ints are returned
by ffi_call as a 'ffi_arg' type, which is defined to be an 64-bit integer
type on 64-bit machines. However, in interpreter.cc, it is expected that
ints are returned by ffi_raw_call / ffi_java_raw_call as 'jint' type,
which is always a 32-bit integer type.
Furthermore, ffi_raw_call / ffi_java_raw_call have a default implementation
in terms of ffi_call which does not in any way convert the return value.
So, I cannot implement ffi_call to satisfy at the same time both
requirements on a 64-bit big endian machine. Any suggestions?
Related is the question of how ffi_closure expects its target function
to handle return values. One closure target function used by libjava,
_Jv_JNIMethod::call, simply passes the ret pointer on to ffi_raw_call,
so it would appear that ffi_closure should handle return values just
the same ways as ffi_(raw_)call.
However, the other target function, _Jv_InterpMethod::run, specifically
interprets the ret pointer as 'jint *' when returning 32-bit values.
So, if it turns out that ffi_call is supposed to return 64-bit, then
ffi_closure cannot be implemented correctly ...
(B.t.w. why aren't the return value pointers handled just the same as
the argument pointers, i.e. as void pointers interpreted to point to
exactly the type described by cif->rtype? That sure would simplify
the issue ...)
Mit freundlichen Gruessen / Best Regards
Ulrich Weigand
--
Dr. Ulrich Weigand
Linux for S/390 Design & Development
IBM Deutschland Entwicklung GmbH, Schoenaicher Str. 220, 71032 Boeblingen
Phone: +49-7031/16-3727 --- Email: Ulrich.Weigand@de.ibm.com
next reply other threads:[~2002-10-01 17:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-01 10:08 Ulrich Weigand [this message]
2002-10-01 13:01 ` Jeff Sturm
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=OF35E1769F.904B2DC9-ONC1256C45.005BA937@de.ibm.com \
--to=ulrich.weigand@de.ibm.com \
--cc=gcc@gcc.gnu.org \
--cc=java@gcc.gnu.org \
/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).