<div dir="ltr"><div>Hi <br><br>The new change set <br><a href="http://7600-ReferenceStream-Compatibility-JuanVuletich-2025Sep22-09h46m-jmv.003.cs.st">7600-ReferenceStream-Compatibility-JuanVuletich-2025Sep22-09h46m-jmv.003.cs.st</a><br>does not yet re-establish the compatibily for ReferenceStreams as far as SmallIntegers are concerned.<br><br>Individually Cuis<br>[3] <br>````<br>ReferenceStreamTest new testSmallIntegers.<br>````<br><br>and Squeak [4] pass with the test values given in the Cuis BaseImageTest package for ReferenceStreams.<br><br>What the Cuis change set <br><a href="http://7600-ReferenceStream-Compatibility-JuanVuletich-2025Sep22-09h46m-jmv.003.cs.st">7600-ReferenceStream-Compatibility-JuanVuletich-2025Sep22-09h46m-jmv.003.cs.st</a><br>does not provide yet is that the object file written in Squeak may be read in Cuis 7.5_7601 [5].<br>Integers in the test array positions 6 to 11 are restored as LargePositiveInteger or LargeNegativeInteger values.<br>In Squeak 6.1.a these values are restored as SmallInteger values, the way they were written.<br><br>--Hannes<br></div><div><br></div><div>Attachements: anArrayOfSmallIntegersFromSqueak.obj and</div><div>Cuis test <br></div><div>which provides the log in [5]<br></div><div><br>## [3] ReferenceStreamTest new testSmallIntegers<br>(from Cuis package BaseImageTests)<br>````<br>testSmallIntegers<br> "<br> ReferenceStreamTest new testSmallIntegers<br> "<br> | newInstance oldInstance |<br> oldInstance := {-1. 0 . 1. 123456. -123456. 1234567890. -1234567890. 123456789012345678. -123456789012345678. (2 raisedTo: 60)-1. (2 raisedTo: 60) negated }.<br> newInstance := ReferenceStream unStream: (ReferenceStream streamedRepresentationOf: oldInstance).<br> self assert: newInstance = oldInstance.<br>````<br><br><br>## [4] Test Serializing integer values with ReferenceStream in Squeak 6.1a<br><br>````<br>"Squeak6.1alpha latest update: #23331"<br> "Test also passes in Squeak5.3 latest update: #19459"<br> objectToSave := {-1. 0 . 1. 123456. -123456. 1234567890. -1234567890. 123456789012345678. -123456789012345678. (2 raisedTo: 60)-1. (2 raisedTo: 60) negated }.<br> <br> fileStream := ReferenceStream fileNamed: 'anArrayOfSmallIntegersFromSqueak.obj'.<br> fileStream nextPut: objectToSave.<br> fileStream close.<br> <br> rr := ReferenceStream fileNamed: 'anArrayOfSmallIntegersFromSqueak.obj'.<br> restoredObject := rr next.<br> rr close.<br> <br> <br> <br> objectToSave = restoredObject<br> true <br> <br><br>"Note:<br>SmallInteger maxVal 1152921504606846975"<br>````<br><br>## [5] Restore in Cuis<br>````<br>"Cuis 7.5_6001"<br><br>testSmallIntegersFromSqueak<br> "<br> ReferenceStreamTest new testSmallIntegersFromSqueak<br> "<br> | newInstanceCuis oldInstance newInstanceSqueak i |<br> oldInstance := {-1. 0 . 1. 123456. -123456. 1234567890. -1234567890. 123456789012345678. -123456789012345678. (2 raisedTo: 60)-1. (2 raisedTo: 60) negated }.<br> newInstanceCuis := ReferenceStream unStream: (ReferenceStream streamedRepresentationOf: oldInstance).<br> self assert: newInstanceCuis = oldInstance.<br> <br> newInstanceSqueak := ReferenceStream restoreFromFile: ('anArrayOfSmallIntegersFromSqueak.obj' asFileEntry).<br><br> i := 1.<br> newInstanceCuis do: [:item | |itemSq|<br> itemSq := (newInstanceSqueak at: i). Transcript show: i printString, ' '; show: item printString, ' '; show: (item = itemSq); show: ' Cuis class=', item class printString; show: ' Squeak class=', itemSq class printString;cr. i := i + 1].<br><br> self assert: newInstanceSqueak = oldInstance.<br> <br>````<br><br>Log in Transcript<br>````<br>1 -1 true Cuis class=SmallInteger; Restored from Squeak class=SmallInteger<br>2 0 true Cuis class=SmallInteger; Restored from Squeak class=SmallInteger<br>3 1 true Cuis class=SmallInteger; Restored from Squeak class=SmallInteger<br>4 123456 true Cuis class=SmallInteger; Restored from Squeak class=SmallInteger<br>5 -123456 true Cuis class=SmallInteger; Restored from Squeak class=SmallInteger<br>6 1234567890 false Cuis class=SmallInteger; Restored from Squeak class=LargePositiveInteger<br>7 -1234567890 false Cuis class=SmallInteger; Restored from Squeak class=LargeNegativeInteger<br>8 123456789012345678 false Cuis class=SmallInteger; Restored from Squeak class=LargePositiveInteger<br>9 -123456789012345678 false Cuis class=SmallInteger; Restored from Squeak class=LargeNegativeInteger<br>10 1152921504606846975 false Cuis class=SmallInteger; Restored from Squeak class=LargePositiveInteger<br>11 -1152921504606846976 false Cuis class=SmallInteger; Restored from Squeak class=LargeNegativeInteger<br><br>ReferenceStreamTest>>#testSmallIntegersFromSqueak -- Assertion (2) failed. TestFailure: Assertion (2) failed. <br><br>````</div><div dir="ltr"><br></div><div dir="ltr"><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, Sep 24, 2025 at 3:31 AM Juan Vuletich via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st">cuis-dev@lists.cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div>
<p>Hi Nicolas,</p>
<p>Oh gosh! #objectForDataStream: I didn't see that coming! I only
saw #readInteger and #writeInteger: in Squeak and assumed Squeak
was broken. And didn't try it before opening my mouth. Apologies
for my ill informed and rude comment.</p>
<p>It was only Cuis that was broken until last week WRT this.</p>
<p>WRT compatibility between Squeak and Cuis wrt DataStream, a lot
of content is compatible. Larger SmallIntegers written in Squeak
(as LargeIntegers) will be read correctly in Cuis. But those
written in Cuis will use a new TypeMap entry with code 25 that
uses two 32 bit words. I prefer this approach, because I want to
be able to load DataStreams that don't have any LargeIntegers into
small bootstrapped images that don't include LargeIntegers at all.
The 'minimal kernel' images I'm building haven't seen need for
LargeIntegers yet, and so I prefer not to include them, and keep
them in a separate pre-compiled "dynamic cuis library". The "25"
format is easy to add to Squeak, at least for reading, though.</p>
<p>But I'm pretty sure there are incompatibilities in Character,
UnicodeString and UnicodeSymbol. Floats and Byte-Strings seem to
be OK.</p>
<p>If you want to collaborate with me on keeping DataStream as
compatible as possible (Morphs are out of the question, I guess!),
and are willing to make minor tweaks for Squeak, I'm willing to
make them for Cuis as needed.</p>
<p>Thanks!</p>
<div>On 23/09/2025 6:11 PM, Nicolas Cellier
via Cuis-dev wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>Hi Juan,<br>
</div>
I fail to see the bug in current Squeak trunk.<br>
</div>
I tried this<br>
<br>
| int out file |<br>
int := SmallInteger maxVal.<font color="#000000"><br>
</font><font color="#6B6B6B">file</font><font color="#000000"> </font><b>:=</b><font color="#000000">
</font><font color="#000000">FileStream</font><font color="#000000"> </font><font color="#000080">fileNamed:</font><font color="#000000"> </font><font color="#800080">'Test-Int'</font><font color="#000000">.</font><font color="#000000"><br>
</font><font color="#6B6B6B">file</font><font color="#000000"> </font><font color="#000080">binary</font><font color="#000000">.</font><font color="#000000"><br>
</font><font color="#000000">(</font><font color="#000000">DataStream</font><font color="#000000">
</font><font color="#000080">on:</font><font color="#000000"> </font><font color="#6B6B6B">file</font><font color="#000000">)</font><font color="#000000"> </font><font color="#000080">nextPut:</font><font color="#000000"> </font><font color="#000080">int</font><font color="#000000">.</font><font color="#000000"><br>
</font><font color="#6B6B6B">file</font><font color="#000000"> </font><font color="#000080">close</font><font color="#000000">.</font><font color="#000000"><br>
<br>
</font><font color="#6B6B6B">file</font><font color="#000000"> </font><b>:=</b><font color="#000000">
</font><font color="#000000">FileStream</font><font color="#000000"> </font><font color="#000080">fileNamed:</font><font color="#000000"> </font><font color="#800080">'Test-Int'</font><font color="#000000">.</font><font color="#000000"><br>
</font><font color="#6B6B6B">file</font><font color="#000000"> </font><font color="#000080">binary</font><font color="#000000">.</font><font color="#000000"><br>
</font><font color="#6B6B6B">out</font><font color="#000000"> </font><b>:=</b><font color="#000000">
</font><font color="#000000">(</font><font color="#000000">DataStream</font><font color="#000000"> </font><font color="#000080">on:</font><font color="#000000"> </font><font color="#6B6B6B">file</font><font color="#000000">)</font><font color="#000000"> </font><font color="#000080">next</font><font color="#000000">.</font><font color="#000000"><br>
</font><font color="#6B6B6B">file</font><font color="#000000"> </font><font color="#000080">close</font><font color="#000000">.</font><font color="#000000"><br>
<br>
self assert: int = out<br>
<br>
</font></div>
<font color="#000000">The large SmallInteger is restored
correctly.<br>
</font></div>
<font color="#000000">This is because we find this method
timestamped from 2015:<br>
<br>
</font><b>SmallInteger>>objectForDataStream:</b><font color="#000000"> </font><font color="#000080">refStrm</font><font color="#000000"><br>
</font><font color="#008080"><i>"In a 64-bit Spur VM, we
may have to fake 32-bit SmallIntegers for compatibility."</i></font><font color="#000000"><br>
<br>
</font><font color="#808080">|</font><font color="#000000"> </font><font color="#6B6B6B">large</font><font color="#000000"> </font><font color="#808080">|</font><font color="#000000"><br>
</font><font color="#800000">self</font><font color="#000000"> </font><font color="#000080">></font><font color="#000000"> </font><font color="#800000">16r3FFFFFFF</font><font color="#000000"> </font><font color="#000080">ifTrue:</font><font color="#000000"> </font><font color="#000000">[</font><font color="#000000"><br>
</font><font color="#6B6B6B">large</font><font color="#000000"> </font><b>:=</b><font color="#000000"> </font><font color="#000000">LargePositiveInteger</font><font color="#000000"> </font><font color="#000080">new:</font><font color="#000000"> </font><font color="#800000">self</font><font color="#000000"> </font><font color="#000080">digitLength</font><font color="#000000"> </font><font color="#000080">neg:</font><font color="#000000"> </font><font color="#800000">false</font><font color="#000000">.</font><font color="#000000"><br>
</font><font color="#800000">1</font><font color="#000000"> </font><font color="#000080">to:</font><font color="#000000"> </font><font color="#800000">self</font><font color="#000000"> </font><font color="#000080">digitLength</font><font color="#000000"> </font><font color="#000080">do:</font><font color="#000000"> </font><font color="#008000">[</font><font color="#000000">:</font><font color="#000080">i</font><font color="#000000"> </font><font color="#808080">|</font><font color="#000000"> </font><font color="#6B6B6B">large</font><font color="#000000"> </font><font color="#000080">digitAt:</font><font color="#000000"> </font><font color="#000080">i</font><font color="#000000"> </font><font color="#000080">put:</font><font color="#000000"> </font><font color="#800080">(</font><font color="#800000">self</font><font color="#000000"> </font><font color="#000080">digitAt:</font><font color="#000000"> </font><font color="#000080">i</font><font color="#800080">)</font><font color="#008000">]</font><font color="#000000">.</font><font color="#000000"><br>
</font><font color="#800000">^</font><font color="#6B6B6B">large</font><font color="#000000">]</font><font color="#000000">.</font><font color="#000000"><br>
</font><font color="#800000">self</font><font color="#000000"> </font><font color="#000080"><</font><font color="#000000"> </font><font color="#800000">-</font><font color="#800000">16r40000000</font><font color="#000000"> </font><font color="#000080">ifTrue:</font><font color="#000000"> </font><font color="#000000">[</font><font color="#000000"><br>
</font><font color="#6B6B6B">large</font><font color="#000000"> </font><b>:=</b><font color="#000000"> </font><font color="#000000">LargeNegativeInteger</font><font color="#000000"> </font><font color="#000080">new:</font><font color="#000000"> </font><font color="#800000">self</font><font color="#000000"> </font><font color="#000080">digitLength</font><font color="#000000"> </font><font color="#000080">neg:</font><font color="#000000"> </font><font color="#800000">true</font><font color="#000000">.</font><font color="#000000"><br>
</font><font color="#800000">1</font><font color="#000000"> </font><font color="#000080">to:</font><font color="#000000"> </font><font color="#800000">self</font><font color="#000000"> </font><font color="#000080">digitLength</font><font color="#000000"> </font><font color="#000080">do:</font><font color="#000000"> </font><font color="#008000">[</font><font color="#000000">:</font><font color="#000080">i</font><font color="#000000"> </font><font color="#808080">|</font><font color="#000000"> </font><font color="#6B6B6B">large</font><font color="#000000"> </font><font color="#000080">digitAt:</font><font color="#000000"> </font><font color="#000080">i</font><font color="#000000"> </font><font color="#000080">put:</font><font color="#000000"> </font><font color="#800080">(</font><font color="#800000">self</font><font color="#000000"> </font><font color="#000080">digitAt:</font><font color="#000000"> </font><font color="#000080">i</font><font color="#800080">)</font><font color="#008000">]</font><font color="#000000">.</font><font color="#000000"><br>
</font><font color="#800000">^</font><font color="#6B6B6B">large</font><font color="#000000">]</font><font color="#000000">.</font><font color="#000000"><br>
</font><font color="#800000">^</font><font color="#000000"> </font><font color="#800000">self</font>
<div><font color="#000000"><br>
</font></div>
<div><font color="#000000">Did I overlook something?</font></div>
<font color="#000000">I hope that Cuis and Squeak DataStream
will remain consistent after your latest changes<br>
<br>
</font></div>
<font color="#000000">Nicolas</font></div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Le lun. 22 sept. 2025 à 15:45,
Juan Vuletich via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a>>
a écrit :<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>Hi,</p>
<div>On 22/09/2025 10:10 AM, H. Hirzel via Cuis-dev wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>I could identify the change set which causes the
problem, it is from last Wednesday<br>
</div>
<div><br>
</div>
<div>CoreUpdates\<a href="http://7580-ReferenceStream-61BitSmallIntegers-fix-JuanVuletich-2025Sep17-08h16m-jmv.001.cs.st" target="_blank">7580-ReferenceStream-61BitSmallIntegers-fix-JuanVuletich-2025Sep17-08h16m-jmv.001.cs.st</a></div>
<div><br>
</div>
<div>It introduces a new version of #readInteger and
writeInteger: in the class DataStream.</div>
<div>If I undo the change of this change set it works.</div>
<div><br>
</div>
<div>--Hannes<br>
</div>
</div>
</blockquote>
<p><br>
</p>
<p>As you saw in that changeset (file name, comments in
code, commit message), and as exemplified in the test
added to BaseImageTests shortly after, what that code does
is not to cause a problem, but to fix a serious bug that
has been around for a long time and that is still present
in Squeak. Just try to serialize an object with a largish
SmallInteger and see what you get back.</p>
<p>Anyway. I just pushed a better implementation that uses a
different format for 32bit SmallIntegers than from larger
ones. This brings back compatibility with the badly broken
Squeak format, although it obviously can't bring back the
bits that Squeak discarded when saving the file, and
results will be wrong unless you're lucky enough to only
use small SmallIntegers.</p>
<p><br>
</p>
<blockquote type="cite">
<div dir="ltr">
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Mon, Sep 22, 2025
at 2:36 PM H. Hirzel <<a href="mailto:hannes.hirzel@gmail.com" target="_blank">hannes.hirzel@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div>I am currently identifying which change set
causes the problem.</div>
<div>So far Cuis update 7523 still works.<br>
</div>
<div><br>
</div>
<div>This means if I produce a file '
aDictWithByteArraysFromSq.obj' in Squeak I can
read it in Cuis 7523</div>
<div><br>
</div>
<div>So the problem has been introduced in one of
the last 60 updates.</div>
<div><br>
</div>
<div><br>
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div>"Squeak"<br>
dict := Dictionary new.<br>
dict at: 1 put: #[1 2 3 4].<br>
dict at: 2 put: #[5 6 7 8].<br>
dict at: 3 put: #[10 20 30 40].<br>
<br>
fileStream := ReferenceStream fileNamed:
'aDictWithByteArraysFromSq.obj'.<br>
objectToSave := dict.<br>
fileStream nextPut: objectToSave.<br>
fileStream close</div>
<div><br>
</div>
</div>
</blockquote>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div>"-----------------------------------------------"<br>
</div>
<div>"Restore in Cuis"<br>
</div>
<div>ReferenceStream restoreFromFile:
('aDictWithByteArraysFromSq.obj'
asFileEntry).<br>
<br>
"Result<br>
OK in Cuis 7523<br>
NOT OK in Cuis 7584"</div>
<div><br>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
<br>
<fieldset></fieldset>
</blockquote>
<pre cols="72">--
Juan Vuletich
<a href="http://www.cuis.st" target="_blank">www.cuis.st</a>
<a href="http://github.com/jvuletich" target="_blank">github.com/jvuletich</a>
<a href="http://researchgate.net/profile/Juan-Vuletich" target="_blank">researchgate.net/profile/Juan-Vuletich</a>
<a href="http://independent.academia.edu/JuanVuletich" target="_blank">independent.academia.edu/JuanVuletich</a>
<a href="http://patents.justia.com/inventor/juan-manuel-vuletich" target="_blank">patents.justia.com/inventor/juan-manuel-vuletich</a></pre>
</div>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote>
</div>
<br>
<fieldset></fieldset>
</blockquote>
<pre cols="72">--
Juan Vuletich
<a href="http://www.cuis.st" target="_blank">www.cuis.st</a>
<a href="http://github.com/jvuletich" target="_blank">github.com/jvuletich</a>
<a href="http://researchgate.net/profile/Juan-Vuletich" target="_blank">researchgate.net/profile/Juan-Vuletich</a>
<a href="http://independent.academia.edu/JuanVuletich" target="_blank">independent.academia.edu/JuanVuletich</a>
<a href="http://patents.justia.com/inventor/juan-manuel-vuletich" target="_blank">patents.justia.com/inventor/juan-manuel-vuletich</a></pre>
</div>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div></div>