[squeak-dev] Re: New Window VM (Closures, FT2Plugin, Large Cursors)

Eliot Miranda eliot.miranda at gmail.com
Tue Mar 10 00:04:29 UTC 2009


Hi Klaus,

On Mon, Mar 9, 2009 at 11:04 AM, Klaus D. Witzel <klaus.witzel at cobss.com>wrote:

> On Mon, 09 Mar 2009 19:02:27 +0100, Eliot Miranda wrote:
>
>  On Mon, Mar 9, 2009 at 1:23 AM, Klaus D. Witzel wrote:
>>
> ...
>
>> You may perhaps also want to check the attachment from Mantis #7311 that I
>>> created a minute ago:
>>>
>>> - http://bugs.squeak.org/view.php?id=7311
>>>
>>> This .st has 61 tests which I've written for Marcus' NewCompiler project
>>> (testing sourceCode -> Parser -> nodes -> compiled method ->
>>> InstructionStream). Made a small change for adapting them to your passing
>>> EncoderForV3 to the parser. BTW: all green in the recent
>>> Squeak-3.10.2-Closures.image ;)
>>>
>>
>> Cool!  But TBH let's add a little yellow:
>>
>> testInlineBlockCollection1
>> | col |
>> col := OrderedCollection new.
>> 1 to: 11 do: [ :each | col add: [ each ] ].
>> self assert: (col collect: [ :each | each value ]) asArray = (1 to: 11)
>> asArray
>>
>> testInlineBlockCollection2
>> | col |
>> col := OrderedCollection new.
>> 1 to: 11 do: [ :each | | i | i := each. col add: [ i ]. i := i + 1 ].
>> self assert: (col collect: [ :each | each value ]) asArray = (2 to: 12)
>> asArray
>>
>
> Yellow, right, and they belong into ClosureCompilerTest. But they also
> raise questions:
>
> I've seen that one of the differences between the Encoder*XYZ's is
> #supportsClosureOpcodes being true/false but also #generateAsClosure plays a
> role. So the *Closures suffix is short for *EmitClosuresBytecode? Also,
> blocks are never emitted the old (non-closure) way?


The scheme is that by choosing the encoder one can choose the type of code
generated.  So that e.g. if you say

(Parser new
encoderClass: EncoderForV3PlusClosures;
parse: someString readStream class: MyClass)
 generate: #(0 0 0 0)

you'll get closure code and if you say

(Parser new
encoderClass: EncoderForV3;
parse: someString readStream class: MyClass)
 generate: #(0 0 0 0)

you'll get pre-closure old-block code.

#supportsClosureOpcodes and #generateAsClosure are private internal messages
various parts fo the compiler send to itself to bring this about.  Encoder
implements supportsClosureOpcodes to say if the concrete class is designed
to produce closure code.  BlockNode implements #generateAsClosure  to tell
clients whether it was created as a block node for a closure or for an
old-style block.


If they where (under whatever *config*, blocks emitted the old way) then
> both tests can only fail, that's why I ask.


And on the wrong VM it'll crash.  Only the CLosure VM that people are
providing right now can run both new and old code.  The StackVM we have in
Qwaq (that I hope will be released sometime) will only run Closure code and
die horribly if given old block code.


/Klaus
>
>
> --
> "If at first, the idea is not absurd, then there is no hope for it". Albert
> Einstein
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20090309/df01c12a/attachment.htm


More information about the Squeak-dev mailing list