[Vm-dev] VM Maker: VMMaker-dtl.194.mcz

David T. Lewis lewis at mail.msen.com
Wed Oct 20 23:43:17 UTC 2010


On Wed, Oct 20, 2010 at 10:02:31AM -0700, Eliot Miranda wrote:
> On Tue, Oct 19, 2010 at 10:55 PM, <
> squeak-dev-noreply at lists.squeakfoundation.org> wrote:

> >
> > Added #asExpression to TSendNode>>emitCCodeAsArgumentOn:level:generator:
> > needed for cpp code generation for expressions.
> >
> > Methods #generateInlineCPreprocessorDirective:on:indent: and
> > #generateCppDirective:on:indent: are redundant, get rid of one (or both) of
> > them. Consider using #isDefined:inSmalltalk:comment:ifTrue:ifFalse: instead
> > in Cog.
> >
> 
> Ooh!   I like it.  Why didn't I think of this?  Make it so.  The
> cPreprocessorDirective: was my most egregious hack.  But I would just use
>     #ifDefined: aPreprocessorMacroName ifTrue: [] ifFalse: []
> and then use cCode:inSmalltalk: within each arm as appropriate rather than
> conflating the two.

Hi Eliot,

The cCode:inSmalltalk: part actually works pretty well and translates
nicely to C, see #isIntegerObject: for the most important example.

The following are already implemented in VMMaker "trunk". The first two are
important, the third is unreferenced, and the fourth is both unreferenced
and redundant with the oscog implementation.
  #isDefinedTrueExpression:inSmalltalk:comment:ifTrue:ifFalse: 
  #isDefined:inSmalltalk:comment:ifTrue:ifFalse:
  #isDefined:inSmalltalk:comment:ifTrue:
  #preprocessorExpression:

The #cPreprocessorDirective: implementation is important for Cog, and
is now implemented in both VMMaker branches (but could be replaced
as noted above).

So my suggestion would be to add these into oscog:
  #isDefinedTrueExpression:inSmalltalk:comment:ifTrue:ifFalse: 
  #isDefined:inSmalltalk:comment:ifTrue:ifFalse:
  #isDefined:inSmalltalk:comment:ifTrue:

And then get rid of #preprocessorExpression: in favor of your #cPreprocessorDirective:

As a practical matter, I'm not sure the best way to include this in the
oscog branch. I can send a change set if that is helpful, or you can pick
updates from Montecello. Unless you advise otherwise, I don't think that
I should make any commits to the oscog branch, as that is likely to lead
to confusion.

Dave



More information about the Vm-dev mailing list