macintosh squeak FFI prim plugin altered

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

macintosh squeak FFI prim plugin altered

johnmci
I'll note here I altered the squeak FFI plugin for the macintosh,  
because in studying an issue with Croquet (more on this later)  I  
discovered that the push for doubles was coded incorrectly, since say  
the beginning of time.

For background information the way things work is that under the  
powerpc ABI floating point arguments are stuck in the floating point  
registers and also pushed to the stack. Usually the callee uses the  
value from the register, why bother getting from the stack, however  
the debugger might read from the stack. But once you exceed 13  
floating point values then values are push and removed from the stack.

Testing showed that if we needed say 14 doubles we were toast.

double ffiTestDoubles14(double f1, double f2, double f3, double f4,  
double f5, double f6, double f7, double f8, double f9, double f10,  
double f11, double f12, double f13, double f14);

f14 would have the wrong value, mind it was done correctly with the  
unix plugin, however I'll also note for folks using the Unix FFI  
plugin the pushing of long long data types is wrong, it thinks it  
should align the long long data type on an 8 byte boundary, however  
reading of  the os-x powerpc ABI shows this is incorrect, and testing  
proves you are risking interesting times if you make an argument call  
using a long long datatype.

Likely someone will have to fix that.

--
========================================================================
===
John M. McIntosh <[hidden email]> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
========================================================================
===