[squeak-dev] Closure testers needed

Eliot Miranda eliot.miranda at gmail.com
Thu Jul 16 19:31:14 UTC 2009


So someone needs to implement variablesAndOffsetsDo: for TraitBehavior
analogous to Behavior>> variablesAndOffsetsDo:.variablesAndOffsetsDo: is the
interface I added between the compiler and the class its compiling in to
abstract away from instance variable/slot implementation.  See
Encoder>>init:context:notifying:
...
class variablesAndOffsetsDo:
[:variable "<String|CFieldDefinition>" :offset "<Integer|nil>" |
offset isNil
ifTrue: [scopeTable at: variable name put: (FieldNode new fieldDefinition:
variable)]
ifFalse: [scopeTable
at: variable
put: (offset >= 0
ifTrue: [InstanceVariableNode new
name: variable index: offset]
ifFalse: [MaybeContextInstanceVariableNode new
name: variable index: offset negated])]].
...

FieldNode is the Tweak compiler extension that compiles Tweak property
access as message sends to slot accessors.  The negative offset hack allows
ContextPart (actually InstructionStream and subclasses) to access its
instance variables specially, allowing the VM to hide context-to-sack
mapping and make contexts appear like normal objects even though inside the
VM they may actually be proxies for stack frames.

Quickly looking at the 3.9 final image I'd say that you'd do the following
copies:
Behavior variablesAndOffsetsDo: => TraitBehavior
Behavior instVarNamesAndOffsetsDo: -> TraitBehavior
ClassDescription instVarNamesAndOffsetsDo: -> TraitDescription

and then things have a good chance of working.

HTH
Eliot

On Thu, Jul 16, 2009 at 10:47 AM, Ken Causey <ken at kencausey.com> wrote:

> So I decided I would try to run all the tests and almost immediately I
> got a debugger.  This is with an image built using the directions
> running on 32-bit linux with exupery 0.15.1 VM.  The failure seems to be
> in the setup of TraitsResource
>
> Ken
>
> SecurityManager state:
> Restricted: false
> FileAccess: true
> SocketAccess: true
> Working Dir /home/ken/projects/squeak/ncdm
> Trusted Dir /home/ken/projects/squeak/ncdm/secure
> Untrusted Dir /home/ken/projects/squeak/ncdm/My Squeak
>
> ClassTrait(Object)>>doesNotUnderstand: #variablesAndOffsetsDo:
>        Receiver: T2 classTrait
>        Arguments and temporary variables:
>                aMessage:       variablesAndOffsetsDo: [closure] in
> EncoderForV3PlusClosures(Encoder)...etc...
>        Receiver's instance variables:
>                methodDict:     a MethodDictionary()
>                traitComposition:       {}
>                localSelectors:         nil
>                users:  an IdentitySet()
>                organization:   nil
>                baseTrait:      T2
>
> EncoderForV3PlusClosures(Encoder)>>init:context:notifying:
>        Receiver: {an EncoderForV3PlusClosures}
>        Arguments and temporary variables:
>                aClass:         T2 classTrait
>                aContext:       nil
>                req:    a Parser
>                homeNode:       nil
>        Receiver's instance variables:
>                comment:        nil
>                pc:     nil
>                scopeTable:     a Dictionary('false'->{false} 'nil'->{nil}
> 'self'->{self}
> 'super'->...etc...
>                nTemps:         0
>                supered:        false
>                requestor:      a Parser
>                class:  T2 classTrait
>                selector:       nil
>                literalStream:  a WriteStream #()
>                selectorSet:    a Dictionary(#*->{*} #+->{+} #-->{-} #/->{/}
> #'//'->{//}
> #<->{<} #...etc...
>                litIndSet:      a Dictionary()
>                litSet:         a LiteralDictionary(-1->{-1} 0->{0} 1->{1}
> 2->{2} )
>                sourceRanges:   nil
>                globalSourceRanges:     nil
>                stream:         nil
>                position:       nil
>                rootNode:       nil
>                blockExtentsToLocals:   nil
>
> [] in Parser>>parse:class:category:noPattern:context:notifying:ifFail:
>        Receiver: a Parser
>        Arguments and temporary variables:
> <<error during printing>
>        Receiver's instance variables:
>                source:         a ReadStream 'm2ClassSide: a ^a'
>                mark:   14
>                hereChar:       Character space
>                aheadChar:      $^
>                token:  'a'
>                tokenType:      #word
>                currentComment:         nil
>                buffer:         a WriteStream 'a'
>                typeTable:      #(#xBinary #xBinary #xBinary #xBinary
> #xBinary #xBinary
> #xBinary #xB...etc...
>                here:   'm2ClassSide:'
>                hereType:       #keyword
>                hereMark:       1
>                hereEnd:        12
>                prevMark:       1
>                prevEnd:        nil
>                encoder:        {an EncoderForV3PlusClosures}
>                requestor:      nil
>                parseNode:      nil
>                failBlock:      [closure] in
> Compiler>>translate:noPattern:ifFail:
>                requestorOffset:        0
>                tempsMark:      nil
>                doitFlag:       false
>                properties:     nil
>                category:       #'as yet unclassified'
>
> BlockClosure>>on:do:
>        Receiver: [closure] in
> Parser>>parse:class:category:noPattern:context:notifying:ifFail:
>        Arguments and temporary variables:
>                exception:      ReparseAfterSourceEditing
>                handlerAction:  [closure] in
> Parser>>parse:class:category:noPattern:context:noti...etc...
>                handlerActive:  true
>        Receiver's instance variables:
>                outerContext:
> Parser>>parse:class:category:noPattern:context:notifying:ifFail:
>                startpc:        131
>                numArgs:        0
>
>
> --- The full stack ---
> ClassTrait(Object)>>doesNotUnderstand: #variablesAndOffsetsDo:
> EncoderForV3PlusClosures(Encoder)>>init:context:notifying:
> [] in Parser>>parse:class:category:noPattern:context:notifying:ifFail:
> BlockClosure>>on:do:
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> Parser>>parse:class:category:noPattern:context:notifying:ifFail:
> Compiler>>translate:noPattern:ifFail:
> Compiler>>compile:in:classified:notifying:ifFail:
> ClassTrait(TraitBehavior)>>compile:classified:notifying:trailer:ifFail:
>
> ClassTrait(TraitDescription)>>compile:classified:withStamp:notifying:logSource:
> ClassTrait>>compile:classified:withStamp:notifying:logSource:
> ClassTrait(TraitDescription)>>compile:classified:withStamp:notifying:
> ClassTrait(TraitDescription)>>compile:classified:notifying:
> ClassTrait(TraitDescription)>>compile:notifying:
> ClassTrait(TraitBehavior)>>compile:
> [] in TraitsResource>>setUp
> [] in SystemChangeNotifier>>doSilently:
> BlockClosure>>ensure:
> SystemChangeNotifier>>doSilently:
> TraitsResource>>setUp
> TraitsResource(TestResource)>>initialize
> TraitsResource class(Behavior)>>new
> TraitsResource class(TestResource class)>>current
> TraitsResource class(TestResource class)>>isAvailable
> [] in TestRunner>>basicSetUpSuite:
> Set>>do:
> TestRunner>>basicSetUpSuite:
> TestRunner>>basicRunSuite:do:
> TestRunner>>runSuite:
> TestRunner>>runAll
> PluggableButtonMorphPlus(PluggableButtonMorph)>>performAction
> PluggableButtonMorphPlus>>performAction
> [] in PluggableButtonMorphPlus(PluggableButtonMorph)>>mouseUp:
> ...etc...
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20090716/db8eb3bf/attachment.htm


More information about the Squeak-dev mailing list