The Trunk: Compression-fbs.36.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Compression-fbs.36.mcz

commits-2
Frank Shearar uploaded a new version of Compression to project The Trunk:
http://source.squeak.org/trunk/Compression-fbs.36.mcz

==================== Summary ====================

Name: Compression-fbs.36
Author: fbs
Time: 5 July 2013, 9:59:01.646 pm
UUID: 44283c36-3bbc-5444-bc84-35144b694d12
Ancestors: Compression-fbs.35

Make Compression augment Kernel, and thus break the cyclic Kernel <-> Compression dependency.

=============== Diff against Compression-fbs.35 ===============

Item was added:
+ ----- Method: CompiledMethodTrailer>>decodeEmbeddedSourceZip (in category '*Compression-KernelExtensions') -----
+ decodeEmbeddedSourceZip
+
+ "data is string with method's source code, compressed using zip compression"
+ self decodeZip.!

Item was added:
+ ----- Method: CompiledMethodTrailer>>decodeTempsNamesZip (in category '*Compression-KernelExtensions') -----
+ decodeTempsNamesZip
+
+ "data is string with method's temporary names, compressed using zip compression"
+ self decodeZip.!

Item was added:
+ ----- Method: CompiledMethodTrailer>>decodeZip (in category '*Compression-KernelExtensions') -----
+ decodeZip
+
+ "data := <trailer> unzip utf8ToSqueak"
+ | len bytes |
+ len := self decodeLengthField.
+ bytes := ByteArray new: len.
+ 1 to: len do: [ :i |
+ bytes at: i put: (method at: method size - size + i) ].
+
+ data := (ZipReadStream on: bytes) contents asString convertFromEncoding: 'utf8'!

Item was added:
+ ----- Method: CompiledMethodTrailer>>encodeEmbeddedSourceZip (in category '*Compression-KernelExtensions') -----
+ encodeEmbeddedSourceZip
+
+ "data is string with method's source code, encode it using Zip compression method"
+ self encodeUsingZip
+ !

Item was added:
+ ----- Method: CompiledMethodTrailer>>encodeTempsNamesZip (in category '*Compression-KernelExtensions') -----
+ encodeTempsNamesZip
+
+ "data is string with method's temporary names, encode it using zip compression"
+ self encodeUsingZip
+
+ "data is string with method's source code, encoded using qCompress method"
+
+
+ !

Item was added:
+ ----- Method: CompiledMethodTrailer>>encodeUsingZip (in category '*Compression-KernelExtensions') -----
+ encodeUsingZip
+
+ "data is string, encode it using gzip compression"
+ | utf8str stream length encodedLength |
+
+ self assert: (data isString).
+ utf8str := data convertToEncoding: 'utf8'.
+
+ stream := ((ZipWriteStream on: (ByteArray new: utf8str size))
+ nextPutAll: utf8str asByteArray;
+ close;
+ encodedStream).
+
+ length := stream position.
+ encodedLength := self encodeLengthField: length.
+
+ stream nextPutAll: encodedLength.
+ "trailing byte"
+ stream nextPut: (self kindAsByte + encodedLength size - 1).
+
+ encodedData := stream contents
+ !


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Compression-fbs.36.mcz

Levente Uzonyi-2
On Fri, 5 Jul 2013, [hidden email] wrote:

> Frank Shearar uploaded a new version of Compression to project The Trunk:
> http://source.squeak.org/trunk/Compression-fbs.36.mcz
>
> ==================== Summary ====================
>
> Name: Compression-fbs.36
> Author: fbs
> Time: 5 July 2013, 9:59:01.646 pm
> UUID: 44283c36-3bbc-5444-bc84-35144b694d12
> Ancestors: Compression-fbs.35
>
> Make Compression augment Kernel, and thus break the cyclic Kernel <-> Compression dependency.

This is a bit half-baked. Some of these methods will still be used from
the Kernel code (see #trailerKindDecoders and its sender). Fully resolving
this issue is not that easy. I started it about 2 years ago, but still
haven't finished it. :)


Levente

>
> =============== Diff against Compression-fbs.35 ===============
>
> Item was added:
> + ----- Method: CompiledMethodTrailer>>decodeEmbeddedSourceZip (in category '*Compression-KernelExtensions') -----
> + decodeEmbeddedSourceZip
> +
> + "data is string with method's source code, compressed using zip compression"
> + self decodeZip.!
>
> Item was added:
> + ----- Method: CompiledMethodTrailer>>decodeTempsNamesZip (in category '*Compression-KernelExtensions') -----
> + decodeTempsNamesZip
> +
> + "data is string with method's temporary names, compressed using zip compression"
> + self decodeZip.!
>
> Item was added:
> + ----- Method: CompiledMethodTrailer>>decodeZip (in category '*Compression-KernelExtensions') -----
> + decodeZip
> +
> + "data := <trailer> unzip utf8ToSqueak"
> + | len bytes |
> + len := self decodeLengthField.
> + bytes := ByteArray new: len.
> + 1 to: len do: [ :i |
> + bytes at: i put: (method at: method size - size + i) ].
> +
> + data := (ZipReadStream on: bytes) contents asString convertFromEncoding: 'utf8'!
>
> Item was added:
> + ----- Method: CompiledMethodTrailer>>encodeEmbeddedSourceZip (in category '*Compression-KernelExtensions') -----
> + encodeEmbeddedSourceZip
> +
> + "data is string with method's source code, encode it using Zip compression method"
> + self encodeUsingZip
> + !
>
> Item was added:
> + ----- Method: CompiledMethodTrailer>>encodeTempsNamesZip (in category '*Compression-KernelExtensions') -----
> + encodeTempsNamesZip
> +
> + "data is string with method's temporary names, encode it using zip compression"
> + self encodeUsingZip
> +
> + "data is string with method's source code, encoded using qCompress method"
> +
> +
> + !
>
> Item was added:
> + ----- Method: CompiledMethodTrailer>>encodeUsingZip (in category '*Compression-KernelExtensions') -----
> + encodeUsingZip
> +
> + "data is string, encode it using gzip compression"
> + | utf8str stream length encodedLength |
> +
> + self assert: (data isString).
> + utf8str := data convertToEncoding: 'utf8'.
> +
> + stream := ((ZipWriteStream on: (ByteArray new: utf8str size))
> + nextPutAll: utf8str asByteArray;
> + close;
> + encodedStream).
> +
> + length := stream position.
> + encodedLength := self encodeLengthField: length.
> +
> + stream nextPutAll: encodedLength.
> + "trailing byte"
> + stream nextPut: (self kindAsByte + encodedLength size - 1).
> +
> + encodedData := stream contents
> + !
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Compression-fbs.36.mcz

Frank Shearar-3
On 6 July 2013 17:20, Levente Uzonyi <[hidden email]> wrote:

> On Fri, 5 Jul 2013, [hidden email] wrote:
>
>> Frank Shearar uploaded a new version of Compression to project The Trunk:
>> http://source.squeak.org/trunk/Compression-fbs.36.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Compression-fbs.36
>> Author: fbs
>> Time: 5 July 2013, 9:59:01.646 pm
>> UUID: 44283c36-3bbc-5444-bc84-35144b694d12
>> Ancestors: Compression-fbs.35
>>
>> Make Compression augment Kernel, and thus break the cyclic Kernel <->
>> Compression dependency.
>
>
> This is a bit half-baked. Some of these methods will still be used from the
> Kernel code (see #trailerKindDecoders and its sender). Fully resolving this
> issue is not that easy. I started it about 2 years ago, but still haven't
> finished it. :)

I'm not surprised to hear you say that (that it's half-baked). I'm
hoping that while I try get the dependency arrows pointing the right
way that it'll spur people to committing improvements to trunk!

frank

> Levente