<br><br><div class="gmail_quote">On Wed, Jan 27, 2010 at 9:34 AM, Bert Freudenberg <span dir="ltr"><<a href="mailto:bert@freudenbergs.de">bert@freudenbergs.de</a>></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"><<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>></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>
><br>
> On Tuesday 26 January 2010 11:09:26 pm Bert Freudenberg wrote:<br>
>> Well, there is a source for this of course (in the VMMaker Squeak package).<br>
>> Generating the C code is a manual, interactive process and requires a<br>
>> running Squeak installation. Making that scriptable is possible, but so<br>
>> far nobody has done it AFAIK<br>
> That is because most of the builds so far have been one target (which is also<br>
> the host). Batch builds are needed for multiple variants (e.g debug/release)<br>
> 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 & linux very recently. The VMMaker per platform strikes me as absurd. All Microsoft and Mac compilers I'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's makefiles. In the Teleplace VMs the structure declaration looks like:</div>
<div><br></div><div><div><font face="'courier new', monospace"><span style="font-size:large">/*** Variables ***/</span></font></div><div><font face="'courier new', monospace"><span style="font-size:large">#if SQ_USE_GLOBAL_STRUCT</span></font></div>
<div><font face="'courier new', monospace"><span style="font-size:large"># define _iss /* define in-struct static as void */</span></font></div><div><font face="'courier new', monospace"><span style="font-size:large">struct foo {</span></font></div>
<div><font face="'courier new', monospace"><span style="font-size:large">#else</span></font></div><div><font face="'courier new', monospace"><span style="font-size:large"># define _iss static</span></font></div>
<div><font face="'courier new', monospace"><span style="font-size:large">#endif</span></font></div><div><font face="'courier new', monospace"><span style="font-size:large">_iss char * stackPointer;</span></font></div>
<div><font face="'courier new', monospace"><span style="font-size:large">_iss sqInt primFailCode;</span></font></div><div><font face="'courier new', monospace"><span style="font-size:large">_iss sqInt specialObjectsOop;</span></font></div>
<div><font face="'courier new', monospace"><span style="font-size:large">_iss char * framePointer;</span></font></div><div><font face="'courier new', monospace"><span style="font-size:large">_iss StackPage * stackPage;</span></font></div>
<div><font face="'courier new', monospace"><span style="font-size:large">_iss sqInt nilObj;</span></font></div><div><font face="'courier new', monospace"><span style="font-size:large"><br>
</span></font></div><div><font face="'courier new', monospace"><span style="font-size:large">...</span></font></div><div><div><font face="'courier new', monospace"><span style="font-size:large"><br>
</span></font></div><div><font face="'courier new', monospace"><span style="font-size:large">_iss char * stackMemory;</span></font></div><div><font face="'courier new', monospace"><span style="font-size:large">_iss sqInt theUnknownShort;</span></font></div>
<div><font face="'courier new', monospace"><span style="font-size:large">#undef _iss</span></font></div><div><font face="'courier new', monospace"><span style="font-size:large">#if SQ_USE_GLOBAL_STRUCT</span></font></div>
<div><font face="'courier new', monospace"><span style="font-size:large"> } fum;</span></font></div><div><font face="'courier new', monospace"><span style="font-size:large"># define DECL_MAYBE_SQ_GLOBAL_STRUCT register struct foo * foo = &fum;</span></font></div>
<div><font face="'courier new', monospace"><span style="font-size:large"># define DECL_MAYBE_VOLATILE_SQ_GLOBAL_STRUCT volatile register struct foo * foo = &fum;</span></font></div>
<div><font face="'courier new', monospace"><span style="font-size:large"># define GIV(interpreterInstVar) (foo->interpreterInstVar)</span></font></div><div><font face="'courier new', monospace"><span style="font-size:large">#else</span></font></div>
<div><font face="'courier new', monospace"><span style="font-size:large"># define DECL_MAYBE_SQ_GLOBAL_STRUCT /* oh, no mr bill! */</span></font></div><div><font face="'courier new', monospace"><span style="font-size:large"># define DECL_MAYBE_VOLATILE_SQ_GLOBAL_STRUCT /* oh no, mr bill! */</span></font></div>
<div><font face="'courier new', monospace"><span style="font-size:large"># define GIV(interpreterInstVar) interpreterInstVar</span></font></div><div><font face="'courier new', monospace"><span style="font-size:large">#endif</span></font></div>
<div><font face="'courier new', monospace"><span style="font-size:large">#if SQ_USE_GLOBAL_STRUCT</span></font></div><div><font face="'courier new', monospace"><span style="font-size:large">static struct foo * foo = &fum;</span></font></div>
<div><font face="'courier new', 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="'courier new', monospace"><span style="font-size:large">EXPORT(sqInt)</span></font></div><div><font face="'courier new', monospace"><span style="font-size:large">addGCRoot(sqInt *varLoc) {</span></font></div>
<div><font face="'courier new', monospace"><span style="font-size:large">DECL_MAYBE_SQ_GLOBAL_STRUCT</span></font></div><div><font face="'courier new', monospace"><span style="font-size:large"> if (GIV(extraRootCount) >= ExtraRootSize) {</span></font></div>
<div><font face="'courier new', monospace"><span style="font-size:large"> return 0;</span></font></div><div><font face="'courier new', monospace"><span style="font-size:large"> }</span></font></div>
<div><font face="'courier new', monospace"><span style="font-size:large"> GIV(extraRoots)[GIV(extraRootCount) += 1] = varLoc;</span></font></div><div><font face="'courier new', monospace"><span style="font-size:large"> return 1;</span></font></div>
<div><font face="'courier new', 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'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'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'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's what we do. Basically <a href="http://plugins.int">plugins.int</a> plugins.ext and sqNamedPrims.h are part of the platform'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'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>