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

commits at source.squeak.org commits at source.squeak.org
Tue Oct 29 19:46:11 UTC 2013


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

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

Name: VMMaker.oscog-eem.481
Author: eem
Time: 29 October 2013, 12:43:06.4 pm
UUID: aa1f9c6c-b888-4ef6-9ca2-8f765256b7f9
Ancestors: VMMaker.oscog-eem.480

Call a misfit a misfit.  Just because it doesn't fit in doesn't mean it's a failure.

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

Item was changed:
  ----- Method: SpurMemoryManager>>exactFitCompact (in category 'compaction') -----
  exactFitCompact
  	"Compact all of memory above firstFreeChunk using exact-fit, assuming free
  	 space is sorted and that the highest objects are recorded in highestObjects.
  	 Note that we don't actually move; we merely copy and forward.  Eliminating
  	 forwarders will be done in a final pass.
  	 Leave the objects that don't fit exactly, and hence aren't moved, in highestObjects."
  
  	<returnTypeC: #void>
  	<inline: false>
+ 	| misfits first |
+ 	<var: #misfits type: #usqInt>
- 	| failures first |
- 	<var: #failures type: #usqInt>
  	totalFreeOldSpace = 0 ifTrue: [^0].
+ 	misfits := highestObjects last + self wordSize.
- 	failures := highestObjects last + self wordSize.
  	[statCompactPassCount := statCompactPassCount + 1.
+ 	 highestObjects from: misfits - self wordSize reverseDo:
- 	 highestObjects from: failures - self wordSize reverseDo:
  		[:o| | b |
  		o < firstFreeChunk ifTrue:
+ 			[misfits = (highestObjects last + self wordSize)
- 			[failures = (highestObjects last + self wordSize)
  				ifTrue: [highestObjects resetAsEmpty]
+ 				ifFalse: [highestObjects first: misfits].
- 				ifFalse: [highestObjects first: failures].
  			 ^self].
  		 ((self isForwarded: o) or: [self isPinned: o]) ifFalse:
  			[b := self bytesInObject: o.
  			 (self allocateOldSpaceChunkOfExactlyBytes: b suchThat: [:f| f < o])
  				ifNil:
+ 					[misfits := misfits - self wordSize.
+ 					 misfits < highestObjects start ifTrue:
+ 						[misfits := highestObjects limit].
+ 					 self longAt: misfits put: o]
- 					[failures := failures - self wordSize.
- 					 failures < highestObjects start ifTrue:
- 						[failures := highestObjects limit].
- 					 self longAt: failures put: o]
  				ifNotNil:
  					[:f| self copyAndForward: o withBytes: b toFreeChunk: f]]].
+ 	 "now highestObjects contains only misfits, if any, from misfits to last.
+ 	  set first to first failure and refill buffer. next cycle will add more misfits.
- 	 "now highestObjects contains only failures, if any, from failures to last.
- 	  set first to first failure and refill buffer. next cycle will add more failures.
  	  give up on exact-fit when half of the highest objects fail to fit."
  	 first := self longAt: highestObjects first.
  	 first > firstFreeChunk ifTrue:
  		[| highestObjBytes failureBytes savedLimit |
  		 highestObjBytes := highestObjects limit - highestObjects start.
+ 		 failureBytes := highestObjects last >= misfits
+ 							ifTrue: [highestObjects last - misfits]
+ 							ifFalse: [highestObjBytes - (misfits - highestObjects last)].
- 		 failureBytes := highestObjects last >= failures
- 							ifTrue: [highestObjects last - failures]
- 							ifFalse: [highestObjBytes - (failures - highestObjects last)].
  		 failureBytes >= (highestObjBytes // 2) ifTrue:
+ 			[highestObjects first: misfits.
- 			[highestObjects first: failures.
  			 ^self].
+ 		 savedLimit := self moveMisfitsToTopOfHighestObjects: misfits.
- 		 savedLimit := self moveFailuresToTopOfHighestObjects: failures.
  		 self fillHighestObjectsWithMovableObjectsFrom: firstFreeChunk upTo: first.
+ 		 misfits := self moveMisfitsInHighestObjectsBack: savedLimit]] repeat!
- 		 failures := self moveFailuresInHighestObjectsBack: savedLimit]] repeat!

Item was removed:
- ----- Method: SpurMemoryManager>>moveFailuresInHighestObjectsBack: (in category 'compaction') -----
- moveFailuresInHighestObjectsBack: savedLimit
- 	"After refilling highestObjects move any failures back to being
- 	 adjacent with the new objects, reset the space's limit and
- 	 answer the pointer to the lowest failure to resume the scan."
- 
- 	| newFailuresPosition |
- 	savedLimit = highestObjects limit ifTrue:
- 		[^highestObjects last].
- 	"simple; we didnt fill all the way; just move failures down."
- 	(highestObjects first = highestObjects start
- 	 and: [highestObjects last < highestObjects limit]) ifTrue:
- 		[newFailuresPosition := highestObjects limit.
- 		 self mem: newFailuresPosition
- 			mo: highestObjects last + self wordSize
- 			ve: savedLimit - newFailuresPosition.
- 		 highestObjects limit: savedLimit.
- 		 ^newFailuresPosition].
- 	"tricky to do unless we have last - start's worth of free space.
- 	 we *don't* want to rotate lots and lots of objects.  We could push
- 	 failures onto the mark stack, if it is big enough.
- 	 limit: | failures hi <-> lo | lowest candidates | highest candidates | : start
- 	                                                      ^ last"
- 	self shouldBeImplemented.
- 	^newFailuresPosition!

Item was removed:
- ----- Method: SpurMemoryManager>>moveFailuresToTopOfHighestObjects: (in category 'compaction') -----
- moveFailuresToTopOfHighestObjects: failures
- 	"After a cycle of exact-fit compaction highestObjects may contain some
- 	 number of mobile objects that fail to fit, and more objects may exist to
- 	 move.  Move existing failures to top of highestObjects and temporarily
- 	 shrink highestObjects to refill it without overwriting failues.  Answer the
- 	 old limit. moveFailuresInHighestObjectsBack: will undo the change."
- 
- 	| oldLimit bytesToMove |
- 	oldLimit := highestObjects limit.
- 	failures = (highestObjects last + self wordSize) ifTrue:
- 		[highestObjects resetAsEmpty.
- 		 ^oldLimit].
- 	failures <= highestObjects last ifTrue:
- 		[bytesToMove := highestObjects last + self wordSize - failures.
- 		 self mem: highestObjects limit - bytesToMove
- 			mo: failures
- 			ve: bytesToMove.
- 		 highestObjects limit: failures - self wordSize.
- 		 ^oldLimit].
- 	"failures wrapped; move in two stages to preserve ordering"
- 	bytesToMove := highestObjects last - highestObjects start.
- 	self mem: failures - bytesToMove
- 		mo: failures
- 		ve: oldLimit - failures.
- 	highestObjects limit: failures - bytesToMove.
- 	self mem: oldLimit - bytesToMove
- 		mo: highestObjects start
- 		ve: bytesToMove.
- 	^oldLimit!

Item was added:
+ ----- Method: SpurMemoryManager>>moveMisfitsInHighestObjectsBack: (in category 'compaction') -----
+ moveMisfitsInHighestObjectsBack: savedLimit
+ 	"After refilling highestObjects move any misfits back to being
+ 	 adjacent with the new objects, reset the space's limit and
+ 	 answer the pointer to the lowest failure to resume the scan."
+ 
+ 	| newMisfitsPosition |
+ 	savedLimit = highestObjects limit ifTrue:
+ 		[^highestObjects last].
+ 	"simple; we didnt fill all the way; just move misfits down."
+ 	(highestObjects first = highestObjects start
+ 	 and: [highestObjects last < highestObjects limit]) ifTrue:
+ 		[newMisfitsPosition := highestObjects limit.
+ 		 self mem: newMisfitsPosition
+ 			mo: highestObjects last + self wordSize
+ 			ve: savedLimit - newMisfitsPosition.
+ 		 highestObjects limit: savedLimit.
+ 		 ^newMisfitsPosition].
+ 	"tricky to do unless we have last - start's worth of free space.
+ 	 we *don't* want to rotate lots and lots of objects.  We could push
+ 	 misfits onto the mark stack, if it is big enough.
+ 	 limit: | misfits hi <-> lo | lowest candidates | highest candidates | : start
+ 	                                                                   ^ last"
+ 	self shouldBeImplemented.
+ 	^newMisfitsPosition!

Item was added:
+ ----- Method: SpurMemoryManager>>moveMisfitsToTopOfHighestObjects: (in category 'compaction') -----
+ moveMisfitsToTopOfHighestObjects: misfits
+ 	"After a cycle of exact-fit compaction highestObjects may contain some
+ 	 number of mobile objects that fail to fit, and more objects may exist to
+ 	 move.  Move existing misfits to top of highestObjects and temporarily
+ 	 shrink highestObjects to refill it without overwriting misfits.  Answer the
+ 	 old limit. moveMisfitsInHighestObjectsBack: will undo the change."
+ 
+ 	| oldLimit bytesToMove |
+ 	oldLimit := highestObjects limit.
+ 	misfits = (highestObjects last + self wordSize) ifTrue:
+ 		[highestObjects resetAsEmpty.
+ 		 ^oldLimit].
+ 	misfits <= highestObjects last ifTrue:
+ 		[bytesToMove := highestObjects last + self wordSize - misfits.
+ 		 self mem: highestObjects limit - bytesToMove
+ 			mo: misfits
+ 			ve: bytesToMove.
+ 		 highestObjects limit: misfits - self wordSize.
+ 		 ^oldLimit].
+ 	"misfits wrapped; move in two stages to preserve ordering"
+ 	bytesToMove := highestObjects last - highestObjects start.
+ 	self mem: misfits - bytesToMove
+ 		mo: misfits
+ 		ve: oldLimit - misfits.
+ 	highestObjects limit: misfits - bytesToMove.
+ 	self mem: oldLimit - bytesToMove
+ 		mo: highestObjects start
+ 		ve: bytesToMove.
+ 	^oldLimit!



More information about the Vm-dev mailing list