<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Eliot Miranda</b> <span dir="ltr">&lt;<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>&gt;</span><br>
Date: Wed, Oct 20, 2010 at 5:01 PM<br>Subject: Re: [Vm-dev] VM Maker: VMMaker-dtl.194.mcz<br>To: &quot;David T. Lewis&quot; &lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt;<br><br><br><br><br><div class="gmail_quote">
<div><div></div><div class="h5">On Wed, Oct 20, 2010 at 4:43 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">

<div>On Wed, Oct 20, 2010 at 10:02:31AM -0700, Eliot Miranda wrote:<br>
&gt; On Tue, Oct 19, 2010 at 10:55 PM, &lt;<br>
&gt; <a href="mailto:squeak-dev-noreply@lists.squeakfoundation.org" target="_blank">squeak-dev-noreply@lists.squeakfoundation.org</a>&gt; wrote:<br>
<br>
&gt; &gt;<br>
</div><div>&gt; &gt; Added #asExpression to TSendNode&gt;&gt;emitCCodeAsArgumentOn:level:generator:<br>
&gt; &gt; needed for cpp code generation for expressions.<br>
&gt; &gt;<br>
&gt; &gt; Methods #generateInlineCPreprocessorDirective:on:indent: and<br>
&gt; &gt; #generateCppDirective:on:indent: are redundant, get rid of one (or both) of<br>
&gt; &gt; them. Consider using #isDefined:inSmalltalk:comment:ifTrue:ifFalse: instead<br>
&gt; &gt; in Cog.<br>
&gt; &gt;<br>
&gt;<br>
&gt; Ooh!   I like it.  Why didn&#39;t I think of this?  Make it so.  The<br>
&gt; cPreprocessorDirective: was my most egregious hack.  But I would just use<br>
&gt;     #ifDefined: aPreprocessorMacroName ifTrue: [] ifFalse: []<br>
&gt; and then use cCode:inSmalltalk: within each arm as appropriate rather than<br>
&gt; conflating the two.<br>
<br>
</div>Hi Eliot,<br>
<br>
The cCode:inSmalltalk: part actually works pretty well and translates<br>
nicely to C, see #isIntegerObject: for the most important example.<br>
<br>
The following are already implemented in VMMaker &quot;trunk&quot;. The first two are<br>
important, the third is unreferenced, and the fourth is both unreferenced<br>
and redundant with the oscog implementation.<br>
  #isDefinedTrueExpression:inSmalltalk:comment:ifTrue:ifFalse:<br>
<div>  #isDefined:inSmalltalk:comment:ifTrue:ifFalse:<br>
</div>  #isDefined:inSmalltalk:comment:ifTrue:<br>
  #preprocessorExpression:<br>
<br>
The #cPreprocessorDirective: implementation is important for Cog, and<br>
is now implemented in both VMMaker branches (but could be replaced<br>
as noted above).<br>
<br>
So my suggestion would be to add these into oscog:<br>
  #isDefinedTrueExpression:inSmalltalk:comment:ifTrue:ifFalse:<br>
<div>  #isDefined:inSmalltalk:comment:ifTrue:ifFalse:<br>
</div>  #isDefined:inSmalltalk:comment:ifTrue:<br>
<br>
And then get rid of #preprocessorExpression: in favor of your #cPreprocessorDirective:<br>
<br>
As a practical matter, I&#39;m not sure the best way to include this in the<br>
oscog branch. I can send a change set if that is helpful, or you can pick<br>
updates from Montecello. Unless you advise otherwise, I don&#39;t think that<br>
I should make any commits to the oscog branch, as that is likely to lead<br>
to confusion.<br></blockquote><div><br></div></div></div><div>A change set ifs fine.  But I still don&#39;t quite understand why you need the inSmalltalk: argument.  I&#39;m assuming</div><div><br></div><div>self ifDefined: aConstantName</div>

<div>      inSmalltalk: [smalltalk statements]</div><div>      comment: aComment</div><div>      ifTrue: [true statements]</div><div>      ifFalse: [false statements]</div><div><br></div><div>then surely that&#39;s equivalent to</div>

<div><br></div><div><div>self ifDefined: aConstantName</div><div>      comment: aComment</div><div>      ifTrue: [self cCode: [true statements] inSmalltalk: [smalltalk statements]]</div><div>      ifFalse: [self cCode: [false statements] inSmalltalk: [smalltalk statements]]</div>

</div><div><br></div><div>which is much nicer IMO because it is orthogonal.</div><div><br></div><div>But am I not understanding and instead the argument to inSmalltalk: is deciding whether isDefined: is true at execution time?  If so, I get it, it makes sense, but I find the reuse of inSmalltalk: confusing (doh!).</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">
<br>
Dave<br>
<br>
</blockquote></div><br>
</div><br>