Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.963.mcz
==================== Summary ====================
Name: Kernel-nice.963
Author: nice
Time: 31 October 2015, 11:48:47.351 pm
UUID: 251411b2-0110-4d17-8469-5b3aef45ebee
Ancestors: Kernel-nice.962
Let's correct my fresh DataStream correction...
The ugly 37777777 pattern may happen in octal, but 50 birthdays is well too young for practicing such sport correctly ;)
<rant>
if the MC commit window would not try and reformat the code (especially rewrite hexadecimal constants in decimal) - that would have given me one more chance to correct before committing...
</rant>
=============== Diff against Kernel-nice.962 ===============
Item was changed:
----- Method: SmallInteger>>objectForDataStream: (in category 'objects from disk') -----
objectForDataStream: refStrm
"In a 64bits sput VM, we may have to fake 32bits SmallInteger for compatibility"
| large |
+ self > 16r3FFFFFFF ifTrue: [
- self > 16r37777777 ifTrue: [
large := LargePositiveInteger new: self digitLength neg: false.
1 to: self digitLength do: [:i | large digitAt: i put: (self digitAt: i)].
^large].
self < -16r40000000 ifTrue: [
large := LargeNegativeInteger new: self digitLength neg: true.
1 to: self digitLength do: [:i | large digitAt: i put: (self digitAt: i)].
^large].
^ self
!
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.963.mcz
==================== Summary ====================
Name: Kernel-nice.963
Author: nice
Time: 31 October 2015, 11:48:47.351 pm
UUID: 251411b2-0110-4d17-8469-5b3aef45ebee
Ancestors: Kernel-nice.962
Let's correct my fresh DataStream correction...
The ugly 37777777 pattern may happen in octal, but 50 birthdays is well too young for practicing such sport correctly ;)
<rant>
if the MC commit window would not try and reformat the code (especially rewrite hexadecimal constants in decimal) - that would have given me one more chance to correct before committing...
</rant>
=============== Diff against Kernel-nice.962 ===============
Item was changed:
----- Method: SmallInteger>>objectForDataStream: (in category 'objects from disk') -----
objectForDataStream: refStrm
"In a 64bits sput VM, we may have to fake 32bits SmallInteger for compatibility"
| large |
+ self > 16r3FFFFFFF ifTrue: [
- self > 16r37777777 ifTrue: [
large := LargePositiveInteger new: self digitLength neg: false.
1 to: self digitLength do: [:i | large digitAt: i put: (self digitAt: i)].
^large].
self < -16r40000000 ifTrue: [
large := LargeNegativeInteger new: self digitLength neg: true.
1 to: self digitLength do: [:i | large digitAt: i put: (self digitAt: i)].
^large].
^ self
!
Nicolas Cellier uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-nice.776.mcz
==================== Summary ====================
Name: System-nice.776
Author: nice
Time: 31 October 2015, 11:35:30.653 pm
UUID: d178a6bb-8b9a-47ed-9eff-8544ba286894
Ancestors: System-topa.775
Fix SmartRefStream for 64bits spur VM.
The scenario is this one: a SmallInteger smaller than 32 bits VM minSmallInteger is being replaced with a fake LargeNegativeInteger.
But the fake LargeNegativeInteger is not stored in references IdentityDictionary; consequently the class is NOT properly registered into the structures, and this creates an Error at materialization time...
So let's reference the fake...
=============== Diff against System-topa.775 ===============
Item was changed:
----- Method: DataStream>>nextPut: (in category 'write and read') -----
nextPut: anObject
"Write anObject to the receiver stream. Answer anObject."
| typeID selector objectToStore |
typeID := self typeIDFor: anObject.
(self tryToPutReference: anObject typeID: typeID)
ifTrue: [^ anObject].
objectToStore := (self objectIfBlocked: anObject) objectForDataStream: self.
+ objectToStore == anObject
+ ifFalse:
+ [typeID := self typeIDFor: objectToStore.
+ (self tryToPutReference: objectToStore typeID: typeID)
+ ifTrue: [^ anObject]].
- objectToStore == anObject ifFalse: [typeID := self typeIDFor: objectToStore].
byteStream nextPut: typeID.
selector := #(writeNil: writeTrue: writeFalse: writeInteger:
writeStringOld: writeSymbol: writeByteArray:
writeArray: writeInstance: errorWriteReference: writeBitmap:
writeClass: writeUser: writeFloat: writeRectangle: == "<-16 short inst"
writeString: writeBitmap: writeBitmap: writeWordLike:
writeInstance: "CompiledMethod") at: typeID.
self perform: selector with: objectToStore.
^ anObject
"NOTE: If anObject is a reference type (one that we write cross-references to) but its externalized form (result of objectForDataStream:) isn't (e.g. CompiledMethod and ViewState), then we should remember its externalized form
but not add to 'references'. Putting that object again should just put its
external form again. That's more compact and avoids seeks when reading.
But we just do the simple thing here, allowing backward-references for
non-reference types like nil. So objectAt: has to compensate. Objects that
externalize nicely won't contain the likes of ViewStates, so this shouldn't
hurt much.
writeReference: -> errorWriteReference:."!
Nicolas Cellier uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-nice.776.mcz
==================== Summary ====================
Name: System-nice.776
Author: nice
Time: 31 October 2015, 11:35:30.653 pm
UUID: d178a6bb-8b9a-47ed-9eff-8544ba286894
Ancestors: System-topa.775
Fix SmartRefStream for 64bits spur VM.
The scenario is this one: a SmallInteger smaller than 32 bits VM minSmallInteger is being replaced with a fake LargeNegativeInteger.
But the fake LargeNegativeInteger is not stored in references IdentityDictionary; consequently the class is NOT properly registered into the structures, and this creates an Error at materialization time...
So let's reference the fake...
=============== Diff against System-topa.775 ===============
Item was changed:
----- Method: DataStream>>nextPut: (in category 'write and read') -----
nextPut: anObject
"Write anObject to the receiver stream. Answer anObject."
| typeID selector objectToStore |
typeID := self typeIDFor: anObject.
(self tryToPutReference: anObject typeID: typeID)
ifTrue: [^ anObject].
objectToStore := (self objectIfBlocked: anObject) objectForDataStream: self.
+ objectToStore == anObject
+ ifFalse:
+ [typeID := self typeIDFor: objectToStore.
+ (self tryToPutReference: objectToStore typeID: typeID)
+ ifTrue: [^ anObject]].
- objectToStore == anObject ifFalse: [typeID := self typeIDFor: objectToStore].
byteStream nextPut: typeID.
selector := #(writeNil: writeTrue: writeFalse: writeInteger:
writeStringOld: writeSymbol: writeByteArray:
writeArray: writeInstance: errorWriteReference: writeBitmap:
writeClass: writeUser: writeFloat: writeRectangle: == "<-16 short inst"
writeString: writeBitmap: writeBitmap: writeWordLike:
writeInstance: "CompiledMethod") at: typeID.
self perform: selector with: objectToStore.
^ anObject
"NOTE: If anObject is a reference type (one that we write cross-references to) but its externalized form (result of objectForDataStream:) isn't (e.g. CompiledMethod and ViewState), then we should remember its externalized form
but not add to 'references'. Putting that object again should just put its
external form again. That's more compact and avoids seeks when reading.
But we just do the simple thing here, allowing backward-references for
non-reference types like nil. So objectAt: has to compensate. Objects that
externalize nicely won't contain the likes of ViewStates, so this shouldn't
hurt much.
writeReference: -> errorWriteReference:."!
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.962.mcz
==================== Summary ====================
Name: Kernel-nice.962
Author: nice
Time: 31 October 2015, 7:24:30.118 pm
UUID: 7437325d-9085-4d61-9960-368cd42f46fe
Ancestors: Kernel-ul.961
Fix DataStream-serialization of SmallInteger in a 64bits spur VM.
DataStream assumes each and every SmallInteger fits in 32bits which is no more true.
If the SmallInteger is out of 32bits VM SmallInteger range, then use a fake LargeInteger.
Also care to re-normalize LageIntegers at materialization time.
=============== Diff against Kernel-ul.961 ===============
Item was added:
+ ----- Method: LargePositiveInteger>>readDataFrom:size: (in category 'objects from disk') -----
+ readDataFrom: aDataStream size: varsOnDisk
+ ^(super readDataFrom: aDataStream size: varsOnDisk) normalize
+ !
Item was added:
+ ----- Method: SmallInteger>>objectForDataStream: (in category 'objects from disk') -----
+ objectForDataStream: refStrm
+ "In a 64bits sput VM, we may have to fake 32bits SmallInteger for compatibility"
+
+ | large |
+ self > 16r37777777 ifTrue: [
+ large := LargePositiveInteger new: self digitLength neg: false.
+ 1 to: self digitLength do: [:i | large digitAt: i put: (self digitAt: i)].
+ ^large].
+ self < -16r40000000 ifTrue: [
+ large := LargeNegativeInteger new: self digitLength neg: true.
+ 1 to: self digitLength do: [:i | large digitAt: i put: (self digitAt: i)].
+ ^large].
+ ^ self
+ !
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.962.mcz
==================== Summary ====================
Name: Kernel-nice.962
Author: nice
Time: 31 October 2015, 7:24:30.118 pm
UUID: 7437325d-9085-4d61-9960-368cd42f46fe
Ancestors: Kernel-ul.961
Fix DataStream-serialization of SmallInteger in a 64bits spur VM.
DataStream assumes each and every SmallInteger fits in 32bits which is no more true.
If the SmallInteger is out of 32bits VM SmallInteger range, then use a fake LargeInteger.
Also care to re-normalize LageIntegers at materialization time.
=============== Diff against Kernel-ul.961 ===============
Item was added:
+ ----- Method: LargePositiveInteger>>readDataFrom:size: (in category 'objects from disk') -----
+ readDataFrom: aDataStream size: varsOnDisk
+ ^(super readDataFrom: aDataStream size: varsOnDisk) normalize
+ !
Item was added:
+ ----- Method: SmallInteger>>objectForDataStream: (in category 'objects from disk') -----
+ objectForDataStream: refStrm
+ "In a 64bits sput VM, we may have to fake 32bits SmallInteger for compatibility"
+
+ | large |
+ self > 16r37777777 ifTrue: [
+ large := LargePositiveInteger new: self digitLength neg: false.
+ 1 to: self digitLength do: [:i | large digitAt: i put: (self digitAt: i)].
+ ^large].
+ self < -16r40000000 ifTrue: [
+ large := LargeNegativeInteger new: self digitLength neg: true.
+ 1 to: self digitLength do: [:i | large digitAt: i put: (self digitAt: i)].
+ ^large].
+ ^ self
+ !
Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-nice.255.mcz
==================== Summary ====================
Name: CollectionsTests-nice.255
Author: nice
Time: 31 October 2015, 6:39:25.525 pm
UUID: 4f5361b3-18c8-47f1-ba59-030004683963
Ancestors: CollectionsTests-ul.254
In a 64bits spur VM, not all SmallInteger can be stored in an IntegerArray, It's time to document it.
=============== Diff against CollectionsTests-ul.254 ===============
Item was changed:
----- Method: IntegerArrayTest>>testStoreSmallInteger (in category 'tests') -----
testStoreSmallInteger
+ "Any SmallInteger may be stored in an IntegerArray in a 32bits VM.
+ Not so true for a 64bits spur VM though..."
- "Any SmallInteger may be stored in an IntegerArray."
| ia val |
ia := IntegerArray new: 1.
+ val := Smalltalk wordSize = 8
+ ifTrue: [1 << 31 - 1]
+ ifFalse: [SmallInteger maxVal].
- val := SmallInteger maxVal.
ia at: 1 put: val.
self assert: ((ia at: 1) = val).
+ val := Smalltalk wordSize = 8
+ ifTrue: [(1 << 31) negated]
+ ifFalse: [SmallInteger minVal].
- val := SmallInteger minVal.
ia at: 1 put: val.
self assert: ((ia at: 1) = val)
!
Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-nice.255.mcz
==================== Summary ====================
Name: CollectionsTests-nice.255
Author: nice
Time: 31 October 2015, 6:39:25.525 pm
UUID: 4f5361b3-18c8-47f1-ba59-030004683963
Ancestors: CollectionsTests-ul.254
In a 64bits spur VM, not all SmallInteger can be stored in an IntegerArray, It's time to document it.
=============== Diff against CollectionsTests-ul.254 ===============
Item was changed:
----- Method: IntegerArrayTest>>testStoreSmallInteger (in category 'tests') -----
testStoreSmallInteger
+ "Any SmallInteger may be stored in an IntegerArray in a 32bits VM.
+ Not so true for a 64bits spur VM though..."
- "Any SmallInteger may be stored in an IntegerArray."
| ia val |
ia := IntegerArray new: 1.
+ val := Smalltalk wordSize = 8
+ ifTrue: [1 << 31 - 1]
+ ifFalse: [SmallInteger maxVal].
- val := SmallInteger maxVal.
ia at: 1 put: val.
self assert: ((ia at: 1) = val).
+ val := Smalltalk wordSize = 8
+ ifTrue: [(1 << 31) negated]
+ ifFalse: [SmallInteger minVal].
- val := SmallInteger minVal.
ia at: 1 put: val.
self assert: ((ia at: 1) = val)
!