Fwd: [Vm-dev] VM Maker: VMMaker-dtl.194.mcz
Eliot Miranda
eliot.miranda at gmail.com
Thu Oct 21 00:01:22 UTC 2010
---------- Forwarded message ----------
From: Eliot Miranda <eliot.miranda at gmail.com>
Date: Wed, Oct 20, 2010 at 5:01 PM
Subject: Re: [Vm-dev] VM Maker: VMMaker-dtl.194.mcz
To: "David T. Lewis" <lewis at mail.msen.com>
On Wed, Oct 20, 2010 at 4:43 PM, David T. Lewis <lewis at mail.msen.com> wrote:
> 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.
>
A change set ifs fine. But I still don't quite understand why you need the
inSmalltalk: argument. I'm assuming
self ifDefined: aConstantName
inSmalltalk: [smalltalk statements]
comment: aComment
ifTrue: [true statements]
ifFalse: [false statements]
then surely that's equivalent to
self ifDefined: aConstantName
comment: aComment
ifTrue: [self cCode: [true statements] inSmalltalk: [smalltalk
statements]]
ifFalse: [self cCode: [false statements] inSmalltalk: [smalltalk
statements]]
which is much nicer IMO because it is orthogonal.
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!).
best
Eliot
>
> Dave
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20101020/f0ce257b/attachment-0001.htm
More information about the Vm-dev
mailing list