[Vm-dev] CRC fix input

Eliot Miranda eliot.miranda at gmail.com
Sat Jul 23 22:00:54 UTC 2022


Hi Ken,


On Sat, Jul 23, 2022 at 1:44 PM <ken.dickey at whidbey.com> wrote:

>
> Greetings,
>
> The src/plugins/ZipPlugin/ZipPlugin.c function
> primitiveUpdateGZipCrc32()
> is currently broken on RiscV64.
>
> This is due to a "boxed" 64 bit int, only 32 bits of which is actually
> used here.
>
> The choice I made was to add a definition to
>    platforms/Cross/vm/sqMemoryAccess.h
>
> vvv---vvv
> /* usqInt32 is a 32 bit unsigned integer on 32 and 64 bit systems */
> #define usqInt32 unsigned int
> ^^^---^^^
>
> And then change the local def in primitiveUpdateGZipCrc32()
>
> vvv---vvv
>     usqInt32 crc;
> ^^^---^^^
>
> [A] This works for arch64/arm64 and riscv64/RV64G in both Cuis and
> Squeak, but I currently lack other systems to test on.
>
> [B] This _one_ variable use is the _only_ place so far that I have found
> with this problem.  If the VMMaker ZipPlugin generated the unsigned 32
> bit int var def directly, sqMemoryAccess.h could remain unchanged.
>
> What is the best way to approach this?
>

To fix the plugin.  Fixing the generated source isn't fixing the problem;
it's just making work. Please stop doing this :-)
C plugin source in src/plugins/FooPlugin/FooPlugin.c are generated from the
relevant subclasses of InterpreterPlugin in the VMMaker image.

 Right now the plugin Smalltalk source in
DeflatePlugin>>#primitiveUpdateGZipCrc32 reads:

primitiveUpdateGZipCrc32
   "Primitive. Update a 32bit CRC value."
   <export: true>
   <primitiveMetadata: #(FastCPrimitiveFlag
FastCPrimitiveAlignForFloatsFlag)> "Using AlignForFloats since the
arithmetic is potentially vectorizable..."
   | collection stopIndex startIndex crc length bytePtr |
   <var: #bytePtr type: #'unsigned char *'>
   collection := interpreterProxy stackValue: 0.
   stopIndex := interpreterProxy stackIntegerValue: 1.
   startIndex := interpreterProxy stackIntegerValue: 2.
   crc := interpreterProxy positive32BitValueOf: (interpreterProxy
stackValue: 3).
   interpreterProxy failed ifTrue: [^self].
   ....

I guess you want to insert a
   <var: #crc type: #'unsigned int'>
alongside the
   <var: #bytePtr type: #'unsigned char *'>
declaration

So you make the edit in a VMMaker image and then submit the version to
VMMakerInbox and I integrate it from there.  When you're happy doing this
we'll promote you to a core VMMaker developer and you can commit directly
to VMMaker.

HTH
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20220723/3bbdb9e9/attachment.html>


More information about the Vm-dev mailing list