This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Another endianess problem on Solaris
- From: Jeff Sturm <jsturm at one-point dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>, martin dot kahlert at infineon dot com, java at gcc dot gnu dot org
- Date: Mon, 18 Feb 2002 05:15:32 -0500 (EST)
- Subject: Re: Another endianess problem on Solaris
On 17 Feb 2002, Tom Tromey wrote:
> I looked at writing the proposed fix tonight. It's not clear to me
> how it should work. Do we want a new function like
> ffi_promoted_type()? The idea being that we would pass in a type,
> like FFI_TYPE_UINT8, and then ffi would return the promoted type.
How would you use this function in natMethod.cc? We still need to
allocate space according to this type and cast from it.
We had discussed using a typedef. I'm testing a patch now. (I got
distracted by a unrelated failure, and makefile problems in libffi.)
> Do we have a table of the rules for all the supported platforms?
Generally all return value smaller than a pointer are promoted. MIPS N32
is the lone exception, which promotes to "long long".
There is already the SIZEOF_ARG macro which tells us the size of this
type. The raw API currently requires SIZEOF_ARG to be 4 or 8. So the
typedef can be as simple as
#if (SIZEOF_ARG != 4) && (SIZEOF_ARG != 8)
-- trouble
#endif
#if SIZEOF_ARG == 4
typedef UINT32 ffi_arg;
#endif
#if SIZEOF_ARG == 8
typedef UINT64 ffi_arg;
#endif
Jeff