[squeak-dev] The Trunk: System-ul.293.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Mar 15 05:44:47 UTC 2010

Levente Uzonyi uploaded a new version of System to project The Trunk:

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

Name: System-ul.293
Author: ul
Time: 15 March 2010, 6:23:39.936 am
UUID: dae11342-d54d-ef48-af5b-2e8dc4792065
Ancestors: System-ar.292

- added compatibility method #keysAndValuesDo: to SmalltalkImage. (used by Lint)
- DataStream's TypeMap changed to a  WeakIdentityKeyDictionary, because it has all variable word classes as keys, which may be unloaded from the system (for example MCMockClassG is unloaded during the tests). If that happens, the class' hash will change making the Dictionary invalid.
- don't add obsolete classes to TypeMap during DataStream >> #initialize

=============== Diff against System-ar.292 ===============

Item was added:
+ ----- Method: SmalltalkImage>>keysAndValuesDo: (in category 'dictionary access') -----
+ keysAndValuesDo: aBlock
+ 	"Obsoleted."
+ 	self deprecated: 'Use Smalltalk globals'.
+ 	^globals keysAndValuesDo: aBlock!

Item was changed:
  ----- Method: DataStream class>>initialize (in category 'as yet unclassified') -----
  	"TypeMap maps Smalltalk classes to type ID numbers which identify the data stream primitive formats.  nextPut: writes these IDs to the data stream.  NOTE: Changing these type ID numbers will invalidate all extant data stream files.  Adding new ones is OK.  
  	Classes named here have special formats in the file.  If such a class has a subclass, it will use type 9 and write correctly.  It will just be slow.  (Later write the class name in the special format, then subclasses can use the type also.)
  	 See nextPut:, next, typeIDFor:, & ReferenceStream>>isAReferenceType:"
  	"DataStream initialize"
  	| refTypes t |
  	refTypes := OrderedCollection new.
+ 	t := TypeMap := WeakIdentityKeyDictionary new. "It has to be weak, because some classes may go away, leaving obsolete versions in this dictionary which may make it corrupt."
- 	t := TypeMap := Dictionary new: 80. "sparse for fast hashing"
  	t at: UndefinedObject put: 1.   refTypes add: 0.
  	t at: True put: 2.   refTypes add: 0.
  	t at: False put: 3.   refTypes add: 0.
  	t at: SmallInteger put: 4.	 refTypes add: 0.
  	t at: ByteString put: 5.   refTypes add: 1.
  	t at: ByteSymbol put: 6.   refTypes add: 1.
  	t at: ByteArray put: 7.   refTypes add: 1.
  	t at: Array put: 8.   refTypes add: 1.
  	"(type ID 9 is for arbitrary instances of any class, cf. typeIDFor:)"
  		refTypes add: 1.
  	"(type ID 10 is for references, cf. ReferenceStream>>tryToPutReference:)"
  		refTypes add: 0.
  	t at: Bitmap put: 11.   refTypes add: 1.
  	t at: Metaclass put: 12.   refTypes add: 0.
  	"Type ID 13 is used for HyperSqueak User classes that must be reconstructed."
  		refTypes add: 1.
  	t at: Float put: 14.  refTypes add: 1.
  	t at: Rectangle put: 15.  refTypes add: 1.	"Allow compact Rects."
  	"type ID 16 is an instance with short header.  See beginInstance:size:"
  		refTypes add: 1.
  self flag: #ByteArray.
  	t at: ByteString put: 17.   refTypes add: 1.	"new String format, 1 or 4 bytes of length"
  	t at: WordArray put: 18.  refTypes add: 1.	"bitmap-like"
  	t at: WordArrayForSegment put: 19.  refTypes add: 1.		"bitmap-like"
  	t at: SoundBuffer put: 20.  refTypes add: 1.	"And all other word arrays, both 
  		16-bit and 32-bit.  See methods in ArrayedCollection.  Overridden in SoundBuffer."
  	t at: CompiledMethod put: 21.  refTypes add: 1.	"special creation method"
  	"t at:  put: 22.  refTypes add: 0."
  	ReferenceStream refTypes: refTypes.		"save it"
  	"For all classes that are like WordArrays, store them the way ColorArray is stored.  As bits, and able to change endianness."
  	Smalltalk do: [:cls |
+ 		(cls isInMemory and: [
+ 			cls isBehavior and: [
+ 			cls isObsolete not and: [
+ 			cls isPointers not and: [
+ 			cls isVariable and: [
+ 			cls isWords and: [
+ 			(t includesKey: cls) not ] ] ] ] ] ]) 
+ 				ifTrue: [ t at: cls put: 20 ] ]!
- 		cls isInMemory ifTrue: [
- 			cls isBehavior ifTrue: [
- 				cls isPointers not & cls isVariable & cls isWords ifTrue: [
- 					(t includesKey: cls) ifFalse: [t at: cls put: 20]]]]].!

More information about the Squeak-dev mailing list