The following patch contains my sbcl-interpretation of rtoym's recent
callback changes to CMUCL.
For some background to these changes, Luis Olivera's CFFI test suite
showed some bugs in handling callbacks on PPC on CMUCL. The ppc
calling conventions are a bit odd, at least to my untrained eye, and
CMUCL wasn't getting this exactly right in a number of cases. Some of
those cases were:
1. Variable arg functions. Arguments need to be both in registers and
on the stack. We weren't doing this.
Here's a test that exposes the problem:
(function sb-alien:void sb-alien:c-
(concatenate 'string "%f" (make-string 1 :initial-element #
Now this works properly.
2. We had problems with callbacks given arguments shorter than int.
We were putting the args in the wrong end of the int. This is fixed.
CFFI tests for short, ushort, char, uchar showed the problem and are
3. We weren't incrementing the offset for multi-word args so 64-bit
args were hosed. This is now fixed. CFFI long-long and u-long-long
tests showed the problem and are now fixed.
If the ppc-callback committee could look this over, I'd appreciate it.