[squeak-dev] alien os-x plugin goes to 1.1.0

John M McIntosh johnmci at smalltalkconsulting.com
Thu Dec 18 04:19:19 UTC 2008


I've updated the os-x alien plugin for powerpc and macintel, it is  
found on the usual sites via

http://www.smalltalkconsulting.com/squeak.html

  in the Experimental directory as IA32ABI.1.1.0.bundle.zip

The macintel flavour supports the ability to call foreign entry points  
with any type of data and the ability to  callback to smalltalk code  
from the entered routine,
plus the ability to get/set bytes, shorts, longs, float, and doubles.

The powerpc flavour supports the ability to call foreign entry points  
with any type of data, and  the ability to get/set bytes, shorts,  
longs, float, and doubles.  Hopefully
tomorrow I can look into the callback logic and propose some code/ 
assembler to enable that feature.

It does btw run on 10.4 powerpc G3 machines now.

There was a number of structural changes required enable the typeless  
Alien api to understand it must work with a floating point signature  
array that
indicates how to deal with Float or Double data.  I also added the  
ability to pass not only Alien and Integer data but also to pass Float/ 
Double objects as parm data.

I note Squeak maintains floating point numbers as a Double. If you  
pass that as a Float by indicating that in the signature data (4 bytes  
versus 8 bytes) we
convert the number from a double to a float before passing to the  
routine.   On return  the Alien api makes you explicitly indicate if  
the value is a double, integer, or float.
Users should be aware it's possible to call a routine that returns a  
double but ask for a Float back. This might lead to unexpected  
numerical issues.  Please
ensure the size of the floating point value you want to return matches  
the function's actual return type.

Lastly passing the wrong sized floating point values as parms (say a  
Float) versus an expected Double, will result in confused behaviour,  
or VM crashes as we are
building the parm stack area based on information from the float  
signature array which must then match what the routine expects the  
stack to look like.


--
= 
= 
= 
========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
= 
= 
= 
========================================================================






More information about the Squeak-dev mailing list