<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jul 19, 2014 at 11:42 AM, Levente Uzonyi <span dir="ltr">&lt;<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
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.<br>
I would simply pass all the parameters to the primitive. There&#39;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.<br></blockquote><div>
<br></div><div>Yes, better is an indexOfInstVarNamed: interface where the indices are computed once on first use.  But this doesn&#39;t exist as yet.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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).<br>
</blockquote><div><br></div><div>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.</div>
<div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Another solution would be to use an external library(libraries) for compression, but that&#39;s a lot more work.<br>
<br>
<br>
Levente<br>
<br>
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.<br>
<br>
loadDeflateStreamFrom: rcvr<br>
        | slotSize oop |<br>
        &lt;inline: false&gt;<br>
        (interpreterProxy isPointers: rcvr) ifFalse: [ ^false ].<br>
        slotSize := interpreterProxy slotSizeOf: rcvr.<br>
        slotSize &lt; 15 ifTrue: [ ^false ].<br>
        ...<div class=""><br>
        zipCollection := interpreterProxy firstIndexableField: oop.<br>
        zipCollectionSize := interpreterProxy byteSizeOf: oop.<br>
<br>
        zipPosition := interpreterProxy fetchInteger: 1 ofObject: rcvr.<br>
        zipReadLimit := interpreterProxy fetchInteger: 2 ofObject: rcvr.<br></div>
        ...<br>
        oop := interpreterProxy fetchPointer: slotSize - 14 ofObject: rcvr.<div class=""><br>
        ((interpreterProxy isWords: oop)<br>
         and: [(interpreterProxy slotSizeOf: oop) = DeflateHashTableSize]) ifFalse:<br>
                [^false].<br>
        zipHashHead := interpreterProxy firstIndexableField: oop.<br></div>
        oop := interpreterProxy fetchPointer: slotSize - 13 ofObject: rcvr.<div class=""><br>
        ((interpreterProxy isWords: oop)<br>
         and: [(interpreterProxy slotSizeOf: oop) = DeflateWindowSize]) ifFalse:<br>
                [^false].<br>
        zipHashTail := interpreterProxy firstIndexableField: oop.<br></div>
        zipHashValue := interpreterProxy fetchInteger: slotSize - 12 ofObject: rcvr.<br>
        zipBlockPos := interpreterProxy fetchInteger: slotSize - 11 ofObject: rcvr.<br>
        ...<br>
<br>
Of course this would have its own cons.<div class="HOEnZb"><div class="h5"><br>
<br>
On Sat, 19 Jul 2014, David T. Lewis wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
On Fri, Jul 18, 2014 at 05:26:52PM -0700, Eliot Miranda wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Hi All,<br>
<br>
   find the fix attached.  I hope we can fold this into the standard VM<br>
soon.<br>
<br>
</blockquote>
<br>
Thanks Eliot, I&#39;ll update it this weekend in VMM trunk also.<br>
<br>
Dave<br>
<br>
<br>
</blockquote>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>
</div></div>