[Vm-dev] VM Maker: VMMaker.oscog-eem.724.mcz

Eliot Miranda eliot.miranda at gmail.com
Tue May 20 23:18:14 UTC 2014


Hi David,


On Tue, May 20, 2014 at 4:03 PM, David T. Lewis <lewis at mail.msen.com> wrote:

>
> On Tue, May 20, 2014 at 12:15:35PM +0000, commits at source.squeak.org wrote:
> >
> > Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
> > http://source.squeak.org/VMMaker/VMMaker.oscog-eem.724.mcz
> >
> > ==================== Summary ====================
> >
> > Name: VMMaker.oscog-eem.724
> > Author: eem
> > Time: 20 May 2014, 5:14:34.356 am
> > UUID: 30e942d9-0d06-42d3-8f9a-893dbdee37c2
> > Ancestors: VMMaker.oscog-eem.723
> >
> > Slang/general:
> > VMBIGENDIAN must *not* be defined during generation.  It
> > should be taken from platforms/??/vm/sqConfig.h.  This should
> > go a long way to fixing Doug's issues on PPC.
> >
>
> For sure VMBIGENDIAN should not be generated from slang. But more
> generally,
> it is available at runtime via Interpreter>>isBigEnder, so the declaration
> in sqConfig.h should not be required either.
>

IMO isBigEnder is a cruel joke:

isBigEnder
"Answer true (non-zero) if running on a big endian machine."
| endianness anInt cString len i |
<var: 'cString' type: 'char *'>
<var: 'endianness' declareC: 'static sqInt endianness = -1'>
(endianness == -1) ifFalse: [^ endianness]. "answer cached value"
len := self cCode: 'sizeof(anInt)'
inSmalltalk: [^ (Smalltalk endianness == #little) not].
cString := self cCode: '(char *) &anInt' inSmalltalk: [].
i := 0.
[i < len] whileTrue:
[cString at: i put: i.
i := i + 1].
endianness :=  anInt bitAnd: 255.
^ endianness

This simply isn't usable for something like testing the numArgs in a frame
to decide on pushTemp: whether to fetch the temp from the arguments side of
the frame or the temporary side of the frame.  It is also unnecessarily
complex, with the cacheing on first use.  Now every test of endianness
(which is in 99.9999999% of cases constant throughout a program's run)
involves at least two tests, is the cache valid? followed by what's the
value of the cache?.

So I deleted it from Cog and instead use VMBIGENDIAN directly.  If we care
about performance (and VM writes should), we don't want to fetch a constant
value and test it, ever.  We want the value tested at compile time.

-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20140520/8b87281b/attachment.htm


More information about the Vm-dev mailing list