[squeak-dev] The Trunk: System-eem.988.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Dec 15 23:10:06 UTC 2017


Eliot Miranda uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-eem.988.mcz

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

Name: System-eem.988
Author: eem
Time: 15 December 2017, 3:09:47.548729 pm
UUID: d167e6c2-1ca3-4f91-b856-189fa213889c
Ancestors: System-eem.987

Spur Image Segment Loading across word sizes.  Reduce LargePositiveIntegers and BoxedFloat64 to SmallInteger and SmallFloat64 immediates when in range and loading 32-bit segments into 64-bit systems.

Fix the word order of BoxedFloat64 which are typically in little-endian order internally but big-endian order externally.

=============== Diff against System-eem.987 ===============

Item was changed:
  SpurImageSegmentLoader subclass: #Spur32BitImageSegmentLoader
+ 	instanceVariableNames: 'rangeMappings'
- 	instanceVariableNames: ''
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'System-Object Storage'!

Item was changed:
  ----- Method: Spur32BitImageSegmentLoader>>allocateObject:classIndex:slots: (in category 'reading') -----
  allocateObject: format classIndex: classIndex slots: numSlots
  	"Allocate an instance of the class referenced by classIndex, with the size computed from numSlots and format."
+ 	| class obj |
- 	| class |
  	class := (self classIndexInOutPointers: classIndex)
  				ifTrue: [outPointers at: (self outPointerIndexForClassIndex: classIndex)]
  				ifFalse: [oopMap at: (self oopIndexForClassIndex: classIndex)].
  	(format <= 1 or: [format = 5"ephemerons"]) ifTrue:
  		[^self allocateFixedSizeObject: class size: numSlots].
  	format = 2 ifTrue:
  		[^self allocateVariableSizeObject: class size: numSlots].
  	(format between: 3 and: 4) ifTrue:
  		[^self allocateFixedAndVariableObject: class size: numSlots].
  	format >= 16 ifTrue:
  		[| nBytes |
  		 nBytes := numSlots * 4 - (format bitAnd: 3).
  		 format >= 24 ifTrue:
  			[^self allocateCompiledCode: class size: nBytes].
+ 		 obj := self allocate8BitObject: class size: nBytes.
+ 		 (nBytes <= 8 and: [obj isInteger and: [rangeMappings notNil]]) ifTrue:
+ 			[rangeMappings addLast: obj].
+ 		 ^obj].
- 		 ^self allocate8BitObject: class size: nBytes].
  	format >= 12 ifTrue:
  		[| nShorts |
  		 nShorts := numSlots * 2 - (format bitAnd: 1).
  		 ^self allocate16BitObject: class size: nShorts].
  	format >= 10 ifTrue:
+ 		[obj := self allocate32BitObject: class size: numSlots.
+ 		 (numSlots = 2 and: [obj isFloat and: [rangeMappings notNil]]) ifTrue:
+ 			[rangeMappings addLast: obj].
+ 		 ^obj].
- 		[^self allocate32BitObject: class size: numSlots].
  	format = 9 ifTrue:
  		[^self allocate64BitObject: class size: numSlots * 2].
  	format = 33 ifTrue:
  		[^self allocateAndPartFillClassObject: class size: numSlots].
  	self error: 'Unknown object format'!

Item was added:
+ ----- Method: Spur32BitImageSegmentLoader>>loadSegmentFrom:outPointers: (in category 'loading') -----
+ loadSegmentFrom: segmentWordArray outPointers: outPointerArray
+ 	"Override to initialize rangeMappings if loading a 32-bit segment into a 64-bit system"
+ 
+ 	| result |
+ 	Smalltalk wordSize = 8 ifTrue:
+ 		[rangeMappings := OrderedCollection new].
+ 	result := super loadSegmentFrom: segmentWordArray outPointers: outPointerArray.
+ 	self maybeMapRanges.
+ 	^result!

Item was added:
+ ----- Method: Spur32BitImageSegmentLoader>>maybeMapRanges (in category 'private') -----
+ maybeMapRanges
+ 	"If loading a 32-bit segment into a 64-bit segment then map LargePositiveIntegers or BoxedFloat64
+ 	 instances that can be expressed as SmallInteger or SmallFloat64 immediates respectively.
+ 	 Implement as a bulk become for speed."
+ 
+ 	| ins outs |
+ 	rangeMappings ifNil: [^self].
+ 	ins := WriteStream on: (Array new: rangeMappings size).
+ 	outs := WriteStream on: (Array new: rangeMappings size).
+ 	rangeMappings do:
+ 		[:numeric| | mapping |
+ 		(numeric isInteger
+ 			ifTrue:
+ 				[mapping := numeric normalize.
+ 				 mapping ~~ numeric]
+ 			ifFalse:
+ 				[mapping := numeric * 1.0.
+ 				 mapping class ~~ numeric class]) ifTrue:
+ 			[ins nextPut: numeric.
+ 			 outs nextPut: mapping]].
+ 	ins position > 0 ifTrue:
+ 		[ins contents elementsForwardIdentityTo: outs contents copyHash: false]!

Item was changed:
  ----- Method: SpurImageSegmentLoader>>fillWords:oop: (in category 'reading') -----
  fillWords: object oop: oop
+ 	| size |
+ 	size := object basicSize.
+ 	(size = 2 and: [object isFloat])
+ 		ifTrue: "boxed floats are in platform order internally (hence in platform order in the segment) but in big-endian order externally"
+ 			[object
+ 				basicAt: 2 put: self readUint32;
+ 				basicAt: 1 put: self readUint32]
+ 		ifFalse:
+ 			[1 to: object basicSize do:
+ 				[:i |
+ 				 object basicAt: i put: self readUint32]].
- 	1 to: object basicSize do:
- 		[:i |
- 		 object basicAt: i put: self readUint32].
  	^object!



More information about the Squeak-dev mailing list