[Vm-dev] 64-bit WideString access (was [squeak-dev] New Cog VMs available)

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Thu Mar 31 05:42:59 UTC 2016


I have a change where I massively decalred the bitblt operands as unsigned
int.
I did not push it so far, but I'll try to see if it solves the symptoms.

2016-03-31 3:16 GMT+02:00 Levente Uzonyi <leves at caesar.elte.hu>:

> Hi Eliot,
>
> I made a snippet to read the source of the method as an array of integers
> from the .mcz in the package cache:
>
> (MCMczReader versionFromFile: 'package-cache/Multilingual-ul.210.mcz')
> snapshot definitions
>         detect: [ :each |
>                 each isMethodDefinition
>                         and: [ each className = #JapaneseEnvironment
>                                 and: [ each selector = #flapTabTextFor:in:
> ] ] ]
>         ifFound: [ :definition |
>                 Array streamContents: [ :stream |
>                         | source |
>                         source := definition source.
>                         1 to: source size do: [ :index |
>                                 stream nextPut: (source basicAt: index) ]
> ] ]
>         ifNone: [ self error ]
>
> In MCMczReader >> #loadDefinitions, if you change this line
>
>                 [:m | [^definitions := (DataStream on: m contentStream)
> next definitions]
>
> to this
>
>                 [:m | [ self error. ^definitions := (DataStream on: m
> contentStream) next definitions]
>
> then the definition will be read from the sources instead of the binary
> snapshot, and you'll get the correct source code.
>
> First I disabled all the ZipPlugin primitives to see if those are
> responsible for this issue, but they turned out to be okay.
> Then I dag into DataStream, and I came to the conclusion that the issue is
> in BitBlt. The mangled characters appear when PositionableStream >>
> #nextWordsInto: applies some BitBlt magic to convert the read bytes into a
> WideString.
>
> Here's a snippet triggering the error:
>
> | wideString source pos blt expectedWideString |
> source := #[1 64 255 14 1 64 48 251].
> expectedWideString := WideString fromByteArray: source.
> wideString := WideString new: source size // 4.
> pos := 0.
> blt := (BitBlt
>         toForm: (Form new hackBits: wideString))
>         sourceForm: (Form new hackBits: source).
> blt
>         combinationRule: Form over;
>         sourceX: 0;
>         sourceY: pos // 4;
>         height: wideString byteSize // 4;
>         width: 4;
>         destX: 0;
>         destY: 0;
>         copyBits.
> wideString restoreEndianness.
> self assert: wideString = expectedWideString
>
> Levente
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20160331/3024d773/attachment.htm


More information about the Squeak-dev mailing list