[squeak-dev] The Trunk: Compression-fbs.36.mcz

Levente Uzonyi leves at elte.hu
Sat Jul 6 16:20:03 UTC 2013


On Fri, 5 Jul 2013, commits at source.squeak.org 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
> + 	!
>
>
>


More information about the Squeak-dev mailing list