So someone needs to implement variablesAndOffsetsDo: for TraitBehavior analogous to Behavior&gt;&gt; variablesAndOffsetsDo:.<div>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&gt;&gt;init:context:notifying:</div>
<div><span class="Apple-tab-span" style="white-space: pre; ">        </span>...</div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>class variablesAndOffsetsDo:</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>[:variable &quot;&lt;String|CFieldDefinition&gt;&quot; :offset &quot;&lt;Integer|nil&gt;&quot; |</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>offset isNil</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>ifTrue: [scopeTable at: variable name put: (FieldNode new fieldDefinition: variable)]</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>ifFalse: [scopeTable</div><div><span class="Apple-tab-span" style="white-space:pre">                                                </span>at: variable</div><div><span class="Apple-tab-span" style="white-space:pre">                                                </span>put: (offset &gt;= 0</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                                                </span>ifTrue: [InstanceVariableNode new</div><div><span class="Apple-tab-span" style="white-space:pre">                                                                                        </span>name: variable index: offset]</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                                                </span>ifFalse: [MaybeContextInstanceVariableNode new</div><div><span class="Apple-tab-span" style="white-space:pre">                                                                                        </span>name: variable index: offset negated])]].</div>
<div><span class="Apple-tab-span" style="white-space: pre; ">        </span>...</div><div><br></div><div>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.</div>
<div><br></div><div>Quickly looking at the 3.9 final image I&#39;d say that you&#39;d do the following copies:</div><div>Behavior variablesAndOffsetsDo: =&gt; TraitBehavior</div><div>Behavior instVarNamesAndOffsetsDo: -&gt; TraitBehavior</div>
<div>ClassDescription instVarNamesAndOffsetsDo: -&gt; TraitDescription</div><div><br></div><div>and then things have a good chance of working.</div><div><br></div>HTH</div><div>Eliot</div><div><br><div class="gmail_quote">
On Thu, Jul 16, 2009 at 10:47 AM, Ken Causey <span dir="ltr">&lt;<a href="mailto:ken@kencausey.com">ken@kencausey.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
So I decided I would try to run all the tests and almost immediately I<br>
got a debugger.  This is with an image built using the directions<br>
running on 32-bit linux with exupery 0.15.1 VM.  The failure seems to be<br>
in the setup of TraitsResource<br>
<br>
Ken<br>
<br>
SecurityManager state:<br>
Restricted: false<br>
FileAccess: true<br>
SocketAccess: true<br>
Working Dir /home/ken/projects/squeak/ncdm<br>
Trusted Dir /home/ken/projects/squeak/ncdm/secure<br>
Untrusted Dir /home/ken/projects/squeak/ncdm/My Squeak<br>
<br>
ClassTrait(Object)&gt;&gt;doesNotUnderstand: #variablesAndOffsetsDo:<br>
        Receiver: T2 classTrait<br>
        Arguments and temporary variables:<br>
                aMessage:       variablesAndOffsetsDo: [closure] in<br>
EncoderForV3PlusClosures(Encoder)...etc...<br>
        Receiver&#39;s instance variables:<br>
                methodDict:     a MethodDictionary()<br>
                traitComposition:       {}<br>
                localSelectors:         nil<br>
                users:  an IdentitySet()<br>
                organization:   nil<br>
                baseTrait:      T2<br>
<br>
EncoderForV3PlusClosures(Encoder)&gt;&gt;init:context:notifying:<br>
        Receiver: {an EncoderForV3PlusClosures}<br>
        Arguments and temporary variables:<br>
                aClass:         T2 classTrait<br>
                aContext:       nil<br>
                req:    a Parser<br>
                homeNode:       nil<br>
        Receiver&#39;s instance variables:<br>
                comment:        nil<br>
                pc:     nil<br>
                scopeTable:     a Dictionary(&#39;false&#39;-&gt;{false} &#39;nil&#39;-&gt;{nil} &#39;self&#39;-&gt;{self}<br>
&#39;super&#39;-&gt;...etc...<br>
                nTemps:         0<br>
                supered:        false<br>
                requestor:      a Parser<br>
                class:  T2 classTrait<br>
                selector:       nil<br>
                literalStream:  a WriteStream #()<br>
                selectorSet:    a Dictionary(#*-&gt;{*} #+-&gt;{+} #--&gt;{-} #/-&gt;{/} #&#39;//&#39;-&gt;{//}<br>
#&lt;-&gt;{&lt;} #...etc...<br>
                litIndSet:      a Dictionary()<br>
                litSet:         a LiteralDictionary(-1-&gt;{-1} 0-&gt;{0} 1-&gt;{1} 2-&gt;{2} )<br>
                sourceRanges:   nil<br>
                globalSourceRanges:     nil<br>
                stream:         nil<br>
                position:       nil<br>
                rootNode:       nil<br>
                blockExtentsToLocals:   nil<br>
<br>
[] in Parser&gt;&gt;parse:class:category:noPattern:context:notifying:ifFail:<br>
        Receiver: a Parser<br>
        Arguments and temporary variables:<br>
&lt;&lt;error during printing&gt;<br>
        Receiver&#39;s instance variables:<br>
                source:         a ReadStream &#39;m2ClassSide: a ^a&#39;<br>
                mark:   14<br>
                hereChar:       Character space<br>
                aheadChar:      $^<br>
                token:  &#39;a&#39;<br>
                tokenType:      #word<br>
                currentComment:         nil<br>
                buffer:         a WriteStream &#39;a&#39;<br>
                typeTable:      #(#xBinary #xBinary #xBinary #xBinary #xBinary #xBinary<br>
#xBinary #xB...etc...<br>
                here:   &#39;m2ClassSide:&#39;<br>
                hereType:       #keyword<br>
                hereMark:       1<br>
                hereEnd:        12<br>
                prevMark:       1<br>
                prevEnd:        nil<br>
                encoder:        {an EncoderForV3PlusClosures}<br>
                requestor:      nil<br>
                parseNode:      nil<br>
                failBlock:      [closure] in Compiler&gt;&gt;translate:noPattern:ifFail:<br>
                requestorOffset:        0<br>
                tempsMark:      nil<br>
                doitFlag:       false<br>
                properties:     nil<br>
                category:       #&#39;as yet unclassified&#39;<br>
<br>
BlockClosure&gt;&gt;on:do:<br>
        Receiver: [closure] in<br>
Parser&gt;&gt;parse:class:category:noPattern:context:notifying:ifFail:<br>
        Arguments and temporary variables:<br>
                exception:      ReparseAfterSourceEditing<br>
                handlerAction:  [closure] in<br>
Parser&gt;&gt;parse:class:category:noPattern:context:noti...etc...<br>
                handlerActive:  true<br>
        Receiver&#39;s instance variables:<br>
                outerContext:<br>
Parser&gt;&gt;parse:class:category:noPattern:context:notifying:ifFail:<br>
                startpc:        131<br>
                numArgs:        0<br>
<br>
<br>
--- The full stack ---<br>
ClassTrait(Object)&gt;&gt;doesNotUnderstand: #variablesAndOffsetsDo:<br>
EncoderForV3PlusClosures(Encoder)&gt;&gt;init:context:notifying:<br>
[] in Parser&gt;&gt;parse:class:category:noPattern:context:notifying:ifFail:<br>
BlockClosure&gt;&gt;on:do:<br>
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<br>
Parser&gt;&gt;parse:class:category:noPattern:context:notifying:ifFail:<br>
Compiler&gt;&gt;translate:noPattern:ifFail:<br>
Compiler&gt;&gt;compile:in:classified:notifying:ifFail:<br>
ClassTrait(TraitBehavior)&gt;&gt;compile:classified:notifying:trailer:ifFail:<br>
ClassTrait(TraitDescription)&gt;&gt;compile:classified:withStamp:notifying:logSource:<br>
ClassTrait&gt;&gt;compile:classified:withStamp:notifying:logSource:<br>
ClassTrait(TraitDescription)&gt;&gt;compile:classified:withStamp:notifying:<br>
ClassTrait(TraitDescription)&gt;&gt;compile:classified:notifying:<br>
ClassTrait(TraitDescription)&gt;&gt;compile:notifying:<br>
ClassTrait(TraitBehavior)&gt;&gt;compile:<br>
[] in TraitsResource&gt;&gt;setUp<br>
[] in SystemChangeNotifier&gt;&gt;doSilently:<br>
BlockClosure&gt;&gt;ensure:<br>
SystemChangeNotifier&gt;&gt;doSilently:<br>
TraitsResource&gt;&gt;setUp<br>
TraitsResource(TestResource)&gt;&gt;initialize<br>
TraitsResource class(Behavior)&gt;&gt;new<br>
TraitsResource class(TestResource class)&gt;&gt;current<br>
TraitsResource class(TestResource class)&gt;&gt;isAvailable<br>
[] in TestRunner&gt;&gt;basicSetUpSuite:<br>
Set&gt;&gt;do:<br>
TestRunner&gt;&gt;basicSetUpSuite:<br>
TestRunner&gt;&gt;basicRunSuite:do:<br>
TestRunner&gt;&gt;runSuite:<br>
TestRunner&gt;&gt;runAll<br>
PluggableButtonMorphPlus(PluggableButtonMorph)&gt;&gt;performAction<br>
PluggableButtonMorphPlus&gt;&gt;performAction<br>
[] in PluggableButtonMorphPlus(PluggableButtonMorph)&gt;&gt;mouseUp:<br>
...etc...<br>
<br>
<br><br>
<br></blockquote></div><br></div>