[squeak-dev] Closure testers needed

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Thu Jul 16 21:11:25 UTC 2009


These methods are in Pharo and stamped eem (almost one year old).
I presume Andreas just missed a 3.9 specific changeSet.

Trait>>variablesAndOffsetsDo: aBinaryBlock
	"This is the interface between the compiler and a class's instance or
field names.  The
	 class should enumerate aBinaryBlock with the field definitions (with
nil offsets) followed
	 by the instance variable name strings and their integer offsets
(1-relative).  The order is
	 important; names evaluated later will override the same names
occurring earlier."

	"Since Traits don't confer state there is nothing to do here."

2009/7/16 Eliot Miranda <eliot.miranda at gmail.com>:
> Hi Ken,
>
> On Thu, Jul 16, 2009 at 1:58 PM, Ken Causey <ken at kencausey.com> wrote:
>>
>> What '3.9 final image' are you referring to?  I see none of these
>> methods in 3.9-7067.  Why are we talking about 3.9 anyway?
>
> You reported a failure in trying to load the closure configuration in an
> image that was equipped with traits, specifically an MNU for
> variablesAndOffsetsDo:.   I took the nearest traits-equipped image I have to
> hand, which is Squeak3.9-final-7067.image and looked.  I was then able to
> explain that this method and a couple of others could be copied from
> Behavior & ClassDescription into TraitBehavior and TraitDescription to fix
> the problem.
> Does that help?
> best
> Eliot
>
>>
>> Ken
>>
>> On Thu, 2009-07-16 at 12:31 -0700, Eliot Miranda wrote:
>> > 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...
>> >
>> >
>> >
>> >
>> >
>> >
>
>
>
>
>



More information about the Squeak-dev mailing list