[Pkg] The Trunk: System-nice.776.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Oct 31 22:36:38 UTC 2015

Nicolas Cellier uploaded a new version of System to project The Trunk:

==================== 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:."!

More information about the Packages mailing list