<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Ken,</div><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jul 23, 2022 at 1:44 PM <<a href="mailto:ken.dickey@whidbey.com">ken.dickey@whidbey.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> <br>
Greetings,<br>
<br>
The src/plugins/ZipPlugin/ZipPlugin.c function <br>
primitiveUpdateGZipCrc32()<br>
is currently broken on RiscV64.<br>
<br>
This is due to a "boxed" 64 bit int, only 32 bits of which is actually <br>
used here.<br>
<br>
The choice I made was to add a definition to<br>
   platforms/Cross/vm/sqMemoryAccess.h<br>
<br>
vvv---vvv<br>
/* usqInt32 is a 32 bit unsigned integer on 32 and 64 bit systems */<br>
#define usqInt32 unsigned int<br>
^^^---^^^<br>
<br>
And then change the local def in primitiveUpdateGZipCrc32()<br>
<br>
vvv---vvv<br>
    usqInt32 crc;<br>
^^^---^^^<br>
<br>
[A] This works for arch64/arm64 and riscv64/RV64G in both Cuis and <br>
Squeak, but I currently lack other systems to test on.<br>
<br>
[B] This _one_ variable use is the _only_ place so far that I have found <br>
with this problem.  If the VMMaker ZipPlugin generated the unsigned 32 <br>
bit int var def directly, sqMemoryAccess.h could remain unchanged.<br>
<br>
What is the best way to approach this?<br></blockquote><div><br></div><div class="gmail_default" style="font-size:small">To fix the plugin.  Fixing the generated source isn't fixing the problem; it's just making work. Please stop doing this :-)</div><div class="gmail_default" style="font-size:small">C plugin source in src/plugins/FooPlugin/FooPlugin.c are generated from the relevant subclasses of InterpreterPlugin in the VMMaker image.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"> Right now the plugin Smalltalk source in DeflatePlugin>>#primitiveUpdateGZipCrc32 reads:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">primitiveUpdateGZipCrc32</div>    <span class="gmail_default" style="font-size:small">    </span>"Primitive. Update a 32bit CRC value."<br>     <span class="gmail_default" style="font-size:small">    </span><export: true><br> <span class="gmail_default" style="font-size:small">    </span><primitiveMetadata: #(FastCPrimitiveFlag FastCPrimitiveAlignForFloatsFlag)> "Using AlignForFloats since the arithmetic is potentially vectorizable..."<br>       <span class="gmail_default" style="font-size:small">    </span>| collection stopIndex startIndex crc length bytePtr |<br>       <span class="gmail_default" style="font-size:small">    </span><var: #bytePtr type: #'unsigned char *'><br>       <span class="gmail_default" style="font-size:small">    </span>collection := interpreterProxy stackValue: 0.<br>        <span class="gmail_default" style="font-size:small">    </span>stopIndex := interpreterProxy stackIntegerValue: 1.<br>  <span class="gmail_default" style="font-size:small">    </span>startIndex := interpreterProxy stackIntegerValue: 2.<br> <span class="gmail_default" style="font-size:small">    </span>crc := interpreterProxy positive32BitValueOf: (interpreterProxy stackValue: 3).<br>      <span class="gmail_default" style="font-size:small">    </span>interpreterProxy failed ifTrue: [^self].</div><div class="gmail_quote"><div class="gmail_default" style="font-size:small">    ....</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I guess you want to insert a</div><div class="gmail_quote"><span class="gmail_default">    </span><var: #<span class="gmail_default" style="font-size:small">crc</span> type: #'unsigned <span class="gmail_default" style="font-size:small">int</span>'><br></div><div class="gmail_default" style="font-size:small">alongside the</div><span class="gmail_default">    </span><var: #bytePtr type: #'unsigned char *'><div class="gmail_default" style="font-size:small">declaration</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">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.</div></div><div><br></div><div class="gmail_default" style="font-size:small">HTH</div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div>