[squeak-dev] Re: [Vm-dev] Bug in writing compressed stream when saving an mcz (was: New Cog VMs available...)

Eliot Miranda eliot.miranda at gmail.com
Sun Jul 20 03:56:45 UTC 2014


On Sat, Jul 19, 2014 at 11:42 AM, Levente Uzonyi <leves at elte.hu> wrote:

>
> This is a good workaround for the problem, but I think the main issue is
> that the VM has assumptions about the layout of an object.
> I would simply pass all the parameters to the primitive. There's only 14
> of them, so this could work. But this plugin also writes back the state to
> the object, so that would create another problem.
>

Yes, better is an indexOfInstVarNamed: interface where the indices are
computed once on first use.  But this doesn't exist as yet.

I think the best would be to create new variants of #primitiveZipSendBlock
> and #primitiveDeflateBlock which accept an array, and use that to load and
> store the paramters of the compression algorithm. This way objects with
> different layout would be able to use the plugin, and we could get rid of
> these compression streams in the long term (or change their layout without
> breaking them).
>

Best is Sista speculative inlining/adaptive optimization, where the vanilla
Smalltalk code is optimized to equal or exceed C level performance.  We
might be as little as two years away from that.



> Another solution would be to use an external library(libraries) for
> compression, but that's a lot more work.
>
>
> Levente
>
> P.S.: instead of finding the number of slots of WriteStream, it would have
> been possible to index the slots from the end of the passed object. E.g.
>
> loadDeflateStreamFrom: rcvr
>         | slotSize oop |
>         <inline: false>
>         (interpreterProxy isPointers: rcvr) ifFalse: [ ^false ].
>         slotSize := interpreterProxy slotSizeOf: rcvr.
>         slotSize < 15 ifTrue: [ ^false ].
>         ...
>
>         zipCollection := interpreterProxy firstIndexableField: oop.
>         zipCollectionSize := interpreterProxy byteSizeOf: oop.
>
>         zipPosition := interpreterProxy fetchInteger: 1 ofObject: rcvr.
>         zipReadLimit := interpreterProxy fetchInteger: 2 ofObject: rcvr.
>         ...
>         oop := interpreterProxy fetchPointer: slotSize - 14 ofObject: rcvr.
>
>         ((interpreterProxy isWords: oop)
>          and: [(interpreterProxy slotSizeOf: oop) = DeflateHashTableSize])
> ifFalse:
>                 [^false].
>         zipHashHead := interpreterProxy firstIndexableField: oop.
>         oop := interpreterProxy fetchPointer: slotSize - 13 ofObject: rcvr.
>
>         ((interpreterProxy isWords: oop)
>          and: [(interpreterProxy slotSizeOf: oop) = DeflateWindowSize])
> ifFalse:
>                 [^false].
>         zipHashTail := interpreterProxy firstIndexableField: oop.
>         zipHashValue := interpreterProxy fetchInteger: slotSize - 12
> ofObject: rcvr.
>         zipBlockPos := interpreterProxy fetchInteger: slotSize - 11
> ofObject: rcvr.
>         ...
>
> Of course this would have its own cons.
>
>
> On Sat, 19 Jul 2014, David T. Lewis wrote:
>
>
>> On Fri, Jul 18, 2014 at 05:26:52PM -0700, Eliot Miranda wrote:
>>
>>>
>>> Hi All,
>>>
>>>    find the fix attached.  I hope we can fold this into the standard VM
>>> soon.
>>>
>>>
>> Thanks Eliot, I'll update it this weekend in VMM trunk also.
>>
>> Dave
>>
>>
>>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20140719/29f7ceab/attachment-0001.htm


More information about the Vm-dev mailing list