<div dir="ltr">Hi David,<div><br></div><div>    forgive me for chipping in somewhat tangentally.  But the vision thang can be important sometimes.<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Nov 14, 2013 at 3:59 PM, David T. Lewis <span dir="ltr">&lt;<a href="mailto:lewis@mail.msen.com" target="_blank">lewis@mail.msen.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">A few things to be aware of:<br>
<br>
- Both Eliot Miranda and Igor Stasenko have done considerable work on<br>
FFI interfaces. I cannot explain the details, but be aware that there<br>
may be more than one kind of FFI that people will want to use, and it<br>
seems quite likely that the classic FFI may in future be replaced by<br>
a different implementation.<br></blockquote><div><br></div><div>+1.  At least Spur will change the facilities available as does NativeBoost.  Ideally we&#39;ll develop some kind of synthesis.  SPur provides pinning.  NativeBoost provides the ability to generate marshalling code from within the image which means not having to rely on the VM for marshalling, which should hopefully mean correctness on platforms with really complex marshalling rules such as x86-64/IA64.</div>
<div><br></div><div>Further, Igor&#39;s discovery that any C signature can be compiled as a Smalltalk literal array changes how one should parse C declarations.  It&#39;s a magnificently simple hack.</div><div><br></div><div>
        struct { int foo; float bar; } (*f)(double bletch);</div><div>=&gt;  #(#struct #&#39;{&#39; #int #foo #&#39;;&#39; #float #bar  #&#39;;&#39; #&#39;}&#39; #(#* #f) #(#double #bletch) #&#39;;&#39;)</div><div>=&gt;  #(struct { int foo; float bar; } (*f)(double bletch);)</div>
<div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">- None of the available FFI interfaces will work for a VM compiled in<br>
64-bit mode, nor can they be used to interface to existing 64-bit libraries.<br>
I am sure that the problems will be addressed in one or more of the<br>
FFI implementations, but this may take some time (to give an idea of<br>
the time scale, see <a href="http://bugs.squeak.org/view.php?id=7237" target="_blank">http://bugs.squeak.org/view.php?id=7237</a>).<br></blockquote><div><br></div><div>That will be addressed when a 64-bit Spur is implemented.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">- Like any other reloadable package in Squeak, the classic Squeak FFI<br>
can be maintained as an external package. It requires a little more<br>
work to keep it healthy, because someone has to remember to test it<br>
once in a while. But there is no reason that this can not or should not<br>
be done.<br></blockquote><div><br></div><div>+1.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dave<br>
<div class="HOEnZb"><div class="h5"><br>
On Thu, Nov 14, 2013 at 03:38:49PM -0800, Chris Cunningham wrote:<br>
&gt; FFI used to BE part of the base image, and was specifically taken out on<br>
&gt; purpose.  The purpose, as I remember it, was because it acted like a<br>
&gt; security hole for squeak as a squeaklet on the web (when you browse a page<br>
&gt; on a website that invokes Squeak, and then being able to, via FFI, invoke<br>
&gt; anything you want on the remote machine).  So, for any image still working<br>
&gt; in that mode (such as the etoys derivative), it is important to leave out.<br>
&gt;<br>
&gt; But, with the shiny new CI servers, couldn&#39;t we have an artifact built with<br>
&gt; FFI loaded?<br>
&gt;<br>
&gt; Or, even neater, include FFI in the trunk, but have a switch/pragma in the<br>
&gt; image that says &#39;Don&#39;t ever load FFI&#39; for those that don&#39;t want it, but<br>
&gt; want everything else loaded?  So, for people that LIKE FFI, it is just part<br>
&gt; of Trunk; for those that have to avoid it, it isn&#39;t loaded; for the rest,<br>
&gt; they get whatever was setup when they got their image.  (I&#39;d be in the<br>
&gt; first group most of the time)<br>
&gt;<br>
&gt; -cbc<br>
&gt;<br>
&gt;<br>
&gt; On Thu, Nov 14, 2013 at 2:30 PM, Frank Shearar &lt;<a href="mailto:frank.shearar@gmail.com">frank.shearar@gmail.com</a>&gt;wrote:<br>
&gt;<br>
&gt; &gt; On 14 November 2013 16:42, Eliot Miranda &lt;<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>&gt; wrote:<br>
&gt; &gt; &gt; Hi Frank,<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; On Thu, Nov 14, 2013 at 1:59 AM, Frank Shearar &lt;<a href="mailto:frank.shearar@gmail.com">frank.shearar@gmail.com</a>&gt;<br>
&gt; &gt; &gt; wrote:<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; That&#39;s the source of the problem: FFI-Kernel uses FFIConstants, which<br>
&gt; &gt; &gt;&gt; is declared/defined in FFI-Pools.<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; Insert standard Frank rant of something called &quot;Kernel&quot; depending on<br>
&gt; &gt; &gt;&gt; other stuff. (Possibly insert standard Chris rant of a package<br>
&gt; &gt; &gt;&gt; containing a single class? :) )<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; The problem here is that the VM depends on FFIConstants also, and the VM<br>
&gt; &gt; &gt; shouldn&#39;t depend on the rest of FFI.  So FFIConstants does need to be on<br>
&gt; &gt; its<br>
&gt; &gt; &gt; own, but could perhaps be called something different.<br>
&gt; &gt;<br>
&gt; &gt; You know, I would be quite happy if we folded FFI into the base image.<br>
&gt; &gt; Seriously. For once I&#39;d argue for _including_ something. I would<br>
&gt; &gt; gladly trade Morphic for FFI.<br>
&gt; &gt;<br>
&gt; &gt; OK, I&#39;ll chalk this up to That&#39;s How It Is, and move on. If you<br>
&gt; &gt; install from SqueakMap (as you should, and as I should have) you get<br>
&gt; &gt; the right load order.<br>
&gt; &gt;<br>
&gt; &gt; frank<br>
&gt; &gt;<br>
&gt; &gt; &gt;&gt; frank<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; On 12 November 2013 23:20, Chris Muller &lt;<a href="mailto:ma.chris.m@gmail.com">ma.chris.m@gmail.com</a>&gt; wrote:<br>
&gt; &gt; &gt;&gt; &gt; I didn&#39;t see you loading FFI-Pools in advance.  The issue you<br>
&gt; &gt; &gt;&gt; &gt; encountered<br>
&gt; &gt; &gt;&gt; &gt; may not have had anything to do with -eem.24.<br>
&gt; &gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt; FYI -- FFI also has a &quot;head&quot; release on SqueakMap which documents how<br>
&gt; &gt; to<br>
&gt; &gt; &gt;&gt; &gt; load it.<br>
&gt; &gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt; On Tue, Nov 12, 2013 at 4:50 PM, Frank Shearar &lt;<br>
&gt; &gt; <a href="mailto:frank.shearar@gmail.com">frank.shearar@gmail.com</a>&gt;<br>
&gt; &gt; &gt;&gt; &gt; wrote:<br>
&gt; &gt; &gt;&gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; That pulls in the latest packages, right?<br>
&gt; &gt; &gt;&gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; So that does work. But why does the reported version fail to load?<br>
&gt; &gt; &gt;&gt; &gt;&gt; That&#39;s a problem still.<br>
&gt; &gt; &gt;&gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; (While this lets me get on with what I wanted to do - add<br>
&gt; &gt; &gt;&gt; &gt;&gt; #interleaving: to Xtreams - this is still a problem. But thanks for<br>
&gt; &gt; &gt;&gt; &gt;&gt; the workaround, Chris!)<br>
&gt; &gt; &gt;&gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; frank<br>
&gt; &gt; &gt;&gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; On 12 November 2013 20:55, Chris Muller &lt;<a href="mailto:asqueaker@gmail.com">asqueaker@gmail.com</a>&gt; wrote:<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt; Installer new merge: #ffi.<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt; Worked for me..<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt; On Tue, Nov 12, 2013 at 2:45 PM, Frank Shearar<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt; &lt;<a href="mailto:frank.shearar@gmail.com">frank.shearar@gmail.com</a>&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt; wrote:<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt; On 26 February 2013 18:36, Eliot Miranda &lt;<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a><br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt; wrote:<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; On Tue, Feb 26, 2013 at 1:51 AM, Frank Shearar<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; &lt;<a href="mailto:frank.shearar@gmail.com">frank.shearar@gmail.com</a>&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; wrote:<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; (Installer monticello mc: (MCHttpRepository new location:<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; &#39;<a href="http://source.squeak.org/FFI&#39;" target="_blank">http://source.squeak.org/FFI&#39;</a>))<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt;     install: &#39;FFI-Kernel-eem.24.mcz&#39;. &quot;There&#39;s a -tbn.25, but<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; that&#39;s<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; not important to this post&quot;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; fails with an MNU: ExternalFunction class &gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; callingConventionFor:.<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; As far as I can see what&#39;s happening is this:<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; * during the loading of the mcz ExternalFunction is defined,<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; * a method is parsed (#XOpenDisplay, which has a pragma &lt;cdecl:<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; X11Display* &#39;&#39;XOpenDisplay&#39;&#39; (char*) module:&#39;&#39;X11&#39;&#39;&gt;)<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; * Parser &gt;&gt; externalFunctionDeclaration checks whether<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; ExternalFunction is defined.<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; * It is, so tries to evaluate `descriptorClass<br>
&gt; &gt; callingConvention:<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; here` and boom, because ExternalFunction class &gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; callingConventionFor: _has not been loaded yet_.<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; I thought we&#39;d modified Monticello to load new methods first.<br>
&gt; &gt;  Did<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; this not<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; get added to trunk?<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt; Apparently not. It still happens with an up-to-date Squeak 4.5.<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt; frank<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; I&#39;ve seen this kind of issue with Helvetia code: sometimes you<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; simply<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; have to load class-side methods first.<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; Thoughts? Lukas worked around the issue with his Helvetia code<br>
&gt; &gt; by<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; directly patching Monticello, and ripping out its &quot;try to do<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; atomic<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; loading&quot; mechanism.<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt; frank<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; --<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; best,<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt; Eliot<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt; &gt;<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; --<br>
&gt; &gt; &gt; best,<br>
&gt; &gt; &gt; Eliot<br>
&gt; &gt;<br>
&gt; &gt;<br>
<br>
&gt;<br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>
</div></div></div>