<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Paolo,<div><br><div><div>On Mar 7, 2010, at 11:52 PM, Paolo Bonzini wrote:</div><br><blockquote type="cite"><div>BTW, I took a look at Aliens and it would be possible to port CObject<br>to Squeak basing it on Aliens, since it provides a higher-level<br>framework. &nbsp;</div></blockquote><div><br></div><div>"It" is ambiguous here. &nbsp;From what I could see, &nbsp;CObjects already has some facilities for automagically deriving bindings from C headers, and in that sense is higher level. While Newspeak has a fair amount of C parsing code, we never got around to adding such auto-magic. We started at the low level because of the considerations Andres mentioned. I believe we could solve them, but it probably goes beyond a SoC project.</div><div><br></div><div>On the other hand, the big advantage of aliens is that they do not require a special primitive-like &nbsp;syntactic construct. The Alien implementation itself requires a primitive, but you don't need special syntax to use aliens. &nbsp;Aliens are a better fit with security, though this is probably immaterial to this discussion.</div><div><br></div><div>For a discussion of these issues, please see&nbsp;</div><div><br></div><div><a href="http://gbracha.blogspot.com/2008/12/unidentified-foreign-objects-ufos.html">http://gbracha.blogspot.com/2008/12/unidentified-foreign-objects-ufos.html</a></div><div><br></div><div>(a slightly related discussion of primitives in general is at&nbsp;<a href="http://gbracha.blogspot.com/2008/08/foreign-functions-vm-primitives-and.html">http://gbracha.blogspot.com/2008/08/foreign-functions-vm-primitives-and.html</a>)</div><br><blockquote type="cite"><div><br>Gilad, in your experience what % of the bindings you wrote were<br>Smalltalk and what % was C code? &nbsp;</div></blockquote><div><br></div>I'm not sure I understand the question. &nbsp;All our FFI bindings are done the same way, using aliens. No C code is involved - but you do need an intimate understanding of the foreign data representation (how many bytes, basically).</div><div><br></div><div><br><blockquote type="cite"><div>Did you have any performance<br>problems that you could fix using more C code?<font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#144FAE"><br></font></font></div></blockquote><div><br></div>I assume you are referring to usages of the FFI (I have lots of Smalltalk/Newspeak code that runs slower than C &nbsp;:-) ).<br><br></div><div>Performance of the FFI has not been an issue. We have a native Windows GUI built upon using aliens, so things get exercised pretty thoroughly. Of course, there is some overhead to using an FFI, and it could perhaps be further improved. I'll let Eliot comment on that if he wants to.</div><div>
<span class="Apple-style-span" style="font-size: 12px; "><br class="Apple-interchange-newline">Cheers, Gilad</span>
</div>
<br></div></body></html>