<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">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 class="h5"><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 class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">/*** Variables ***/</span></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">#if SQ_USE_GLOBAL_STRUCT</span></font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;"># define _iss /* define in-struct static as void */</span></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">struct foo {</span></font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">#else</span></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;"># define _iss static</span></font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">#endif</span></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">_iss char * stackPointer;</span></font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">_iss sqInt primFailCode;</span></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">_iss sqInt specialObjectsOop;</span></font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">_iss char * framePointer;</span></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">_iss StackPage * stackPage;</span></font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">_iss sqInt nilObj;</span></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;"><br>
</span></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">...</span></font></div><div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;"><br>
</span></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">_iss char * stackMemory;</span></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">_iss sqInt theUnknownShort;</span></font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">#undef _iss</span></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">#if SQ_USE_GLOBAL_STRUCT</span></font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;"> } fum;</span></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;"># define DECL_MAYBE_SQ_GLOBAL_STRUCT register struct foo * foo = &amp;fum;</span></font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;"># define DECL_MAYBE_VOLATILE_SQ_GLOBAL_STRUCT volatile register struct foo * foo = &amp;fum;</span></font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;"># define GIV(interpreterInstVar) (foo-&gt;interpreterInstVar)</span></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">#else</span></font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;"># define DECL_MAYBE_SQ_GLOBAL_STRUCT /* oh, no mr bill! */</span></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;"># define DECL_MAYBE_VOLATILE_SQ_GLOBAL_STRUCT /* oh no, mr bill! */</span></font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;"># define GIV(interpreterInstVar) interpreterInstVar</span></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">#endif</span></font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">#if SQ_USE_GLOBAL_STRUCT</span></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">static struct foo * foo = &amp;fum;</span></font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-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 class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">EXPORT(sqInt)</span></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">addGCRoot(sqInt *varLoc) {</span></font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">DECL_MAYBE_SQ_GLOBAL_STRUCT</span></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">    if (GIV(extraRootCount) &gt;= ExtraRootSize) {</span></font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">        return 0;</span></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">    }</span></font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">    GIV(extraRoots)[GIV(extraRootCount) += 1] = varLoc;</span></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="font-size: large;">    return 1;</span></font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><span class="Apple-style-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>