<br><br><div class="gmail_quote">On Wed, Jan 27, 2010 at 9:34 AM, Bert Freudenberg <span dir="ltr">&lt;<a href="mailto:bert@freudenbergs.de">bert@freudenbergs.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
 <br><div style="word-wrap:break-word"><div><div>On 27.01.2010, at 09:28, Eliot Miranda wrote:</div><blockquote type="cite"><br><br><div class="gmail_quote">On Wed, Jan 27, 2010 at 7:26 AM, Bert Freudenberg <span dir="ltr">&lt;<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div></div><div><br>
On 27.01.2010, at 05:37, K. K. Subramaniam wrote:<br>
&gt;<br>
&gt; On Tuesday 26 January 2010 11:09:26 pm Bert Freudenberg wrote:<br>
&gt;&gt; Well, there is a source for this of course (in the VMMaker Squeak package).<br>
&gt;&gt; Generating the C code is a manual, interactive process and requires a<br>
&gt;&gt; running Squeak installation. Making that scriptable is possible, but so<br>
&gt;&gt; far nobody has done it AFAIK<br>
&gt; That is because most of the builds so far have been one target (which is also<br>
&gt; the host). Batch builds are needed for multiple variants (e.g debug/release)<br>
&gt; or when cross-compiling (say to ARM targets).<br>
<br>
</div></div>Ian does batched cross-builds. But the source is still only generated once. All targets use the same generated sources.<br></blockquote><div><br></div><div>Ditto.  We changed to a single src tree for Mac OS, win32 &amp; linux very recently.  The VMMaker per platform strikes me as absurd.  All Microsoft and Mac compilers I&#39;ve ever used are happy with LF line endings.  The only significant difference between the platforms is whether to use the struct for interpreter variables and with a little macrology the choice can be left up to the platform&#39;s makefiles. In the Teleplace VMs the structure declaration looks like:</div>

<div><br></div><div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">/*** Variables ***/</span></font></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">#if SQ_USE_GLOBAL_STRUCT</span></font></div>

<div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large"># define _iss /* define in-struct static as void */</span></font></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">struct foo {</span></font></div>

<div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">#else</span></font></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large"># define _iss static</span></font></div>

<div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">#endif</span></font></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">_iss char * stackPointer;</span></font></div>

<div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">_iss sqInt primFailCode;</span></font></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">_iss sqInt specialObjectsOop;</span></font></div>

<div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">_iss char * framePointer;</span></font></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">_iss StackPage * stackPage;</span></font></div>

<div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">_iss sqInt nilObj;</span></font></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large"><br>
</span></font></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">...</span></font></div><div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large"><br>
</span></font></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">_iss char * stackMemory;</span></font></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">_iss sqInt theUnknownShort;</span></font></div>

<div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">#undef _iss</span></font></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">#if SQ_USE_GLOBAL_STRUCT</span></font></div>

<div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large"> } fum;</span></font></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large"># define DECL_MAYBE_SQ_GLOBAL_STRUCT register struct foo * foo = &amp;fum;</span></font></div>

<div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large"># define DECL_MAYBE_VOLATILE_SQ_GLOBAL_STRUCT volatile register struct foo * foo = &amp;fum;</span></font></div>
<div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large"># define GIV(interpreterInstVar) (foo-&gt;interpreterInstVar)</span></font></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">#else</span></font></div>

<div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large"># define DECL_MAYBE_SQ_GLOBAL_STRUCT /* oh, no mr bill! */</span></font></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large"># define DECL_MAYBE_VOLATILE_SQ_GLOBAL_STRUCT /* oh no, mr bill! */</span></font></div>

<div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large"># define GIV(interpreterInstVar) interpreterInstVar</span></font></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">#endif</span></font></div>

<div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">#if SQ_USE_GLOBAL_STRUCT</span></font></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">static struct foo * foo = &amp;fum;</span></font></div>

<div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">#endif</span></font></div><div><br></div><div>and then a function that uses global variables looks like</div>
<div><br></div><div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">EXPORT(sqInt)</span></font></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">addGCRoot(sqInt *varLoc) {</span></font></div>

<div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">DECL_MAYBE_SQ_GLOBAL_STRUCT</span></font></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">    if (GIV(extraRootCount) &gt;= ExtraRootSize) {</span></font></div>

<div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">        return 0;</span></font></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">    }</span></font></div>

<div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">    GIV(extraRoots)[GIV(extraRootCount) += 1] = varLoc;</span></font></div><div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">    return 1;</span></font></div>

<div><font face="&#39;courier new&#39;, monospace"><span style="font-size:large">}</span></font></div><div><br></div><div>And for us whether to use the global struct or not on Mac OS depends on whether we&#39;re using the Intel compiler or gcc.  The Intel compiler produces an interpreter (not a JIT) that is 10% faster if it uses the global struct, whereas gcc produces one that is slightly slower.  So making the choice depend on platform is a mistake anyway.  It depends on platform and compiler.</div>

<div><br></div></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<font color="#888888"><br>
- Bert -<br>
<br>
<br>
</font></blockquote></div><br>
</blockquote></div><div><br></div><div><br></div><div>Sounds cool. I&#39;d love to have the generated sources to be identical across platforms, plus have the plugin sources be the same for internal and external plugins. For each plugin I&#39;d like to choose to build it internally or externally or not at all, without regenerating.</div>
</div></blockquote><div><br></div><div>Yes, that&#39;s what we do.  Basically <a href="http://plugins.int">plugins.int</a> plugins.ext and sqNamedPrims.h are part of the platform&#39;s makefiles (although sqNamedPrims.h should be generated), and so one pushes out a superset of the plugins and decides in the platform makefiles which to include and which are internal or external.  As soon as my Feb deliverable is done I&#39;ll put some energy into getting Cog released.</div>
<div><br></div><div>best</div><div>Eliot</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word"><br><div>
<span style="border-collapse:separate;border-spacing:0px 0px;color:rgb(0, 0, 0);font-family:Lucida Grande;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="font-family:Helvetica">
<span style="font-family:Helvetica">- Bert -</span></div><br></span>
</div>
<br></div><br></blockquote></div><br>