From: Juho Snellman <jsnell@ik...> - 2009-03-24 09:16:15
Jean-Claude Beaudoin <jean.claude.beaudoin@...> writes:
> Hello SBCL developers,
> Here is an issue that I came across while trying to interface to
> the Java Virtual Machine from SBCL on Linux/x86 and MS-Windows XP.
> It concerns "alien" functions that have as their return type either char,
> short or an unsigned version of the previous two. Basically, on the
> return from an "alien" function of integral return type, SBCL is happy to
> pick up the returned value in the %eax register as told to do so by
> the ABI standard. The problem is that it does so irrespective of the
> size of the return type therefore trusting that the upper part of the
> register will be properly populated by the returning function and
> SBCL will fail to recover the proper return value if the returning
> function leaves some "dirty" bits in the (irrelevant?) upper part of
> the %eax register.
I believe this was fixed in 126.96.36.199.
On Tue, Mar 24, 2009 at 5:15 AM, Juho Snellman <jsnell@...> wrote:
> Jean-Claude Beaudoin <jean.claude.beaudoin@...> writes:
> > SBCL will fail to recover the proper return value if the returning
> > function leaves some "dirty" bits in the (irrelevant?) upper part of
> > the %eax register.
> I believe this was fixed in 188.8.131.52.
Indeed the change you point to has fixed the "signed" case and sign
extension is now done properly but the "unsigned" types still have a
problem, these unsigned types would need zero extension as GCC does. Here
is what I get if I run my test code with 1.0.25 on Linux/x86 (Fedora 10).
Jean-Claude@...> sbcl --load sbcl_widening.lisp
This is SBCL 1.0.25, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
(foo) = 257
(bar) = 256
(baz) = -1
"foo" and "bar" should produce 1 and 0 respectively, they test the "unsigned
char" case. The value of "baz" is now ok, it is the "signed char" case.
Thank you very much for you help.