<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><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">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. &nbsp;We changed to a single src tree for Mac OS, win32 &amp; linux very recently. &nbsp;The VMMaker per platform strikes me as absurd. &nbsp;All Microsoft and Mac compilers I've ever used are happy with LF line endings. &nbsp;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 class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">/*** Variables ***/</span></font></div><div><font class="Apple-style-span" face="'courier new', 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="'courier new', 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="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">struct foo {</span></font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">#else</span></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;"># define _iss static</span></font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">#endif</span></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">_iss char * stackPointer;</span></font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">_iss sqInt primFailCode;</span></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">_iss sqInt specialObjectsOop;</span></font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">_iss char * framePointer;</span></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">_iss StackPage * stackPage;</span></font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">_iss sqInt nilObj;</span></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;"><br>
</span></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">...</span></font></div><div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;"><br>
</span></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">_iss char * stackMemory;</span></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">_iss sqInt theUnknownShort;</span></font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">#undef _iss</span></font></div><div><font class="Apple-style-span" face="'courier new', 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="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">&nbsp;} fum;</span></font></div><div><font class="Apple-style-span" face="'courier new', 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="'courier new', 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="'courier new', 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="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">#else</span></font></div>
<div><font class="Apple-style-span" face="'courier new', 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="'courier new', 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="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;"># define GIV(interpreterInstVar) interpreterInstVar</span></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">#endif</span></font></div>
<div><font class="Apple-style-span" face="'courier new', 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="'courier new', 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="'courier new', 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="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">EXPORT(sqInt)</span></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">addGCRoot(sqInt *varLoc) {</span></font></div>
<div><font class="Apple-style-span" face="'courier new', 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="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">&nbsp;&nbsp; &nbsp;if (GIV(extraRootCount) &gt;= ExtraRootSize) {</span></font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return 0;</span></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">&nbsp;&nbsp; &nbsp;}</span></font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">&nbsp;&nbsp; &nbsp;GIV(extraRoots)[GIV(extraRootCount) += 1] = varLoc;</span></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-size: large;">&nbsp;&nbsp; &nbsp;return 1;</span></font></div>
<div><font class="Apple-style-span" face="'courier new', 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're using the Intel compiler or gcc. &nbsp;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. &nbsp;So making the choice depend on platform is a mistake anyway. &nbsp;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><br><div>
<span class="Apple-style-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; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="font-family: Helvetica; "><span class="Apple-style-span" style="font-family: Helvetica; ">- Bert -</span></div><br class="Apple-interchange-newline"></span>
</div>
<br></body></html>