Discussion:
The Trunk: System-eem.835.mcz
(too old to reply)
c***@source.squeak.org
0000-07-12 07:04:15 UTC
Permalink
Eliot Miranda uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-eem.835.mcz

==================== Summary ====================

Name: System-eem.835
Author: eem
Time: 5 July 2016, 6:13:25.980763 pm
UUID: 44354df1-cecb-414c-a705-daa84b7388dd
Ancestors: System-eem.834

Fix reading methods from DataStreams on Spur. Old code used pre-Spur numLits header format, and was not 64-bit aware.

=============== Diff against System-eem.834 ===============

Item was changed:
----- Method: DataStream>>readMethod (in category 'write and read') -----
readMethod
"PRIVATE -- Read the contents of an arbitrary instance.
ASSUMES: readDataFrom:size: sends me beginReference: after it
instantiates the new object but before reading nested objects.
NOTE: We must restore the current reference position after
recursive calls to next.
Let the instance, not the class read the data. "
| instSize refPosn newClass className xxHeader nLits byteCodeSizePlusTrailer newMethod lits |

instSize := (byteStream nextNumber: 4) - 1.
refPosn := self getCurrentReference.
className := self next.
newClass := Smalltalk at: className asSymbol.

xxHeader := self next.
"nArgs := (xxHeader >> 24) bitAnd: 16rF."
"nTemps := (xxHeader >> 18) bitAnd: 16r3F."
"largeBit := (xxHeader >> 17) bitAnd: 1."
+ nLits := xxHeader bitAnd: 16r7FFF.
+ byteCodeSizePlusTrailer := instSize - (newClass instSize "0") - (nLits + 1 * Smalltalk wordSize).
- nLits := (xxHeader >> 9) bitAnd: 16rFF.
- "primBits := ((xxHeader >> 19) bitAnd: 16r600) + (xxHeader bitAnd: 16r1FF)."
- byteCodeSizePlusTrailer := instSize - (newClass instSize "0") - (nLits + 1 * 4).

newMethod := newClass
+ newMethod: byteCodeSizePlusTrailer
+ header: xxHeader.
- newMethod: byteCodeSizePlusTrailer
- header: xxHeader.

self setCurrentReference: refPosn. "before readDataFrom:size:"
self beginReference: newMethod.
lits := newMethod numLiterals + 1. "counting header"
2 to: lits do:
[:ii | newMethod objectAt: ii put: self next].
+ lits*Smalltalk wordSize+1 to: newMethod basicSize do:
- lits*4+1 to: newMethod basicSize do:
[:ii | newMethod basicAt: ii put: byteStream next].
"Get raw bytes directly from the file"
self setCurrentReference: refPosn. "before returning to next"
+ ^newMethod!
- ^ newMethod!
Tobias Pape
2016-07-06 05:21:34 UTC
Permalink
Post by c***@source.squeak.org
http://source.squeak.org/trunk/System-eem.835.mcz
==================== Summary ====================
Name: System-eem.835
Author: eem
Time: 5 July 2016, 6:13:25.980763 pm
UUID: 44354df1-cecb-414c-a705-daa84b7388dd
Ancestors: System-eem.834
Fix reading methods from DataStreams on Spur. Old code used pre-Spur numLits header format, and was not 64-bit aware.
Does that mean that pre-Spur methods on datastreams cannot be read in Spur images?
That would be a bummer…

Best regards
-Tobias
Post by c***@source.squeak.org
=============== Diff against System-eem.834 ===============
Eliot Miranda
2016-07-06 06:17:07 UTC
Permalink
Post by c***@source.squeak.org
Post by c***@source.squeak.org
http://source.squeak.org/trunk/System-eem.835.mcz
==================== Summary ====================
Name: System-eem.835
Author: eem
Time: 5 July 2016, 6:13:25.980763 pm
UUID: 44354df1-cecb-414c-a705-daa84b7388dd
Ancestors: System-eem.834
Fix reading methods from DataStreams on Spur. Old code used pre-Spur
numLits header format, and was not 64-bit aware.
Does that mean that pre-Spur methods on datastreams cannot be read in Spur images?
That would be a bummer

It needs some kind of version stamp on the stream. Point me to some such
and we can switch hit.
Post by c***@source.squeak.org
Best regards
-Tobias
Post by c***@source.squeak.org
=============== Diff against System-eem.834 ===============
--
_,,,^..^,,,_
best, Eliot
Tobias Pape
2016-07-06 07:23:45 UTC
Permalink
Post by Tobias Pape
Post by c***@source.squeak.org
http://source.squeak.org/trunk/System-eem.835.mcz
==================== Summary ====================
Name: System-eem.835
Author: eem
Time: 5 July 2016, 6:13:25.980763 pm
UUID: 44354df1-cecb-414c-a705-daa84b7388dd
Ancestors: System-eem.834
Fix reading methods from DataStreams on Spur. Old code used pre-Spur numLits header format, and was not 64-bit aware.
Does that mean that pre-Spur methods on datastreams cannot be read in Spur images?
That would be a bummer…
It needs some kind of version stamp on the stream. Point me to some such and we can switch hit.
There is none.
I would say, we store the data in the format DataStream already know (which happens to be
the Pre-Spur version) and adapt on read. That would ensure backward- and forward-compatibility:

- We could still read CMs serialized in pre-spur.
- We could also read Spur-CMs in pre-spur images.

Ok. -- break --
I just realized that what you changed was the read part. so no
problem here. We could change the part to do things differently
when running on spur or non-spur.

Best regards
-Tobias
Post by Tobias Pape
Best regards
-Tobias
Post by c***@source.squeak.org
=============== Diff against System-eem.834 ===============
Eliot Miranda
2016-07-08 22:35:35 UTC
Permalink
Hi Tobias,
Post by c***@source.squeak.org
Post by Tobias Pape
Post by c***@source.squeak.org
http://source.squeak.org/trunk/System-eem.835.mcz
==================== Summary ====================
Name: System-eem.835
Author: eem
Time: 5 July 2016, 6:13:25.980763 pm
UUID: 44354df1-cecb-414c-a705-daa84b7388dd
Ancestors: System-eem.834
Fix reading methods from DataStreams on Spur. Old code used pre-Spur
numLits header format, and was not 64-bit aware.
Post by Tobias Pape
Does that mean that pre-Spur methods on datastreams cannot be read in
Spur images?
Post by Tobias Pape
That would be a bummer

It needs some kind of version stamp on the stream. Point me to some
such and we can switch hit.
There is none.
I would say, we store the data in the format DataStream already know (which happens to be
the Pre-Spur version) and adapt on read. That would ensure backward- and
- We could still read CMs serialized in pre-spur.
- We could also read Spur-CMs in pre-spur images.
Ok. -- break --
I just realized that what you changed was the read part. so no
problem here. We could change the part to do things differently
when running on spur or non-spur.
The thing is that the two header formats are incompatible. The old one
allows up to 2^9-1 literals, the new one up to 2^15-1. So staying with the
old format limits us. We need some kind of version stamp. Right now
DataStream and ImageSegment are extremely version-dependent and hence
restrictive formats. It would be good for someone to revisit them and try
and add some kind of versioning information, preferably supporting backward
compatibility.
Post by c***@source.squeak.org
Best regards
-Tobias
Post by Tobias Pape
Best regards
-Tobias
Post by c***@source.squeak.org
=============== Diff against System-eem.834 ===============
--
_,,,^..^,,,_
best, Eliot
David T. Lewis
2016-07-08 23:11:48 UTC
Permalink
Post by Eliot Miranda
Hi Tobias,
Post by c***@source.squeak.org
Post by Tobias Pape
Post by c***@source.squeak.org
http://source.squeak.org/trunk/System-eem.835.mcz
==================== Summary ====================
Name: System-eem.835
Author: eem
Time: 5 July 2016, 6:13:25.980763 pm
UUID: 44354df1-cecb-414c-a705-daa84b7388dd
Ancestors: System-eem.834
Fix reading methods from DataStreams on Spur. Old code used pre-Spur
numLits header format, and was not 64-bit aware.
Post by Tobias Pape
Does that mean that pre-Spur methods on datastreams cannot be read in
Spur images?
Post by Tobias Pape
That would be a bummer???
It needs some kind of version stamp on the stream. Point me to some
such and we can switch hit.
There is none.
I would say, we store the data in the format DataStream already know
(which happens to be
the Pre-Spur version) and adapt on read. That would ensure backward- and
- We could still read CMs serialized in pre-spur.
- We could also read Spur-CMs in pre-spur images.
Ok. -- break --
I just realized that what you changed was the read part. so no
problem here. We could change the part to do things differently
when running on spur or non-spur.
The thing is that the two header formats are incompatible. The old one
allows up to 2^9-1 literals, the new one up to 2^15-1. So staying with the
old format limits us. We need some kind of version stamp. Right now
DataStream and ImageSegment are extremely version-dependent and hence
restrictive formats. It would be good for someone to revisit them and try
and add some kind of versioning information, preferably supporting backward
compatibility.
While a bit ad-hoc, but we do have an image format number that is used
for a similar purpose in the saved image files. Would that provide enough
information to serve as a version stamp?

The current known formats are maintained in package ImageFormat in the
http://source.squeak.org/VMMaker repository. It is small and independent
of VMMaker, so we could consider moving it into the image if it is of
more general utility.

Dave
Eliot Miranda
2016-08-05 16:44:18 UTC
Permalink
Hi David,
Post by c***@source.squeak.org
Post by Eliot Miranda
Hi Tobias,
Post by c***@source.squeak.org
Post by Tobias Pape
Post by c***@source.squeak.org
Eliot Miranda uploaded a new version of System to project The
http://source.squeak.org/trunk/System-eem.835.mcz
==================== Summary ====================
Name: System-eem.835
Author: eem
Time: 5 July 2016, 6:13:25.980763 pm
UUID: 44354df1-cecb-414c-a705-daa84b7388dd
Ancestors: System-eem.834
Fix reading methods from DataStreams on Spur. Old code used
pre-Spur
Post by Eliot Miranda
Post by c***@source.squeak.org
numLits header format, and was not 64-bit aware.
Post by Tobias Pape
Does that mean that pre-Spur methods on datastreams cannot be read in
Spur images?
Post by Tobias Pape
That would be a bummer???
It needs some kind of version stamp on the stream. Point me to some
such and we can switch hit.
There is none.
I would say, we store the data in the format DataStream already know
(which happens to be
the Pre-Spur version) and adapt on read. That would ensure backward-
and
Post by Eliot Miranda
Post by c***@source.squeak.org
- We could still read CMs serialized in pre-spur.
- We could also read Spur-CMs in pre-spur images.
Ok. -- break --
I just realized that what you changed was the read part. so no
problem here. We could change the part to do things differently
when running on spur or non-spur.
The thing is that the two header formats are incompatible. The old one
allows up to 2^9-1 literals, the new one up to 2^15-1. So staying with
the
Post by Eliot Miranda
old format limits us. We need some kind of version stamp. Right now
DataStream and ImageSegment are extremely version-dependent and hence
restrictive formats. It would be good for someone to revisit them and
try
Post by Eliot Miranda
and add some kind of versioning information, preferably supporting
backward
Post by Eliot Miranda
compatibility.
While a bit ad-hoc, but we do have an image format number that is used
for a similar purpose in the saved image files. Would that provide enough
information to serve as a version stamp?
Works for me.

The current known formats are maintained in package ImageFormat in the
Post by c***@source.squeak.org
http://source.squeak.org/VMMaker repository. It is small and independent
of VMMaker, so we could consider moving it into the image if it is of
more general utility.
+1

Dave
_,,,^..^,,,_
best, Eliot

Loading...