[Vm-dev] VM Maker: VMMaker.oscog-eem.1042.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Feb 5 00:12:15 UTC 2015


Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1042.mcz

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

Name: VMMaker.oscog-eem.1042
Author: eem
Time: 4 February 2015, 4:10:47.84 pm
UUID: cd14932f-16ef-41a5-8212-83e584ac417d
Ancestors: VMMaker.oscog-eem.1041

fetchClassTagOf: also needs to be inlineable in ifs.
Use << instead of bitShift: in Spur seg load.

=============== Diff against VMMaker.oscog-eem.1041 ===============

Item was changed:
  ----- Method: Spur32BitMemoryManager>>fetchClassTagOf: (in category 'interpreter access') -----
  fetchClassTagOf: oop
  	| tagBits |
+ 	^(tagBits := oop bitAnd: self tagMask) ~= 0
+ 		ifTrue: [(tagBits bitAnd: 1) ~= 0 ifTrue: [1] ifFalse: [tagBits]]
+ 		ifFalse: [self classIndexOf: oop]!
- 	(tagBits := oop bitAnd: self tagMask) ~= 0 ifTrue:
- 		[^(tagBits bitAnd: 1) ~= 0 ifTrue: [1] ifFalse: [tagBits]].
- 	^self classIndexOf: oop!

Item was changed:
  ----- Method: SpurMemoryManager>>assignClassIndicesAndPinFrom:to:outPointers: (in category 'image segment in/out') -----
  assignClassIndicesAndPinFrom: segmentStart to: segmentLimit outPointers: outPointerArray
  	"This is part of loadImageSegmentFrom:outPointers:.
  	 Make a final pass, assigning the real class indices and/or pinning pinned objects."
  	| objOop topHashBit |
+ 	topHashBit := 1 << self identityHashFieldWidth - 1.
- 	topHashBit := 1 bitShift: self identityHashFieldWidth - 1.
  	objOop := self objectStartingAt: segmentStart.
  	[objOop < segmentLimit] whileTrue:
  		[| classRef classOop classIndex |
  		 "In the segment, class indices are offset indexes into the segment data,
  		  or into outPointers.  See mapOopsFrom:to:outPointers:outHashes:."
  		 classRef := (self classIndexOf: objOop) - self firstClassIndexPun.
  		 classOop := (classRef anyMask: topHashBit)
  						ifTrue: [self fetchPointer: classRef - topHashBit ofObject: outPointerArray]
  						ifFalse: [classRef * self allocationUnit + segmentStart].
  		 classIndex := self rawHashBitsOf: classOop.
  		 self assert: (classIndex > self lastClassIndexPun
  					  and: [(self classOrNilAtIndex: classIndex) = classOop]).
  		 self setClassIndexOf: objOop to: classIndex.
  		 ((self isInNewSpace: objOop)
  		  and: [self isPinned: objOop]) ifTrue:
  			[| oldClone |
  			 oldClone := self cloneInOldSpaceForPinning: objOop.
  			 oldClone ~= 0 ifTrue:
  				[self setIsPinnedOf: oldClone to: true.
  				 self forward: objOop to: oldClone]].
  		 objOop := self objectAfter: objOop limit: segmentLimit].
  !

Item was changed:
  ----- Method: SpurMemoryManager>>mapOopsAndValidateClassRefsFrom:to:outPointers: (in category 'image segment in/out') -----
  mapOopsAndValidateClassRefsFrom: segmentStart to: segmentLimit outPointers: outPointerArray
  	"This is part of loadImageSegmentFrom:outPointers:.
  	 Scan through mapping oops and validating class references.  Defer
  	 entering any class objects into the class table and/or pinning objects
  	 until the second pass in assignClassIndicesAndPinFrom:to:outPointers:."
  	| numOutPointers objOop topHashBit topOopBit |
  	numOutPointers := self numSlotsOf: outPointerArray.
+ 	topHashBit := 1 << self identityHashFieldWidth - 1.
+ 	topOopBit := 1 << self bytesPerOop * 8 - 1.
- 	topHashBit := 1 bitShift: self identityHashFieldWidth - 1.
- 	topOopBit := 1 bitShift: self bytesPerOop * 8 - 1.
  	objOop := self objectStartingAt: segmentStart.
  	[objOop < segmentLimit] whileTrue:
  		[| classIndex hash oop mappedOop |
  		 (self isMarked: objOop) ifTrue:
  			[^PrimErrInappropriate].
  		 classIndex := (self classIndexOf: objOop) - self firstClassIndexPun.
  		 "validate the class ref, but don't update it until any internal classes have been added to the class table."
  		 (classIndex anyMask: topHashBit)
  			ifTrue:
  				[classIndex - topHashBit >= numOutPointers ifTrue:
  					[^PrimErrBadIndex].
  				 mappedOop := self fetchPointer: classIndex - topHashBit ofObject: outPointerArray.
  				 hash := self rawHashBitsOf: mappedOop.
  				 (hash > self lastClassIndexPun and: [(self classOrNilAtIndex: hash) = mappedOop]) ifFalse:
  					[^PrimErrInappropriate]]
  			ifFalse: "The class is contained within the segment."
  				[(oop := classIndex * self allocationUnit + segmentStart) >= segmentLimit ifTrue:
  					[^PrimErrBadIndex].
  				 (self rawHashBitsOf: oop) ~= 0 ifTrue:
  					[^PrimErrInappropriate]].
  		 0 to: (self numPointerSlotsOf: objOop) - 1 do:
  			[:i|
  			 oop := self fetchPointer: i ofObject: objOop.
  			 (self isNonImmediate: oop) ifTrue:
  				[(oop anyMask: topOopBit)
  					ifTrue:
  						[(oop := oop - topOopBit / self bytesPerOop) >= numOutPointers ifTrue:
  							[^PrimErrBadIndex].
  						 mappedOop := self fetchPointer: oop ofObject: outPointerArray]
  					ifFalse:
  						[(oop bitAnd: self allocationUnit - 1) ~= 0 ifTrue:
  							[^PrimErrInappropriate].
  						 (mappedOop := oop + segmentStart) >= segmentLimit ifTrue:
  							[^PrimErrBadIndex]].
  				 self storePointerUnchecked: i ofObject: objOop withValue: mappedOop]].
  		 objOop := self objectAfter: objOop limit: segmentLimit].
  	^0!

Item was changed:
  ----- Method: SpurMemoryManager>>mapOopsFrom:to:outPointers:outHashes: (in category 'image segment in/out') -----
  mapOopsFrom: segStart to: segAddr outPointers: outPointerArray outHashes: savedOutHashes
  	"This is part of storeImageSegmentInto:outPointers:roots:.
  	 Now scan, adding out pointers to the outPointersArray; all objects in arrayOfObjects
  	 have had their hashes set to point to their copies in segmentWordArray.  Answer the
  	 outIndex if the scan succeded.  Fail if outPointers is too small and answer -1."
  	| objOop outIndex topHashBit topOopBit |
  	outIndex := 0.
  	self fillObj: outPointerArray numSlots: (self numSlotsOf: outPointerArray) with: nilObj.
+ 	topHashBit := 1 << self identityHashFieldWidth - 1.
+ 	topOopBit := 1 << self bytesPerOop * 8 - 1.
- 	topHashBit := 1 bitShift: self identityHashFieldWidth - 1.
- 	topOopBit := 1 bitShift: self bytesPerOop * 8 - 1.
  	objOop := self objectStartingAt: segStart.
  	[objOop < segAddr] whileTrue:
  		[| oop segIndex |
  		 oop := self fetchClassOfNonImm: objOop.
  		 (self isMarked: oop) ifFalse: "oop is a new outPointer; allocate its oop"
  			[outIndex := self newOutPointer: oop at: outIndex in: outPointerArray hashes: savedOutHashes topHashBit: topHashBit.
  			 outIndex = 0 ifTrue:"no room in outPointers; fail"
  				[^-1]].
  		 "Set the clone's class index to an offset index into segmentWordArray.
  		  Use an offset so that code cannot confuse a clone with e.g. a forwarder."
  		 segIndex := self rawHashBitsOf: oop.
  		 self setClassIndexOf: objOop to: segIndex + self firstClassIndexPun.
  		 0 to: (self numPointerSlotsOf: objOop) - 1 do:
  			[:i|
  			 oop := self fetchPointer: i ofObject: objOop.
  			 (self isNonImmediate: oop) ifTrue:
  				[(self isMarked: oop) ifFalse: "oop is a new outPointer; allocate its oop"
  					[outIndex := self newOutPointer: oop at: outIndex in: outPointerArray hashes: savedOutHashes topHashBit: topHashBit.
  					 outIndex = 0 ifTrue: "no room in outPointers; fail"
  						[^-1]].
  				 oop := self mappedOopOf: oop topHashBit: topHashBit topOopBit: topOopBit..
  				 self storePointerUnchecked: i ofObject: objOop withValue: oop]].
  		 objOop := self objectAfter: objOop limit: segAddr].
  	^outIndex!



More information about the Vm-dev mailing list